mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] IDEA-349093 Cast to unresolved reference inside try-catch causes 'Unreachable code' warning
GitOrigin-RevId: c9098e741070cddd1c89936045481521d5823bf7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e19f123a6c
commit
5e168b68c6
+1
-1
@@ -79,7 +79,7 @@ public class TypeCastInstruction extends ExpressionPushingInstruction {
|
||||
List<DfaInstructionState> result = new ArrayList<>();
|
||||
if (myTransferValue != null) {
|
||||
DfaMemoryState castFail = stateBefore.createCopy();
|
||||
if (fromType != null && myCastTo.isConvertibleFrom(fromType)) {
|
||||
if (fromType != null && (!constraint.isResolved() || myCastTo.isConvertibleFrom(fromType))) {
|
||||
if (!castTopOfStack(factory, stateBefore, constraint)) {
|
||||
castPossible = false;
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
class Test {
|
||||
void test(Object obj) {
|
||||
try {
|
||||
System.out.println((<error descr="Cannot resolve symbol 'MyUnresolvedClass'">MyUnresolvedClass</error>)obj);
|
||||
System.out.println("hello");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -41,6 +41,8 @@ public class UnreachableCodeInspectionTest extends LightJavaCodeInsightFixtureTe
|
||||
public void testLambdaCast() { doTest(); }
|
||||
|
||||
public void testFailingCast() { doTest(); }
|
||||
|
||||
public void testUnresolvedCast() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
|
||||
Reference in New Issue
Block a user