Jesse's suggestion for fixing Nullability -- check the String just for name=="Nullable", but add class==Nullable.class to catch the jarjar'd c.g.i.i.util.Nullable.
git-svn-id: https://google-guice.googlecode.com/svn/trunk@1325 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/core/src/com/google/inject/internal/Nullability.java b/core/src/com/google/inject/internal/Nullability.java
index fe72f00..2e88ec4 100644
--- a/core/src/com/google/inject/internal/Nullability.java
+++ b/core/src/com/google/inject/internal/Nullability.java
@@ -2,6 +2,8 @@
import java.lang.annotation.Annotation;
+import com.google.inject.internal.util.Nullable;
+
/**
* Whether a member supports null values injected.
*
@@ -22,9 +24,11 @@
public static boolean allowsNull(Annotation[] annotations) {
for(Annotation a : annotations) {
- String name = a.annotationType().getSimpleName();
- // Check for $Nullable also because jarjar renames it.
- if ("Nullable".equals(name) || "$Nullable".equals(name)) {
+ Class<? extends Annotation> type = a.annotationType();
+ // Check for Nullable.class because our c.g.i.internal.util.Nullable
+ // gets jarjar'd into $Nullable, and we want extensions that reference
+ // it to continue working.
+ if ("Nullable".equals(type.getSimpleName()) || type == Nullable.class) {
return true;
}
}