Draft JEP: Keyword Management for the Java Language

Alex Buckley alex.buckley at oracle.com
Wed May 1 20:55:53 UTC 2019


On 5/1/2019 1:21 PM, Remi Forax wrote:
> I think 'this' are also missing from {A}, Foo.this is a valid expression (while semantically invalid).

Yes, and `Foo.this-day` is close enough to `Foo::new-day` that both can 
be explained together (so we don't forget why `this` ended up in set A).

> For 'null', 'true' and 'false', there are also valid expression but invalid semantically,
> so following the same logic they should be in {A} and {B}.
>
> in that case non-null is not a valid hyphenated keyword but it's a valid hyphenated keyword if contextual (as modifier for a field or a method).

I think the JEP already takes reasonable care over `null`, `true`, and 
`false`. They're highlighted as literals rather than keywords early on, 
and `non-null` and `eventually-true` are clearly marked as examples of 
hyphenated _contextual_ keywords rather than hyphenated _classic_ 
keywords. Later, the "formal" statement involving sets A and B is 
specifically about hyphenated _classic_ keywords, so it doesn't advise 
on `non-null` at all. I could add constraints for hyphenated 
_contextual_ keywords but this JEP is a policy/approach, not a spec, so 
I'm going to stop here; this has been a productive thread.

Alex


More information about the jdk-dev mailing list