mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] Stop analysis completely after impossible cast outside of try-catch
Improves UnreachableCodeInspection GitOrigin-RevId: 87a98ad8c3c0ca544e86c9bb1c98267dc939a728
This commit is contained in:
committed by
intellij-monorepo-bot
parent
557fbd5c52
commit
434301c3b9
+3
-1
@@ -103,7 +103,9 @@ public class TypeCastInstruction extends ExpressionPushingInstruction {
|
||||
}
|
||||
}
|
||||
|
||||
result.add(nextState(interpreter, stateBefore));
|
||||
if (castPossible) {
|
||||
result.add(nextState(interpreter, stateBefore));
|
||||
}
|
||||
pushResult(interpreter, stateBefore, stateBefore.pop());
|
||||
}
|
||||
UnsatisfiedConditionProblem problem = getConditionProblem();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
Object o = "12";
|
||||
Integer a = (Integer) o;
|
||||
<warning descr="Unreachable code">System.out.println("1");</warning>
|
||||
}
|
||||
}
|
||||
+2
@@ -39,6 +39,8 @@ public class UnreachableCodeInspectionTest extends LightJavaCodeInsightFixtureTe
|
||||
public void testCatchLinkageError() { doTest(); }
|
||||
|
||||
public void testLambdaCast() { doTest(); }
|
||||
|
||||
public void testFailingCast() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
|
||||
Reference in New Issue
Block a user