-
Bug
-
Resolution: Fixed
-
P2
-
14
-
b26
Compiler is reporting AssertionError when pattern matching for instanceof is used in the conditional operator ? :
Sample Code:
public class TestPattern {
public static void main(String[] args) {
Object ax = "";
boolean result = (ax instanceof String a) ? (ax instanceof String a) : (! (ax instanceof String a));
System.out.println("result = " + result);
}
}
Result: AssertionError
Expected result: result = true
Compiler log is attached below:
Sample Code:
public class TestPattern {
public static void main(String[] args) {
Object ax = "";
boolean result = (ax instanceof String a) ? (ax instanceof String a) : (! (ax instanceof String a));
System.out.println("result = " + result);
}
}
Result: AssertionError
Expected result: result = true
Compiler log is attached below: