Java Code Examples for org.eclipse.jdt.core.dom.CatchClause#getException()
The following examples show how to use
org.eclipse.jdt.core.dom.CatchClause#getException() .
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: FullConstraintCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public ITypeConstraint[] create(CatchClause node) { SingleVariableDeclaration exception= node.getException(); ConstraintVariable nameVariable= fConstraintVariableFactory.makeExpressionOrTypeVariable(exception.getName(), getContext()); ITypeConstraint[] defines= fTypeConstraintFactory.createDefinesConstraint( nameVariable, fConstraintVariableFactory.makeTypeVariable(exception.getType())); ITypeBinding throwable= node.getAST().resolveWellKnownType("java.lang.Throwable"); //$NON-NLS-1$ ITypeConstraint[] catchBound= fTypeConstraintFactory.createSubtypeConstraint( nameVariable, fConstraintVariableFactory.makeRawBindingVariable(throwable)); ArrayList<ITypeConstraint> result= new ArrayList<ITypeConstraint>(); result.addAll(Arrays.asList(defines)); result.addAll(Arrays.asList(catchBound)); return result.toArray(new ITypeConstraint[result.size()]); }
Example 2
Source File: StatementAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void endVisit(TryStatement node) { ASTNode firstSelectedNode= getFirstSelectedNode(); if (getSelection().getEndVisitSelectionMode(node) == Selection.AFTER) { if (firstSelectedNode == node.getBody() || firstSelectedNode == node.getFinally()) { invalidSelection(RefactoringCoreMessages.StatementAnalyzer_try_statement); } else { List<CatchClause> catchClauses= node.catchClauses(); for (Iterator<CatchClause> iterator= catchClauses.iterator(); iterator.hasNext();) { CatchClause element= iterator.next(); if (element == firstSelectedNode || element.getBody() == firstSelectedNode) { invalidSelection(RefactoringCoreMessages.StatementAnalyzer_try_statement); } else if (element.getException() == firstSelectedNode) { invalidSelection(RefactoringCoreMessages.StatementAnalyzer_catch_argument); } } } } super.endVisit(node); }
Example 3
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public final void endVisit(final CatchClause node) { final SingleVariableDeclaration declaration= node.getException(); if (declaration != null) { final ConstraintVariable2 descendant= (ConstraintVariable2) declaration.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) { final ITypeBinding binding= node.getAST().resolveWellKnownType("java.lang.Throwable"); //$NON-NLS-1$ if (binding != null) { final ConstraintVariable2 ancestor= fModel.createImmutableTypeVariable(binding); if (ancestor != null) fModel.createSubtypeConstraint(descendant, ancestor); } } } }
Example 4
Source File: InferTypeArgumentsConstraintCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean visit(CatchClause node) { SingleVariableDeclaration exception= node.getException(); IVariableBinding variableBinding= exception.resolveBinding(); VariableVariable2 cv= fTCModel.makeDeclaredVariableVariable(variableBinding, fCU); setConstraintVariable(exception, cv); return true; }