On Fri, 12 Sep 2025 17:57:02 GMT, Vicente Romero <[email protected]> wrote:
>> 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` > > Vicente Romero has updated the pull request incrementally with one additional > commit since the last revision: > > removing unnecessary check Marked as reviewed by mcimadamore (Committer). src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1481: > 1479: /* so we are inside a class, CI, in the prologue of > an outer class, CO, and the symbol being > 1480: * analyzed has no qualifier. So if the symbol is a > member of CI the reference is allowed, > 1481: * otherwise it is not. Optional -- maybe we can just add a final sentence saying that, in case reference to CI's member happens inside CI's own prologue, that will be checked separately (e.g. when visiting CI's prologue), so we don't have to report anything (yet) ? ------------- PR Review: https://git.openjdk.org/valhalla/pull/1567#pullrequestreview-3224397856 PR Review Comment: https://git.openjdk.org/valhalla/pull/1567#discussion_r2348853531
