]> source.dussan.org Git - aspectj.git/commitdiff
1) cope with the new MissingTypeBinding (so set parent to Object rather than proceedi...
authoraclement <aclement>
Sat, 10 Dec 2011 00:54:43 +0000 (00:54 +0000)
committeraclement <aclement>
Sat, 10 Dec 2011 00:54:43 +0000 (00:54 +0000)
2) use raw form of binding for new parents otherwise the methodverifier15 triggers about a problem (previously methodverifier was used on <1.5 projects but not with e37)

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java

index 2d17cfb65fe7cd67c740becfd4b6feb49143a095..2c5e06f020e1f5c2cf4441e59bbd52f56d5ded98 100644 (file)
@@ -49,6 +49,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MissingTypeBinding;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
@@ -165,6 +166,11 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
                        SourceTypeBinding[] b = units[i].scope.topLevelTypes;
                        for (int j = 0; j < b.length; j++) {
                                factory.addSourceTypeBinding(b[j], units[i]);
+                               if (b[j].superclass instanceof MissingTypeBinding) {
+                                       // e37: Undoing the work in ClassScope.connectSuperClass() as it will lead to cascade errors
+                                       // TODO allow MissingTypeBinding through here and cope with it in all situations later?
+                                       b[j].superclass = units[i].scope.getJavaLangObject();
+                               }
                        }
                }
 
@@ -877,7 +883,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
                ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_PARENTS,
                                sourceType.sourceName);
                ResolvedType resolvedSourceType = factory.fromEclipse(sourceType);
-               List newParents = declareParents.findMatchingNewParents(resolvedSourceType, false);
+               List<ResolvedType> newParents = declareParents.findMatchingNewParents(resolvedSourceType, false);
                if (!newParents.isEmpty()) {
                        for (Iterator i = newParents.iterator(); i.hasNext();) {
                                ResolvedType parent = (ResolvedType) i.next();
@@ -1315,6 +1321,12 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
                if (parentBinding == null) {
                        return; // The parent is missing, it will be reported elsewhere.
                }
+               // Due to e37 switching to MethodVerifier15 for everything, it is important added types are correctly
+               // raw or not.  For example, if Comparable is used in generic form compareTo(T) will be used to check
+               // methods against in the verifier rather than compareTo(Object)
+               if (!factory.getWorld().isInJava5Mode()) {
+                       parentBinding = (ReferenceBinding)convertToRawType(parentBinding, false /*do not force conversion of enclosing types*/);
+               }
                sourceType.rememberTypeHierarchy();
                if (parentBinding.isClass()) {
                        sourceType.superclass = parentBinding;