-
Bug
-
Resolution: Fixed
-
P2
-
24
-
None
-
b05
The following code that used to execute fine, throws ClassCastException after JDK-8294960:
import java.util.function.Predicate;
public class Test {
public static void main(String[] args) {
doTest(Test::predicate, 'x');
}
public static boolean doTest(Predicate<Character> predicate, char c) {
return predicate.test(c);
}
public static boolean predicate(int c) {
return '0' <= c && c <= '9';
}
}
Exception in thread "main" java.lang.ClassCastException: class java.lang.Character cannot be cast to class java.lang.Number (java.lang.Character and java.lang.Number are in module java.base of loader 'bootstrap')
at Test.doTest(Test.java:10)
at Test.main(Test.java:6)
import java.util.function.Predicate;
public class Test {
public static void main(String[] args) {
doTest(Test::predicate, 'x');
}
public static boolean doTest(Predicate<Character> predicate, char c) {
return predicate.test(c);
}
public static boolean predicate(int c) {
return '0' <= c && c <= '9';
}
}
Exception in thread "main" java.lang.ClassCastException: class java.lang.Character cannot be cast to class java.lang.Number (java.lang.Character and java.lang.Number are in module java.base of loader 'bootstrap')
at Test.doTest(Test.java:10)
at Test.main(Test.java:6)
- relates to
-
JDK-8294960 Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handles
- Resolved