Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8145070

MethodHandles.publicLookup()'s lookup class is not java.lang.Object

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      Per javadoc of MethodHandles.publicLookup() https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/MethodHandles.html#publicLookup-- "As a matter of pure convention, the lookup class of this lookup object will be Object."

      import java.lang.invoke.MethodHandles;

      class PublicLookupClass {
         public static void main(String[] args) {
             Class cl = MethodHandles.publicLookup().lookupClass();
             System.out.println(cl);
             System.out.println(cl.getClassLoader());
         }
      }

      Running the above class with jake and jdk9 produces result as follows:

      $ /cygdrive/d/src/jake/build/windows-x86_64-normal-server-release/images/jdk/bin/java PublicLookupClass
      class Unnamed
      java.lang.invoke.MethodHandles$LookupHelper$1@721e0f4f

      $ /cygdrive/d/src/jdk9-dev/build/windows-x86_64-normal-server-release/images/jdk/bin/java PublicLookupClass
      class java.lang.Object
      null


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                sundar Sundararajan Athijegannathan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: