Closed GoogleCodeExporter closed 8 years ago
quibble: I don't think it should introduce bugs since it should fail to
compile. It
fails to compile, right?
Note: we hate this too, so the new APIs for ImmutableList etc. use different
method
names (of/copyOf). Also we're removing the varargs overloads for all the
collection
factory methods except newArrayList() and newHashSet() and if we were smart we'd
probably remove them all.
Original comment by kevin...@gmail.com
on 5 Jan 2009 at 4:34
The code attached compiles in eclipse, but the test fails.
(The tree iterator (walk) would imho also be a nice addition to the library)
Original comment by jvdne...@gmail.com
on 6 Jan 2009 at 12:27
Attachments:
In this code, you're using raw types and suppressing warnings. I don't claim
anything
will work right if you do this. Please provide an example that is warning-free
if one
exists, and please don't make me hunt down a third-party library to compile it.
Thanks.
Original comment by kevin...@gmail.com
on 6 Jan 2009 at 4:56
Sorry. You're right.
Attached is an example that illustrates the problem properly (although I get
the
feeling we're already spending more time on it than it's worth).
I'm using Lists.newArrayList, because Lists.newLinkedList appears to be safe.
(sorry about that as well,
http://mvnrepository.com/artifact/com.google.collections/google-collections/0.8
is
unexpectedly not the same as google-collect-snapshot-20080820.zip from this
project
site)
I'm merely trying to say that I didn't get any warnings or errors with this
code.
Original comment by jvdne...@gmail.com
on 6 Jan 2009 at 5:59
Attachments:
thank you, this example is much better. Clearly, a class Foo that implements
Iterable<Foo> is going to cause problems for these methods.
I'm reopening this issue to consider removing the varargs newArrayList and
newHashSet
methods. They really are not that useful. However, we may also just choose to
put a
small warning about this situation in their javadoc. I lean toward the former.
Original comment by kevin...@gmail.com
on 6 Jan 2009 at 6:09
Original comment by kevin...@gmail.com
on 17 Mar 2009 at 6:37
Original comment by kevin...@gmail.com
on 17 Sep 2009 at 5:59
This issue has been moved to the Guava project (keeping the same id number).
Simply replace 'google-collections' with 'guava-libraries' in your address
bar and it should take you there.
Original comment by kevinb@google.com
on 5 Jan 2010 at 11:09
Original issue reported on code.google.com by
jvdne...@gmail.com
on 5 Jan 2009 at 4:20