JDK-8137058 : Clear out all non-Critical APIs from sun.reflect and move to jdk.unsupported
  • Type: Sub-task
  • Component: core-libs
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-09-23
  • Updated: 2016-04-27
  • Resolved: 2016-04-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b115Fixed
Related Reports
Relates :  
Relates :  
Description
As per JEP 260, all non-Critical types/members should be moved out of
sun/reflect and placed into a non-exported package. Only critical APIs
should remain in sun.reflect.
Comments
This change will move the machinery that implements the `java.lang(.reflect)` subsystem, therefore the stack trace of reflective calls will appear somewhat different. That is, stack frames that represent the reflective implementation will see their class name ( `StackTraceElement.getClassName()` ) change from `sun.reflect.XXX` to `jdk.internal.reflect.XXX`. Any code analysing, or filtering, based on the stack trace element's class name should be updated appropriately, to handle this. Foe example: $ cat Foo.java public class Foo { public static void main(String[] args) throws Exception { Foo.class.getDeclaredMethod("foo", new Class<?>[] {}).invoke(null); } static void foo() { Thread.dumpStack(); } } # BEFORE $ java Foo java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1329) at Foo.foo(Foo.java:7) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at Foo.main(Foo.java:3) # AFTER $ build/linux-x86_64-normal-server-release/images/jdk/bin/java Foo Stack trace at java.lang.Thread.dumpStack(java.base@9-internal/Thread.java:1391) at Foo.foo(Foo.java:7) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-internal/Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-internal/NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-internal/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@9-internal/Method.java:531) at Foo.main(Foo.java:3)
14-04-2016