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

[nestmates] IllegalAccessError using a protected method reference declared in super class in different package

    Details

      Description

      In the valhalla nestmates branch, lambda metafactory is updated not to use
      `Unsafe::defineAnonymousClass` and replaced with `Lookup::defineClass`.
      The lambda proxy class is a nestmate of the target class and it
      follows the proper access control checks.

      javac needs to desugar a wrapper method for a method reference to a protected method declared in a super class.

      Attached test.zip reproduces the error when running with the binary built from valhalla nestmates branch.
      $ javac p/*.java q/*.java
      $ java p.Main

      Exception in thread "main" java.lang.IllegalAccessError: class p.Main$$Lambda$1$$/0x0000000800b76a70 tried to access protected method 'java.lang.String q.I.readFile(java.nio.file.Path)' (p.Main$$Lambda$1$$/0x0000000800b76a70 and q.I are in unnamed module of loader 'app')
      at q.J.checkFile(J.java:14)
      at q.J.check(J.java:18)
      at p.Main.test(Main.java:31)
      at p.Main.main(Main.java:13)

      test/langtools/jdk/javadoc/doclet/testSingletonLists/TestSingletonLists.java also fails because of this issue.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sadayapalam Srikanth Adayapalam
                Reporter:
                mchung Mandy Chung
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: