[lworld] RFR: 8367323: [lworld] javac is rejecting valid code after fix for JDK-8359370 [v3]
Vicente Romero
vromero at openjdk.org
Fri Sep 12 17:46:47 UTC 2025
On Fri, 12 Sep 2025 17:44:22 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 two additional commits since the last revision:
>
> - fixing comment
> - addressing review comments
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1405:
> 1403: }
> 1404: tree = TreeInfo.skipParens(tree);
> 1405: if (sym != null) {
I just removed this `if` as the symbol can't be null now, but it has provoked a big diff, mostly an indentation change
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1567#discussion_r2345028251
More information about the valhalla-dev
mailing list