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

Print more information about class loaders in IllegalAccessErrors

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b20

      Backports

        Description

        Print more information about class loaders in IllegalAccessErrors
         
        Since Java 9, class loaders have a name field. Report this if set.
        Also report the parent class loader.
        It was decided to not report the parent class loader, but to add the module.
        The exceptions now use a unified reporting utility for the module/loader information.

        Changed messages:

        before:
        class test.IAE1_B cannot access its superinterface test.IAE1_A

        after:
        class test.IAE1_B cannot access its superinterface test.IAE1_A (test.IAE1_B is in unnamed module of loader test.IAE_Loader1 @<id>; test.IAE1_A is in unnamed module of loader 'app')
        or
        class test.IAE1_B cannot access its superinterface test.IAE1_A (test.IAE1_B is in unnamed module of loader 'someCLName1' @<id>; test.IAE1_A is in unnamed module of loader 'app')

        before:
        class test.IAE2_B cannot access its superclass test.IAE2_A
        or
        class test.IAE3_B cannot access its superclass test.IAE3_A

        after:
        class test.IAE2_B cannot access its abstract superclass test.IAE2_A (test.IAE2_B is in unnamed module of loader
        'someCLName2' @<id>; test.IAE2_A is in unnamed module of loader 'app')
        or
        class test.IAE3_B cannot access its superclass test.IAE3_A (test.IAE3_B is in unnamed module of loader 'someCLName3' @<id>; test.IAE3_A is in unnamed module of loader 'app')

        before:
        tried to access method test.IllegalAccessErrorTest.iae4_m()V from class test.Runner4

        after:
        class test.Runner4 tried to access private method test.IllegalAccessErrorTest.iae4_m()V (test.Runner4 and test.IllegalAccessErrorTest are in unnamed module of loader 'app')

        before:
        tried to access field test.IllegalAccessErrorTest.iae5_f from class test.Runner5

        after:
        class test.Runner5 tried to access private field test.IllegalAccessErrorTest.iae5_f (test.Runner5 and test.IllegalAccessErrorTest are in unnamed module of loader 'app')

        before:
        failed to access class test.IAE6_A from class test.IAE6_B

        after:
        failed to access class test.IAE6_A from class test.IAE6_B (test.IAE6_A is in unnamed module of loader 'app'; test.IAE6_B is in unnamed module of loader 'test6_class_CL' @<id>

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  goetz Goetz Lindenmaier
                  Reporter:
                  goetz Goetz Lindenmaier
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: