@Override public Void visitCatchClause(CatchClause node) { SimpleIdentifier exceptionParameter = node.getExceptionParameter(); if (exceptionParameter != null) { VariableElementImpl exception = new VariableElementImpl(exceptionParameter); currentHolder.addVariable(exception); SimpleIdentifier stackTraceParameter = node.getStackTraceParameter(); if (stackTraceParameter != null) { VariableElementImpl stackTrace = new VariableElementImpl(stackTraceParameter); currentHolder.addVariable(stackTrace); } } node.visitChildren(this); return null; }
@Override public Void visitCatchClause(CatchClause node) { visit("on ", node.getExceptionType()); if (node.getCatchKeyword() != null) { if (node.getExceptionType() != null) { writer.print(' '); } writer.print("catch ("); visit(node.getExceptionParameter()); visit(", ", node.getStackTraceParameter()); writer.print(") "); } else { writer.print(" "); } visit(node.getBody()); return null; }
@Override public Void visitCatchClause(CatchClause node) { SimpleIdentifier exceptionParameter = node.getExceptionParameter(); if (exceptionParameter != null) { LocalVariableElementImpl exception = new LocalVariableElementImpl(exceptionParameter); currentHolder.addLocalVariable(exception); exceptionParameter.setStaticElement(exception); SimpleIdentifier stackTraceParameter = node.getStackTraceParameter(); if (stackTraceParameter != null) { LocalVariableElementImpl stackTrace = new LocalVariableElementImpl(stackTraceParameter); currentHolder.addLocalVariable(stackTrace); stackTraceParameter.setStaticElement(stackTrace); } } return super.visitCatchClause(node); }