15.28.1 needs some polish ?
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Feb 19 02:44:11 PST 2013
On 18/02/13 19:12, Srikanth S Adayapalam wrote:
>> (2) Should the passage "Also note that static method invocations
>> have the form TypeName.method(),
>> while here we're using the more general ReferenceType; an error
>> occurs if the reference ends up being a
>> static method reference and the qualifier is a parameterized type."
>> be relegated to the motivation box ?
> This is an incorrect observation on my part - sorry. This is very much
> covered
> in the main body. I actually meant to ask if this section should expressly
>
> ban parameterized array creation and ended up asking the wrong question.
>
> The spec is silent on generic array creation and 8b74 allows:
Whoops - I believe the language should be consistent here - array
creation is not any safer if it happens through method reference, so the
code deserves an unchecked warning.
Maurizio
>
> //---
> import java.util.ArrayList;
> import java.util.List;
> interface I {
> List<String> [] doit(int x);
> }
> public class X {
> I i1 = ArrayList<String>[]::new; // Compiles OK
> I i2 = List<String>[]::new; // Compiles OK
> List<String> [] ls = new ArrayList<String>[10]; // Error.
> }
> // -------
>
> Srikanth.
More information about the lambda-spec-experts
mailing list