List of usage examples for org.eclipse.jdt.internal.compiler.flow UnconditionalFlowInfo UnconditionalFlowInfo
UnconditionalFlowInfo
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.GuardPredicateDeclaration.java
License:Open Source License
Statement tryCatch(Statement tryStatement, TypeReference exceptionType, Statement catchStatement) {
TryStatement result = new TryStatement() {
@Override/*from w w w. ja v a2s.c o m*/
protected ExceptionHandlingFlowContext createFlowContext(FlowContext flowContext, FlowInfo flowInfo) {
return new ExceptionHandlingFlowContext(flowContext, this, Binding.NO_EXCEPTIONS, // treat all exceptions as undeclared, want to see the error/warning
new int[0], null, // initializationParent
this.scope, flowInfo) {
@Override
public UnconditionalFlowInfo initsOnException(int index) {
return new UnconditionalFlowInfo(); // empty, avoid AIOOBE in super method (empty array initsOnExceptions)
}
};
}
};
result.sourceStart = this.sourceStart;
result.sourceEnd = this.sourceEnd;
// fill sub-elements:
AstGenerator gen = new AstGenerator(this.sourceStart, this.sourceEnd);
result.tryBlock = gen.block(new Statement[] { tryStatement });
result.catchArguments = new Argument[] { gen.argument("exc".toCharArray(), exceptionType) }; //$NON-NLS-1$
result.catchBlocks = new Block[] { gen.block(new Statement[] { catchStatement }) };
return result;
}