List of usage examples for org.eclipse.jdt.internal.compiler.flow ExceptionHandlingFlowContext ExceptionHandlingFlowContext
public ExceptionHandlingFlowContext(FlowContext parent, TryStatement tryStatement, ReferenceBinding[] handledExceptions, int[] exceptionToCatchBlockMap, FlowContext initializationParent, BlockScope scope, FlowInfo flowInfo)
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/* ww w . j a v a 2 s . 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; }