RFR: JDK-8236692: static final fields without initializer are accepted by javac

Vicente Romero vicente.romero at oracle.com
Wed Jan 8 03:39:05 UTC 2020


Hi,

I have updated the patch after an offline review with Maurizio, 
basically I have rewritten how Flow deals with the compact constructor 
to isolate it as a special case. The new iteration is at [1]. I have 
basically restored the original code for method checkInit and added a 
special case for the compact constructor.

Thanks,
Vicente

[1] http://cr.openjdk.java.net/~vromero/8236692/webrev.01/

On 1/7/20 3:18 PM, Vicente Romero wrote:
> Please review the fix for [1] at [2], javac was failing to issue an 
> error for code like:
>
> record R() {
>     public static final int X;
> }
>
> even though `X` was not initialized as the automatic code to generate 
> initializer expressions only apply to the fields generated from the 
> record component. The patch updates the code in Flow that analyzes 
> compact constructors to don't bail out if the variable being analyzed 
> is static.
>
> Thanks,
> Vicente
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8236692
> [2] http://cr.openjdk.java.net/~vromero/8236692/webrev.00/



More information about the compiler-dev mailing list