RFR: 8343540: Report preview error for inherited effectively-preview methods [v2]
Jan Lahoda
jlahoda at openjdk.org
Wed Dec 4 08:59:44 UTC 2024
On Fri, 15 Nov 2024 16:00:06 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Adding tests.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 3852:
>
>> 3850: } else {
>> 3851: sIsPreview = false;
>> 3852: previewSymbol = null;
>
> nit: this assignment seems to be unnecessary
I am afraid both these assignments are needed here, otherwise the variables would not be definitely assigned at their use site as per JLS. It is true there's no code path where `previewSymbol` would be used when `sIsPreview` is `false`, so the value is unused in reality, but the definite assignment is not tracking that, to my knowledge. I.e. the assignment is needed here, so that the code compiles.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21953#discussion_r1868997784
More information about the compiler-dev
mailing list