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

Improve error for illegal early access from nested class

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 24
    • tools
    • None
    • source
    • minimal
    • Language construct
    • Implementation

      Summary

      Fix for JDK-8334488 introduced a regression in JDK-24, there are several fixes, some of them currently under review, that will fix the introduced regression.

      Problem

      The fix for JDK-8334488 introduced a regression in JDK-24. Code like the following:

      class Test {
          Test() {}
      
          Test(int a) {
              new InnerLocal() {}; //compilation fails here
              this();
          }
      }

      Is now incorrectly rejected by the javac compiler.

      Solution

      Since the aforementioned fix is correct, the fix will be left in place in 24, despite the regression. We have a fix in the work that will help remove the introduced regression is [1]. This second fix represents a major change to the compiler pipeline and for this reason it was deemed too risky to be integrated into JDK 23.

      Specification

      There are no changes to the specification.

      [1] https://github.com/openjdk/jdk/pull/19836

            vromero Vicente Arturo Romero Zaldivar
            acobbs Archie Cobbs
            Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: