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

public lookup fails with IllegalAccessException when used while module system is being initialized

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 23
    • 23
    • core-libs
    • None

      Consider this trivial command:

      java --add-modules=foo.bar.notpresent -version

      On mainline (and I could reproduce this only on mainline - works fine on Java 21 and 22) when that command is executed, I get:

      Error occurred during initialization of boot layer
      java.lang.ExceptionInInitializerError
      Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: symbolic reference class is not accessible: class java.lang.Class, from public Lookup

      On Java 21 and 22, I rightly get a FindException:

      Error occurred during initialization of boot layer
      java.lang.module.FindException: Module foo.bar.notpresent not found

      I'm on macos M1, if that matters.

            mchung Mandy Chung (Inactive)
            jpai Jaikiran Pai
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: