summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-08-23 08:47:59 +0000
committeracolyer <acolyer>2005-08-23 08:47:59 +0000
commit58567c7b2c849f4d35f49e117ab8531527b63f7a (patch)
tree3f92072370f6bd17af69b5e74dafd6f5f03c0bc1
parent2ac1f6da9d3308e07f45e33761d76d1e370ccbf5 (diff)
downloadaspectj-58567c7b2c849f4d35f49e117ab8531527b63f7a.tar.gz
aspectj-58567c7b2c849f4d35f49e117ab8531527b63f7a.zip
support for anonymous local type registration
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java16
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java4
2 files changed, 18 insertions, 2 deletions
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 5999b17b9..4bd5cd7be 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
@@ -41,6 +41,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ITypeRequestor;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
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.PackageBinding;
@@ -73,7 +74,7 @@ import org.aspectj.weaver.patterns.DeclareParents;
*
* @author Jim Hugunin
*/
-public class AjLookupEnvironment extends LookupEnvironment {
+public class AjLookupEnvironment extends LookupEnvironment implements AnonymousClassCreationListener {
public EclipseFactory factory = null;
// private boolean builtInterTypesAndPerClauses = false;
@@ -116,6 +117,10 @@ public class AjLookupEnvironment extends LookupEnvironment {
}
}
+ // We won't find out about anonymous types until later though, so register to be
+ // told about them when they turn up.
+ AnonymousClassPublisher.aspectOf().setAnonymousClassCreationListener(this);
+
// need to build inter-type declarations for all AspectDeclarations at this point
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
SourceTypeBinding[] b = units[i].scope.topLevelTypes;
@@ -775,6 +780,15 @@ public class AjLookupEnvironment extends LookupEnvironment {
}
}
}
+
+ /**
+ * Callback driven when the compiler detects an anonymous type during block resolution.
+ * We need to add it to the weaver so that we don't trip up later.
+ * @param aBinding
+ */
+ public void anonymousTypeBindingCreated(LocalTypeBinding aBinding) {
+ factory.addSourceTypeBinding(aBinding);
+ }
}
// commented out, supplied as info on how to manipulate annotations in an eclipse world
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
index 88c62634b..1e0fd4372 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
@@ -713,7 +713,9 @@ public class EclipseFactory {
UnresolvedType simpleTx = null;
if (binding.isGenericType()) {
simpleTx = UnresolvedType.forRawTypeName(getName(binding));
- } else {
+ } else if (binding.isLocalType()) {
+ simpleTx = UnresolvedType.forSignature(new String(binding.signature()));
+ }else {
simpleTx = UnresolvedType.forName(getName(binding));
}
ReferenceType name = getWorld().lookupOrCreateName(simpleTx);