[lworld] RFR: 8367323: [lworld] javac is rejecting valid code after fix for JDK-8359370

Vicente Romero vromero at openjdk.org
Fri Sep 12 15:18:51 UTC 2025


Recent fix for [JDK-8359370](https://bugs.openjdk.org/browse/JDK-8359370) introduced a minor bug. This code should be accepted by javac:

class SuperClass<T> {
    public SuperClass(Object o) {}
}

class Sub<T> extends SuperClass<T> {
    public Sub() {
        super(new Object() {
            void foo() {
                getClass();
            }
        });
    }
}


but it is currently rejected as the `getClass` invocation is considered to be an invocation of an instance method of class `Sub`

-------------

Commit messages:
 - Update test/langtools/tools/javac/SuperInit/SuperInitFails.java
 - Update test/langtools/tools/javac/SuperInit/SuperInitFails.java
 - addressing review comments
 - addressing review comments
 - simplifying test
 - 8367323: [lworld] javac is rejecting valid code after fix for JDK-8359370

Changes: https://git.openjdk.org/valhalla/pull/1567/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1567&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8367323
  Stats: 29 lines in 4 files changed: 25 ins; 1 del; 3 mod
  Patch: https://git.openjdk.org/valhalla/pull/1567.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1567/head:pull/1567

PR: https://git.openjdk.org/valhalla/pull/1567


More information about the valhalla-dev mailing list