-
Bug
-
Resolution: Fixed
-
P4
-
21.0.5, 23
-
b11
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8341872 | 23.0.2 | Calvin Cheung | P4 | Resolved | Fixed | b03 |
JDK-8339337 | 21.0.6-oracle | Calvin Cheung | P4 | Resolved | Fixed | b01 |
JDK-8340350 | 21.0.6 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
JDK-8340281 | 21.0.5 | Goetz Lindenmaier | P4 | Resolved | Fixed | b08 |
```
Caused by: java.lang.IllegalArgumentException: Can not get final java.lang.Class field java.lang.Class.componentType on java.lang.Class
at java.base/jdk.internal.reflect.MethodHandleFieldAccessorImpl.newGetIllegalArgumentException(MethodHandleFieldAccessorImpl.java:86)
at java.base/jdk.internal.reflect.MethodHandleObjectFieldAccessorImpl.get(MethodHandleObjectFieldAccessorImpl.java:61)
at java.base/java.lang.reflect.Field.get(Field.java:444)
```
The symptoms look similar to https://bugs.openjdk.org/browse/JDK-8301663 which was fixed in JDK 20, but testing the repro from that bug shows a regression between JDK 22 and JDK 23:
import java.lang.reflect.Field;
public class C {
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 100_000; ++i) {
try {
Field f = Class.class.getDeclaredField("componentType");
f.setAccessible(true);
Object val = f.get(Runnable.class);
} catch (IllegalArgumentException e) {
count += 1;
}
}
System.out.println(count);
}
}
java -fullversion
openjdk full version "22.0.2+9-70"
java --add-opens java.base/java.lang=ALL-UNNAMED C
0
java -fullversion
openjdk full version "23-ea+34-2361"
java --add-opens java.base/java.lang=ALL-UNNAMED C
18499
- backported by
-
JDK-8339337 IllegalArgumentException in java.lang.reflect.Field.get
- Resolved
-
JDK-8340281 IllegalArgumentException in java.lang.reflect.Field.get
- Resolved
-
JDK-8340350 IllegalArgumentException in java.lang.reflect.Field.get
- Resolved
-
JDK-8341872 IllegalArgumentException in java.lang.reflect.Field.get
- Resolved
- duplicates
-
JDK-8341343 Field#get:"Can not get final java.lang.Class field java.lang.Class.componentTyp"
- Closed
- relates to
-
JDK-8333542 Breakpoint in parallel code does not work
- Resolved
-
JDK-8301663 java.lang.reflect.Field.get(Runnable.class) throws IllegalArgumentException
- Closed
- links to
-
Commit(master) openjdk/jdk21u/b99bff9e
-
Commit(master) openjdk/jdk23u/f83e6433
-
Commit(master) openjdk/jdk/41e31d6b
-
Review(master) openjdk/jdk21u/454
-
Review(master) openjdk/jdk23u/179
-
Review(master) openjdk/jdk/20498
1.
|
Release Note: IllegalArgumentException in java.lang.reflect.Field.get | Closed | Unassigned |