RFR: 8286797: Guards of constant value false are not permitted

Vicente Romero vromero at openjdk.java.net
Tue May 17 20:16:37 UTC 2022

On Tue, 17 May 2022 12:25:41 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

> Simple fix that addresses this line from the spec:
>> It is a compile-time error if a when expression is a constant expression ([15.29](https://docs.oracle.com/javase/specs/jls/se18/html/jls-15.html#jls-15.29)) with the value false.
> Extracts one small utility method `isBooleanWithValue` in `TreeInfo`.

src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties line 516:

> 514: 
> 515: compiler.err.guard.has.constant.expression.false=\
> 516:     this case label has a when constant expression that is false

`when` here should be: `''when''`


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

More information about the compiler-dev mailing list