Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8137055 Prepare for JEP 260
  3. JDK-8137058

Clear out all non-Critical APIs from sun.reflect and move to jdk.unsupported

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Resolved In Build:
      b115

      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.

        Issue Links

          Activity

          Hide
          chegar Chris Hegarty added a comment - - edited
          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)
          Show
          chegar Chris Hegarty added a comment - - edited 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)
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/corba/rev/7bab1b1b3682
          User: chegar
          Date: 2016-04-15 15:22:45 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/corba/rev/7bab1b1b3682 User: chegar Date: 2016-04-15 15:22:45 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/8606d027b2c2
          User: chegar
          Date: 2016-04-15 15:23:07 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/8606d027b2c2 User: chegar Date: 2016-04-15 15:23:07 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/88dd08d7be0f
          User: chegar
          Date: 2016-04-15 15:23:14 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/88dd08d7be0f User: chegar Date: 2016-04-15 15:23:14 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/295ac208a444
          User: chegar
          Date: 2016-04-15 15:23:20 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/295ac208a444 User: chegar Date: 2016-04-15 15:23:20 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/corba/rev/7bab1b1b3682
          User: lana
          Date: 2016-04-20 17:52:22 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/corba/rev/7bab1b1b3682 User: lana Date: 2016-04-20 17:52:22 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/295ac208a444
          User: lana
          Date: 2016-04-20 17:52:38 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/295ac208a444 User: lana Date: 2016-04-20 17:52:38 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/8606d027b2c2
          User: lana
          Date: 2016-04-20 17:52:51 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/8606d027b2c2 User: lana Date: 2016-04-20 17:52:51 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/88dd08d7be0f
          User: lana
          Date: 2016-04-20 17:53:12 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/88dd08d7be0f User: lana Date: 2016-04-20 17:53:12 +0000

            People

            • Assignee:
              chegar Chris Hegarty
              Reporter:
              chegar Chris Hegarty
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: