Array
tronicek at fel.cvut.cz
tronicek at fel.cvut.cz
Fri May 16 08:29:57 PDT 2008
Hi,
the compiler generates a warning when you call this method:
static { => String } concat({ => String }... arg) {
@Shared
String s = "";
for ({ => String } p : arg) {
s += p.invoke();
}
return { => s };
}
It is because the compiler replaces the variable-length arguments with arrays.
E.g.
{ => String } p3 = concat({ => "I" }, { => "like" }, { => "closures" });
will be transformed to:
{ => String } p3 = concat(new javax.lang.function.O[] {{ => "I"
}, { => "like" }, { => "closures" }});
And because javax.lang.function.O is a generic type, the compiler complains.
Another thing:
{ => }[] p = null;
does not compile.
Zdenek
--
Zdenek Tronicek
Department of Computer Science and Engineering
Prague tel: +420 2 2435 7410
http://cs.felk.cvut.cz/~tronicek
More information about the closures-dev
mailing list