From: aclement Date: Sat, 10 Dec 2011 00:54:43 +0000 (+0000) Subject: 1) cope with the new MissingTypeBinding (so set parent to Object rather than proceedi... X-Git-Tag: V1_7_0RC1~75 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7b18920d09044f2bbb74a2cf6da532e1d2c83284;p=aspectj.git 1) cope with the new MissingTypeBinding (so set parent to Object rather than proceeding with a missing one - the downstream infrastructure cant cope right now) 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) --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 2d17cfb65..2c5e06f02 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -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 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;