Fixes an NPE when we failed to resolve the implicit upper bound of an unbound type variable. Also fixes a couple of other NPE locations where we assumed that resolveType(TreeLogger, TypeBinding) was not returning null.
Review by: spoon
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2257 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jdt/TypeOracleBuilder.java b/dev/core/src/com/google/gwt/dev/jdt/TypeOracleBuilder.java
index 1873d6d..59d63c9 100644
--- a/dev/core/src/com/google/gwt/dev/jdt/TypeOracleBuilder.java
+++ b/dev/core/src/com/google/gwt/dev/jdt/TypeOracleBuilder.java
@@ -696,14 +696,15 @@
// JClassType for java.lang.Object. The reason is that the TypeOracle
// has not been constructed as yet, so we cannot simply call
// TypeOracle.getJavaLangObject().
- JClassType jupperBound = (JClassType) resolveType(logger,
+ JClassType jimplicitUpperBound = (JClassType) resolveType(logger,
tvBinding.superclass);
-
- if (Object.class.getName().equals(jupperBound.getQualifiedSourceName())) {
- return new JClassType[] {jupperBound};
- } else {
- return null;
+ if (jimplicitUpperBound != null) {
+ assert (Object.class.getName().equals(jimplicitUpperBound.getQualifiedSourceName()));
+ return new JClassType[] {jimplicitUpperBound};
}
+
+ // Failed to resolve the implicit upper bound.
+ return null;
}
List<JClassType> bounds = new ArrayList<JClassType>();
@@ -1538,8 +1539,11 @@
if (binding instanceof TypeVariableBinding) {
TypeVariableBinding tvBinding = (TypeVariableBinding) binding;
JTypeParameter typeParameter = (JTypeParameter) cacheManager.getTypeForBinding(tvBinding);
- assert (typeParameter != null);
- return typeParameter;
+ if (typeParameter != null) {
+ return typeParameter;
+ }
+
+ // Fall-through to failure
}
if (binding instanceof WildcardBinding) {
@@ -1573,7 +1577,11 @@
return null;
}
- return oracle.getWildcardType(boundType, typeBound);
+ if (boundType != null) {
+ return oracle.getWildcardType(boundType, typeBound);
+ }
+
+ // Fall-through to failure
}
// Log other cases we know about that don't make sense.