participate


Generics - Problems with List<Object[]>
<<   Back to Forum  |   Give us Feedback
This topic has 7 replies on 1 page.
gafter
Posts:669
Registered: 6/25/98
Re: Problems with List<Object[]>   
Jul 7, 2003 2:32 PM (reply 2 of 7)  (In reply to #1 )

 
And now that Christian has sent me a patch to fix this, it will be
working properly when I refresh the prototype in a couple of weeks.
 
yoseph_phillips
Posts:60
Registered: 4/8/02
Re: Problems with List<Object[]>   
Jul 8, 2003 1:29 AM (reply 3 of 7)  (In reply to #2 )

 
And now that Christian has sent me a patch to fix
this, it will be
working properly when I refresh the prototype in a
couple of weeks.

Can I safely assume this refreshed prototype will be made available to us shortly after (in about 2 - 3 weeks time)?

Is there a list somewhere of what will be fixed in the prototype?

In particular I am still trying to find out if Sun plans do anything about either of the following?
http://forum.java.sun.com/thread.jsp?forum=316&thread=409901&start=0&range=1
http://forum.java.sun.com/thread.jsp?forum=316&thread=405062&start=31&range=1
 
gafter
Posts:669
Registered: 6/25/98
Re: Problems with List<Object[]>   
Jul 8, 2003 3:37 PM (reply 4 of 7)  (In reply to #3 )

 
What I meant by "refresh the prototype" was that I'd put it on the early access
download page.

About

http://forum.java.sun.com/thread.jsp?forum=316&thread=409901&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.

About

http://forum.java.sun.com/thread.jsp?forum=316&thread=405062&start=31&range=1

I'll include the latest draft of the varargs spec in the next prototype.

-Neal
 
gafter
Posts:669
Registered: 6/25/98
Re: Problems with List<Object[]>   
Jul 8, 2003 3:43 PM (reply 5 of 7)  (In reply to #3 )

 
Is there a list somewhere of what will be fixed in the prototype?

Not really, but the major changes will be mentioned in the change log.
 
yoseph_phillips
Posts:60
Registered: 4/8/02
Re: Problems with List<Object[]>   
Jul 9, 2003 3:01 AM (reply 6 of 7)  (In reply to #4 )

 
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
 
fredastaire
Posts:97
Registered: 1/3/00
Re: Problems with List<Object[]>   
Jul 9, 2003 7:47 AM (reply 7 of 7)  (In reply to #6 )

 
There's a list of known bugs here
http://cag.lcs.mit.edu/~cananian/Projects/GJ/
including your
Class c = x ? Boolean.class : Object.class;
example.

Some of these have Sun bug IDs attached; you can query the Sun bug system to find out if these have been fixed yet. Presumably Neal Gafter will continue to fix what he can with each release, and the list on my site will keep getting shorter and shorter.

Prototype 2.0 introduced a lot of new interoperability bugs along with the variance stuff. If you can find a copy, you might want to consider playing around with the 1.3 prototype to get a better sense for how interoperability with legacy code is "supposed" to work.

[I think you can query the Sun bug system directly for GJ-related bugs, but I'm not quite sure how that's done.]
 
This topic has 7 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 29
  • Guests : 132

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums