Skip to content

Commit

Permalink
Unit Test for ECJ vs JAVAC difference in behavioues in Primitives in
Browse files Browse the repository at this point in the history
Patterns - issue eclipse-jdt#3535
  • Loading branch information
mpalat committed Jan 22, 2025
1 parent 825b15c commit e02e11b
Showing 1 changed file with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class PrimitiveInPatternsTest extends AbstractRegressionTest9 {
static {
// TESTS_NUMBERS = new int [] { 1 };
// TESTS_RANGE = new int[] { 1, -1 };
// TESTS_NAMES = new String[] { "testIssue3505" };
// TESTS_NAMES = new String[] { "testIssue3535" };
}
private String extraLibPath;
public static Class<?> testClass() {
Expand Down Expand Up @@ -7416,4 +7416,37 @@ public T get() {
"1");
}

public void testIssue3535() {
runConformTest(new String[] {
"X.java",
"""
public class X {
static Integer getInteger() {
return Integer.MIN_VALUE;
}
public int foo() {
Integer i = 10;
Y<Integer> f = new Y<>();
f.put(X.getInteger()); // This makes all the difference
return f.get() instanceof float ? 3 : 2;
}
public static void main(String[] args) {
System.out.println(new X().foo());
}
}
class Y <T> {
T t;
T get() {
return t;
}
void put( T t) {
this.t = t;
}
}
"""
},
"3");
}
}

0 comments on commit e02e11b

Please sign in to comment.