Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7901068

SecurityException when trying to introspect java.lang.Class

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
      jol

      Description

      Found by Zoltan Majo:

      $ java -jar jol-cli/target/jol-internals.jar java.lang.Class
      Running 64-bit HotSpot VM.
      Using compressed references with 3-bit shift.
      Objects are 8 bytes aligned.
      Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
      Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]

      VM fails to invoke the default constructor, falling back to class-only introspection.

      java.lang.SecurityException: Cannot make java.lang.Class.classLoader accessible
              at java.lang.reflect.AccessibleObject.setAccessible0(AccessibleObject.java:147)
              at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:129)
              at org.openjdk.jol.info.FieldData.computeOffset(FieldData.java:76)
              at org.openjdk.jol.info.FieldData.parse(FieldData.java:58)
              at org.openjdk.jol.info.ClassData.parseClass(ClassData.java:87)
              at org.openjdk.jol.info.ClassLayout.parseClass(ClassLayout.java:59)
              at org.openjdk.jol.info.ClassLayout.parseClass(ClassLayout.java:48)
              at org.openjdk.jol.MainObjectInternals.main(MainObjectInternals.java:53)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shade Aleksey Shipilev
              Reporter:
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: