@Override public void visitThrowStatement(GrThrowStatement throwStatement) { final GrExpression exception = throwStatement.getException(); if (exception == null) { builder.append("throw ;"); return; } writeStatement( throwStatement, new StatementWriter() { @Override public void writeStatement(StringBuilder builder, ExpressionContext context) { builder.append("throw "); writeExpression( exception, builder, context); // todo add exception to method 'throws' list builder.append(';'); } }); }
public void visitThrowStatement(GrThrowStatement throwStatement) { final GrExpression exception = throwStatement.getException(); if (exception == null) return; exception.accept(this); final InstructionImpl throwInstruction = new ThrowingInstruction(throwStatement); addNodeAndCheckPending(throwInstruction); interruptFlow(); final PsiType type = getNominalTypeNoRecursion(exception); if (type != null) { ExceptionInfo info = findCatch(type); if (info != null) { info.myThrowers.add(throwInstruction); } else { addPendingEdge(null, throwInstruction); } } else { addPendingEdge(null, throwInstruction); } }
private static boolean throwStatementsAreEquivalent( @NotNull GrThrowStatement statement1, @NotNull GrThrowStatement statement2) { final GrExpression exception1 = statement1.getException(); final GrExpression exception2 = statement2.getException(); return expressionsAreEquivalent(exception1, exception2); }
@Override public void visitThrowStatement(GrThrowStatement throwStatement) { final PsiClassType throwable = PsiType.getJavaLangThrowable(myExpression.getManager(), throwStatement.getResolveScope()); myResult = new TypeConstraint[] {SubtypeConstraint.create(throwable)}; }