-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
12
-
b12
-
x86_64
-
generic
ADDITIONAL SYSTEM INFORMATION :
Windows 10
Java 12 early #27
A DESCRIPTION OF THE PROBLEM :
Calling Field.class.getDeclaredField("modifiers") throws an exception but it exists.
It's usually used to update private static fields (like in tests in my case) like explained in http://java-performance.info/updating-final-and-static-final-fields/ : you mark the field accessible and you change its modifier value
REGRESSION : Last worked in version 11.0.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simply call Field.class.getDeclaredField("modifiers")
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You have a Field object
ACTUAL -
An exception is thrown
---------- BEGIN SOURCE ----------
import java.lang.reflect.Field;
class Scratch {
public static void main(String... args) throws Exception {
Field modifiers = Field.class.getDeclaredField("modifiers");
System.out.println("It's working: " + modifiers);
}
}
---------- END SOURCE ----------
FREQUENCY : always
Windows 10
Java 12 early #27
A DESCRIPTION OF THE PROBLEM :
Calling Field.class.getDeclaredField("modifiers") throws an exception but it exists.
It's usually used to update private static fields (like in tests in my case) like explained in http://java-performance.info/updating-final-and-static-final-fields/ : you mark the field accessible and you change its modifier value
REGRESSION : Last worked in version 11.0.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simply call Field.class.getDeclaredField("modifiers")
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You have a Field object
ACTUAL -
An exception is thrown
---------- BEGIN SOURCE ----------
import java.lang.reflect.Field;
class Scratch {
public static void main(String... args) throws Exception {
Field modifiers = Field.class.getDeclaredField("modifiers");
System.out.println("It's working: " + modifiers);
}
}
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8218269 Can't reflect into java.lang.reflect.*
- Closed