RFR: 8057543: Replace javac's Filter with Predicate (and lambdas) [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu Apr 22 13:26:25 UTC 2021


On Wed, 21 Apr 2021 15:29:44 GMT, Guoxiong Li <gli at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 94:
>> 
>>> 92:     final Symtab syms;
>>> 93:     final JavacMessages messages;
>>> 94:     private Names names;
>> 
>> where is this change coming from?
>
> When building the JDK, I got the following error:
> 
> 
> jdk/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java:950: error: variable names might not have been initialized
>                     t.name != names.init &&
>                               ^
> 1 error
> 
> 
> Therefore I revised the modifier of the `Names names`.

I see - honestly this seems like a bug in definite assignment? E.g. surely the instance field initializer for `bridgeFilter` must run _after_ the `final` field `names` has been initialized? For now you might try using an anonymous inner class instead of a lambda instead, pretty sure that will take care of the issue. But this looks like a compiler bug.

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

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


More information about the compiler-dev mailing list