dfa: fix false positive when throwing parameter

remove complicated code that the tests pass without
This commit is contained in:
peter
2017-03-08 16:02:36 +01:00
parent 60b937e7c3
commit 3849e3c228
2 changed files with 4 additions and 11 deletions
@@ -52,7 +52,6 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
private FList<Trap> myTrapStack = FList.emptyList();
private final ExceptionTransfer myRuntimeException;
private final ExceptionTransfer myError;
private final PsiType myNpe;
private final PsiType myAssertionError;
ControlFlowAnalyzer(final DfaValueFactory valueFactory, @NotNull PsiElement codeFragment, boolean ignoreAssertions) {
@@ -63,7 +62,6 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
GlobalSearchScope scope = codeFragment.getResolveScope();
myRuntimeException = new ExceptionTransfer(myFactory.createTypeValue(createClassType(scope, JAVA_LANG_RUNTIME_EXCEPTION), Nullness.NOT_NULL));
myError = new ExceptionTransfer(myFactory.createTypeValue(createClassType(scope, JAVA_LANG_ERROR), Nullness.NOT_NULL));
myNpe = createClassType(scope, JAVA_LANG_NULL_POINTER_EXCEPTION);
myAssertionError = createClassType(scope, JAVA_LANG_ASSERTION_ERROR);
}
@@ -708,16 +706,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
exception.accept(this);
addConditionalRuntimeThrow();
addInstruction(new DupInstruction());
addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
addInstruction(new BinopInstruction(JavaTokenType.EQEQ, null, myProject));
ConditionalGotoInstruction gotoInstruction = new ConditionalGotoInstruction(null, true, null);
addInstruction(gotoInstruction);
addInstruction(new FieldReferenceInstruction(exception, "thrown exception"));
throwException(myNpe, statement);
gotoInstruction.setOffset(myCurrentFlow.getInstructionCount());
throwException(exception.getType(), statement);
}