[lworld] RFR: 8367323: [lworld] javac is rejecting valid code after fix for JDK-8359370 [v4]
Vicente Romero
vromero at openjdk.org
Fri Sep 12 17:57:04 UTC 2025
On Fri, 12 Sep 2025 17:53:07 GMT, Vicente Romero <vromero at openjdk.org> 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
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1414:
> 1412: }
> 1413: tree = TreeInfo.skipParens(tree);
> 1414: if (sym.kind == VAR && sym.owner.kind == TYP) {
also removed a check for static symbol here, not needed now
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1567#discussion_r2345044114
More information about the valhalla-dev
mailing list