RFR: 8266027: The diamond finder does not find diamond candidates in field initializers

Vicente Romero vromero at openjdk.java.net
Tue Apr 27 21:31:09 UTC 2021


On Tue, 27 Apr 2021 19:49:08 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java line 801:
>> 
>>> 799:                 //would be reported, causing the whole rewrite to fail. Removing the non-final
>>> 800:                 //modifiers from the variable here:
>>> 801:                 ((JCVariableDecl) result).mods.flags &= Flags.FINAL;
>> 
>> just curious: why preserving the FINAL flag anyway?
>
> No particular strong reason, just keeping what we can keep. We can clear the flags to `0`, if you prefer. I don't think that should cause issues (with the current set of Analyzers).

I'm fine with either approach was just curious, do as you consider best

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

PR: https://git.openjdk.java.net/jdk/pull/3713


More information about the compiler-dev mailing list