limpb...@gmail.com
unread,May 26, 2008, 3:57:12 PM5/26/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-guice-dev
Hey guys --
To my great disappointment, this test fails:
assertEquals(TypeLiteral.get(String[].class), new
TypeLiteral<String[]>() {});
The cause is that there's two different ways to
represent a String[] using Java's Types API:
- as a Class instance whose isArray() returns true
- as a GenericArrayType
The two are functionally equal but aren't equal
according to their respective .equals() methods.
I suspect this problem may have caused some of
our users frustration, especially for code like this:
bind(String[].class).to(...)
To resolve this, I'm going to change TypeLiteral
to prefer GenericArrayType. If ever it's constructed
with the other form, it will substitute in the equivalent
GenericArrayType value.
The additional benefit is that the GenericArrayType
has a prettier toString() value: [LString vs. String[]
If you see any potential problems with this (or places
where similar problems exist), please let me know.
Cheers,
Jesse