hg: jdk7/tl/jdk: 6921740: Eliminate warnings from sun.io converters and allow compiling with JAVAC_MAX_WARNINGS=true
Ulf.Zibis at gmx.de
Tue Feb 2 08:26:14 PST 2010
Am 02.02.2010 14:30, schrieb Rémi Forax:
> Le 02/02/2010 14:09, Ulf Zibis a écrit :
>> in most cases you use the empty diamond operator '<>' on
>> instantiation, but not for SoftReference: "new
>> SoftReference<Charset>(cs)" in AbstractCharsetProvider.java
> SoftReference constructor is SoftReference(T), so there is two ways to
> infer the type argument.
> With this code:
> SoftReference<Charset> ref = new SoftReference<>(cs);
> the type argument can be infered from the lhs of the assignation or
> by the declared type of the parameter (here cs).
So you agree with me, that new SoftReference<>(cs) would suffice ???
>> I don't see a big advantage for casting to (Class<?>) against (Class)
>> for the cache of Converters.java.
> Rules for Class<?> and Class are not the same.
> Class should be only used when dealing with legacy code.
One of the advantages of generics is the avoidability of casts.
So I wanted to say, if a code becomes reengineerd in generic way, then
it should be done in "full way".
P.S.: Additionally note:
More information about the compiler-dev