What I meant by "refresh the prototype" was that I'd
put it on the early access
download page.
cool
About
http://forum.java.sun.com/thread.jsp?forum=316&thread=4
9901&start=0&range=1
You can simply not enable these warnings, or compile
with -source 1.4, which
is the default. You must have gone to some trouble
(-source 1.5 -warnunchecked)
to get the compiler to tell you about these places
where you use raw types,
which are now a loophole in the type system. If you
don't want to know about
them, then don't ask the compiler to tell you about
them.
After compiling with the scripts provided with the prototype it gave me the message 'Some input files use unchecked or unsafe operations. Recompile with -warnunchecked for details', so I did, you are correct that removing the -warnunchecked does stop these silly warning messages.
I would like to know about anything that is actually unsafe (anything the compiler shouldn't allow but does allow for historical reasons), such as:
String[] strings = new String[1];
Object[] objects = strings;
objects[0] = new Object();
the assignment from strings to objects is unsafe, and yet even with the -warnunchecked it still doesn't tell me this (compiler bug?).
On the other hand I don't want it to tell me that things are unsafe even though they are type safe, for example the following should be perfectly legal:
List list = new LinkedList();
list.add(new Object());
Object object = list.get(0);
and yet it gives me warnings, even though I added an Object, it knows it is a list of objects, I want to get back an object, etc. (compiler bug?)
Will this loophole you speak of get fixed?
It seems easy to do, as all the compiler has to do is treat the above code as though List<Object> list = new LinkedList<Object>(); had been written.
It should also be the same as List<-Object> and List<=Object> except for with List<-Object> the compiler complains that reference to add is ambiguous (another compiler bug?)
Also I still don't know if
Class c = true ? Boolean.class : Object.class;
causes a compiler bug, or if not all legacy code is meant to work under the new JDK, in which case I don't understand why the prototype still allows type unsafe things such as objects = strings ?
Hopefully we will find out in 2 weeks from now.
About
http://forum.java.sun.com/thread.jsp?forum=316&thread=4
5062&start=31&range=1
I'll include the latest draft of the varargs spec in
the next prototype.
-Neal
Guess I can wait for 2 weeks to find out.
=Yoseph