Revision: 978ed86a76b3
Author: Christian Edward Gruber <cgru...@google.com>
Date: Thu May 16 07:49:41 2013
Log: Fix a == vs .equals() bug in MoreTypes.
----------------
Manually Synced.
COMMIT=44410191
http://code.google.com/p/google-guice/source/detail?r=978ed86a76b3
Modified:
/core/src/com/google/inject/internal/MoreTypes.java
/core/test/com/google/inject/internal/MoreTypesTest.java
=======================================
--- /core/src/com/google/inject/internal/MoreTypes.java Thu Jul 7 17:34:16
2011
+++ /core/src/com/google/inject/internal/MoreTypes.java Thu May 16 07:49:41
2013
@@ -228,7 +228,7 @@
}
TypeVariable<?> va = (TypeVariable) a;
TypeVariable<?> vb = (TypeVariable) b;
- return va.getGenericDeclaration() == vb.getGenericDeclaration()
+ return va.getGenericDeclaration().equals(vb.getGenericDeclaration())
&& va.getName().equals(vb.getName());
} else {
=======================================
--- /core/test/com/google/inject/internal/MoreTypesTest.java Thu Jul 7
17:34:16 2011
+++ /core/test/com/google/inject/internal/MoreTypesTest.java Thu May 16
07:49:41 2013
@@ -20,6 +20,7 @@
import junit.framework.TestCase;
+import java.lang.reflect.Type;
import java.util.Map;
import java.util.Set;
@@ -43,6 +44,11 @@
+ "java.util.Set<com.google.inject.internal.MoreTypesTest$Inner<java.lang.Long>>>",
MoreTypes.typeToString(mapInnerLongToSetInnerLong.getType()));
}
+
+ public <T> void testEquals_typeVariable() throws Exception {
+ Type type =
getClass().getMethod("testEquals_typeVariable").getTypeParameters()[0];
+ assertTrue(MoreTypes.equals(new TypeLiteral<T>() {}.getType(), type));
+ }
public static class Inner<T> {}
}
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to google-guice-dev+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice-dev@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.