Diamond and Generic Methods
Jesper Öqvist
jesper.oqvist at cs.lth.se
Thu May 5 08:06:57 PDT 2011
So, after searching the archives and scouring the JSR334 v0.875 draft, I
have a question about Diamond. While the specification draft does not
explicitly disallow it, it seems weird that this works (Java7 developer
preview b139):
class C {
<T> void identity(T a) { return a; }
void m() {
identity(new java.util.ArrayList<>());
}
}
Since there is a distinction between raw types and parameterized types
with inferred type arguments (in the discussion part of the Diamond
section in JSR334), it would be interesting to know what type is
instantiated in the above example.
/Jesper
More information about the coin-dev
mailing list