Spec draft for JEP 286 Local Variable Type Inference
forax at univ-mlv.fr
Wed Mar 29 23:58:33 UTC 2017
Looks great !
In 14.4.1, a minor remark, i had to look for what standalone expression is, not poly expression seems better for me so i suggest that
Because the initializer is a standalone expression, an error occurs if it is a lambda expression (15.27) or a method reference expression (15.13).
Because the initializer is not a poly expression, an error occurs if it is a lambda expression (15.27) or a method reference expression (15.13).
So a var initialized by an anonymous class with diamond is not supported because it's not a poly expression (but its type is denotable) and
an anonymous class with type arguments is not supported because its type is not denotable.
Given that without var, when the type of an anonymous class with a diamond is inferred, the resulting type is the super type,
i think you can relax the current rule to allow var to be initialized with an anonymous class (with no diamond), the resulting type will be the super type.
----- Mail original -----
> De: "Dan Smith" <daniel.smith at oracle.com>
> À: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Jeudi 30 Mars 2017 01:12:53
> Objet: Spec draft for JEP 286 Local Variable Type Inference
> Hello, all. Please see below for a draft spec of language changes to support
> local variable type inference ('var').
> If you haven't read it already, you'll want to look at the proposal  and
> Brian's summary of design considerations and community feedback (sent to
> platform-jep-discuss) .
> With that context, here's the spec document:
> I'll follow up with some supplementary background on design considerations,
> beyond what's covered by the platform-jep-discuss email.
> Feel free to respond with your feedback.
> : http://openjdk.java.net/jeps/286
More information about the amber-spec-experts