Makes Wildcard bound calc. stable regardless of type order. Previously some callers of CompilationUnitTypeOracleUpdater.resolveClass() treated a boolean false return value as an error and some callers treated it as a warning. As a result the order of the types being processed could affect the results. By making all callers treat a false return value as a warning, consistency is restored. Change-Id: I48be4ff0d932ac6fa3bc085cf953b273710add39
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationUnitTypeOracleUpdater.java b/dev/core/src/com/google/gwt/dev/javac/CompilationUnitTypeOracleUpdater.java index f8f8e14..379997f 100644 --- a/dev/core/src/com/google/gwt/dev/javac/CompilationUnitTypeOracleUpdater.java +++ b/dev/core/src/com/google/gwt/dev/javac/CompilationUnitTypeOracleUpdater.java
@@ -837,6 +837,14 @@ return resolvedType; } + // TODO(stalcup): refactor this recursive resolveFoo() process. At the moment there is a recursive + // tree of resolveFoo() calls. Most of them return a boolean, but some do not. Some of the + // booleans are read and acted upon, some are not. Some functions do their own logging and some + // return a false to indicate that the caller should log. Sometimes the boolean return value is an + // indication of whether logging should occur and other times it's an indication of whether + // exploration should continue. It's a mess. Some ideas that would probably make this more sane: + // be consistent about SPAM logging throughout and WARN logging only at the tip, and process types + // in a queue instead of with recursion. private boolean resolveClass( TreeLogger logger, JRealClassType unresolvedType, TypeOracleBuildContext context) { assert unresolvedType != null;
diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/ResolveTypeSignature.java b/dev/core/src/com/google/gwt/dev/javac/asm/ResolveTypeSignature.java index 7a2ecbc..6aa3203 100644 --- a/dev/core/src/com/google/gwt/dev/javac/asm/ResolveTypeSignature.java +++ b/dev/core/src/com/google/gwt/dev/javac/asm/ResolveTypeSignature.java
@@ -124,18 +124,18 @@ assert Name.isInternalName(internalName); outerClass = enclosingClass; JRealClassType classType = resolver.findByInternalName(internalName); - // TODO(jat): failures here are likely binary-only annotations or local - // classes that have been elided from TypeOracle -- what should we do in - // those cases? Currently we log an error and replace them with Object, - // but we may can do something better. - boolean resolveSuccess = classType == null ? false : resolver.resolveClass( - logger, classType); - returnTypeRef[0] = classType; - if (!resolveSuccess || returnTypeRef[0] == null) { - logger.log(TreeLogger.ERROR, "Unable to resolve class " + internalName); - // Replace bound with Object if we can't resolve the class. + if (classType == null) { + logger.log(TreeLogger.ERROR, "Unable to find class " + internalName); + // Replace bound with Object if we can't find the class. returnTypeRef[0] = resolver.getTypeOracle().getJavaLangObject(); + return; } + if (!resolver.resolveClass(logger, classType)) { + // already logged why it failed. + // Ignores the return value to be consistent with the behavior of + // CompilationUnitTypeOracleUpdater. + } + returnTypeRef[0] = classType; } @Override
diff --git a/dev/core/test/com/google/gwt/dev/javac/TypeOracleUpdaterTestBase.java b/dev/core/test/com/google/gwt/dev/javac/TypeOracleUpdaterTestBase.java index b0bf52c..f22c848 100644 --- a/dev/core/test/com/google/gwt/dev/javac/TypeOracleUpdaterTestBase.java +++ b/dev/core/test/com/google/gwt/dev/javac/TypeOracleUpdaterTestBase.java
@@ -1017,9 +1017,9 @@ public void testConstrainedField() throws TypeOracleException { addTestResource(CU_Object); - addTestResource(CU_Throwable); addTestResource(CU_ConstrainedList); addTestResource(CU_ConstrainedListAsField); + addTestResource(CU_Throwable); buildTypeOracle(); // Get the types produced by the TypeOracle