diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PrimitiveInPatternsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PrimitiveInPatternsTest.java index 8670e433d6d..aaed2026487 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PrimitiveInPatternsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PrimitiveInPatternsTest.java @@ -25,7 +25,7 @@ public class PrimitiveInPatternsTest extends AbstractRegressionTest9 { static { // TESTS_NUMBERS = new int [] { 1 }; // TESTS_RANGE = new int[] { 1, -1 }; -// TESTS_NAMES = new String[] { "testIssuePrimitivesWithNull" }; +// TESTS_NAMES = new String[] { "testIssue3505" }; } private String extraLibPath; public static Class testClass() { @@ -7386,5 +7386,30 @@ public static void main(String[] args) { }, "Default"); } + public void testIssue3505() { + runConformTest(new String[] { + "X.java", + """ + public class X { + + public static int foo() { + Y y = new Y<>(); + y.value = 100f; + return y.get() instanceof float ? 1 : 0; + } + public static void main(String[] args) { + System.out.println(X.foo()); + } + } + + class Y { + T value; + public T get() { + return this.value; + } + } """ + }, + "1"); + } }