Java Code Examples for org.eclipse.jdt.internal.compiler.lookup.Binding#NO_EXCEPTIONS

The following examples show how to use org.eclipse.jdt.internal.compiler.lookup.Binding#NO_EXCEPTIONS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InitializationFlowContext.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public InitializationFlowContext(FlowContext parent, ASTNode associatedNode, FlowInfo initsBeforeContext, FlowContext initializationParent, BlockScope scope) {
	super(
		parent,
		associatedNode,
		Binding.NO_EXCEPTIONS, // no exception allowed by default
		initializationParent,
		scope,
		FlowInfo.DEAD_END);
	this.initsBeforeContext = initsBeforeContext;
}
 
Example 2
Source File: ExplicitConstructorCall.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
	// must verify that exceptions potentially thrown by this expression are caught in the method.

	try {
		((MethodScope) currentScope).isConstructorCall = true;

		// process enclosing instance
		if (this.qualification != null) {
			flowInfo =
				this.qualification
					.analyseCode(currentScope, flowContext, flowInfo)
					.unconditionalInits();
		}
		// process arguments
		if (this.arguments != null) {
			boolean analyseResources = currentScope.compilerOptions().analyseResourceLeaks;
			for (int i = 0, max = this.arguments.length; i < max; i++) {
				flowInfo =
					this.arguments[i]
						.analyseCode(currentScope, flowContext, flowInfo)
						.unconditionalInits();
				if (analyseResources) {
					// if argument is an AutoCloseable insert info that it *may* be closed (by the target constructor, i.e.)
					flowInfo = FakedTrackingVariable.markPassedToOutside(currentScope, this.arguments[i], flowInfo, flowContext, false);
				}
				this.arguments[i].checkNPEbyUnboxing(currentScope, flowContext, flowInfo);
			}
			analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments);
		}

		ReferenceBinding[] thrownExceptions;
		if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
			if ((this.bits & ASTNode.Unchecked) != 0 && this.genericTypeArguments == null) {
				// https://bugs.eclipse.org/bugs/show_bug.cgi?id=277643, align with javac on JLS 15.12.2.6
				thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.thrownExceptions, true, true);
			}				
			// check exceptions
			flowContext.checkExceptionHandlers(
				thrownExceptions,
				(this.accessMode == ExplicitConstructorCall.ImplicitSuper)
					? (ASTNode) currentScope.methodScope().referenceContext
					: (ASTNode) this,
				flowInfo,
				currentScope);
		}
		manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo);
		manageSyntheticAccessIfNecessary(currentScope, flowInfo);
		return flowInfo;
	} finally {
		((MethodScope) currentScope).isConstructorCall = false;
	}
}
 
Example 3
Source File: Clinit.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void analyseCode(
	ClassScope classScope,
	InitializationFlowContext staticInitializerFlowContext,
	FlowInfo flowInfo) {

	if (this.ignoreFurtherInvestigation)
		return;
	try {
		ExceptionHandlingFlowContext clinitContext =
			new ExceptionHandlingFlowContext(
				staticInitializerFlowContext.parent,
				this,
				Binding.NO_EXCEPTIONS,
				staticInitializerFlowContext,
				this.scope,
				FlowInfo.DEAD_END);

		// check for missing returning path
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
			this.bits |= ASTNode.NeedFreeReturn;
		}

		// check missing blank final field initializations
		flowInfo = flowInfo.mergedWith(staticInitializerFlowContext.initsOnReturn);
		FieldBinding[] fields = this.scope.enclosingSourceType().fields();
		for (int i = 0, count = fields.length; i < count; i++) {
			FieldBinding field = fields[i];
			if (field.isStatic()) {
				if (!flowInfo.isDefinitelyAssigned(field)) {
					if (field.isFinal()) {
						this.scope.problemReporter().uninitializedBlankFinalField(
								field,
								this.scope.referenceType().declarationOf(field.original()));
						// can complain against the field decl, since only one <clinit>
					} else if (field.isNonNull()) {
						this.scope.problemReporter().uninitializedNonNullField(
								field,
								this.scope.referenceType().declarationOf(field.original()));
					}
				}
			}
		}
		// check static initializers thrown exceptions
		staticInitializerFlowContext.checkInitializerExceptions(
			this.scope,
			clinitContext,
			flowInfo);
	} catch (AbortMethod e) {
		this.ignoreFurtherInvestigation = true;
	}
}