]> source.dussan.org Git - aspectj.git/commitdiff
better handling of binary only types in the eclipse pass
authorjhugunin <jhugunin>
Wed, 15 Jan 2003 02:04:20 +0000 (02:04 +0000)
committerjhugunin <jhugunin>
Wed, 15 Jan 2003 02:04:20 +0000 (02:04 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseBinaryType.java [new file with mode: 0644]
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseObjectType.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java [new file with mode: 0644]
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
weaver/src/org/aspectj/weaver/ResolvedTypeX.java
weaver/testdata/dummyAspect.jar
weaver/testdata/megatrace.jar
weaver/testdata/megatraceNoweave.jar
weaver/testdata/tracing.jar

index c6a4a3b5805a0e3548ac6145ef158cb5f7168ac8..c85ba83554b0d7d18f1c00c3659e3e2fddb97212 100644 (file)
 
 package org.aspectj.ajdt.internal.compiler.ast;
 
-import java.io.*;
-import java.lang.reflect.Modifier;
+import java.lang.reflect.*;
 
-import org.apache.bcel.classfile.AccessFlags;
 import org.aspectj.ajdt.internal.compiler.lookup.*;
-import org.aspectj.ajdt.internal.compiler.lookup.EclipseWorld;
 import org.aspectj.weaver.*;
-import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.patterns.*;
 import org.eclipse.jdt.internal.compiler.*;
 import org.eclipse.jdt.internal.compiler.ast.*;
 import org.eclipse.jdt.internal.compiler.codegen.*;
-import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
 import org.eclipse.jdt.internal.compiler.lookup.*;
-import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
 
 
 // making all aspects member types avoids a nasty hierarchy pain
@@ -42,7 +36,7 @@ public class AspectDeclaration extends MemberTypeDeclaration {
        
        public boolean isPrivileged;
        
-       public EclipseObjectType typeX;
+       public EclipseSourceType typeX;
        public EclipseWorld world;  //??? should use this consistently
 
 
@@ -630,7 +624,7 @@ public class AspectDeclaration extends MemberTypeDeclaration {
                if (ignoreFurtherInvestigation) return;
                
                world = EclipseWorld.fromScopeLookupEnvironment(scope);
-               typeX = (EclipseObjectType)world.fromEclipse(binding);
+               typeX = (EclipseSourceType)world.fromEclipse(binding);
                
                if (isPrivileged) {
                        binding.privilegedHandler = new PrivilegedHandler(this);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseBinaryType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseBinaryType.java
new file mode 100644 (file)
index 0000000..4fb4f54
--- /dev/null
@@ -0,0 +1,106 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Common Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/cpl-v10.html 
+ *  
+ * Contributors: 
+ *     PARC     initial implementation 
+ * ******************************************************************/
+
+
+package org.aspectj.ajdt.internal.compiler.lookup;
+
+import java.util.*;
+
+import org.aspectj.ajdt.internal.compiler.ast.*;
+import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration;
+import org.aspectj.bridge.*;
+import org.aspectj.bridge.MessageUtil;
+import org.aspectj.weaver.*;
+import org.aspectj.weaver.patterns.*;
+import org.eclipse.jdt.internal.compiler.ast.*;
+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class EclipseBinaryType extends EclipseObjectType {
+       private BinaryTypeBinding binding;
+       private ResolvedTypeX delegate;
+
+       public EclipseBinaryType(ResolvedTypeX delegate, EclipseWorld world, BinaryTypeBinding binding) {
+               super(delegate.getSignature(), world, delegate.isExposedToWeaver());
+               this.delegate = delegate;
+               this.binding = binding;
+       }
+       
+
+       protected void fillDeclaredMembers() {
+               this.declaredPointcuts = copyResolvedPointcutDefinitions(delegate.getDeclaredPointcuts());
+               this.declaredFields = copyResolvedMembers(delegate.getDeclaredFields());
+               this.declaredMethods = copyResolvedMembers(delegate.getDeclaredMethods());
+       }
+
+       //XXX doesn't actually copy
+       private ResolvedPointcutDefinition[] copyResolvedPointcutDefinitions(ResolvedMember[] in) {
+               //System.err.println("defs: " + this + " are " + Arrays.asList(in));
+               return (ResolvedPointcutDefinition[])in;
+       }
+
+
+
+       private ResolvedMember[] copyResolvedMembers(ResolvedMember[] in) {
+               int len = in.length;
+               ResolvedMember[] out = new ResolvedMember[len];
+               for (int i=0; i < len; i++) {
+                       out[i] = copyResolvedMember(in[i]);
+               }
+               
+               return out;
+       }
+
+       private ResolvedMember copyResolvedMember(ResolvedMember in) {
+               return new ResolvedMember(
+                       in.getKind(), forceTypeX(in.getDeclaringType()), in.getModifiers(),
+                       forceTypeX(in.getReturnType()), in.getName(),
+                       forceTypeXs(in.getParameterTypes()));
+       }
+
+       private TypeX forceTypeX(TypeX typeX) {
+               return TypeX.forSignature(typeX.getSignature());
+       }
+
+       private TypeX[] forceTypeXs(TypeX[] in) {
+               int len = in.length;
+               if (len == 0) return TypeX.NONE;
+               TypeX[] ret = new TypeX[len];
+               for (int i=0; i < len; i++) {
+                       ret[i] = forceTypeX(in[i]);
+               }
+               return ret;
+       }
+
+
+       public ResolvedTypeX[] getDeclaredInterfaces() {
+               return world.resolve(delegate.getDeclaredInterfaces());
+       }
+
+       public int getModifiers() {
+               return delegate.getModifiers();
+       }
+
+       public ResolvedTypeX getSuperclass() {
+               if (delegate.getSuperclass() == null) return null;
+               return world.resolve(delegate.getSuperclass());
+       }
+
+       public boolean isAspect() {
+               return delegate.isAspect();
+       }
+       
+       public String toString() {
+               return "EclipseBinaryType(" + getClassName() + ")";
+       }
+
+}
index 2429196d7ff58818402afe0b7b28a39aeb1bce11..9477a72682ff7eb4a3c7af12f48e8caeff408b95 100644 (file)
@@ -24,40 +24,26 @@ import org.eclipse.jdt.internal.compiler.ast.*;
 import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
 import org.eclipse.jdt.internal.compiler.lookup.*;
 
-public class EclipseObjectType extends ResolvedTypeX.Name {
-       private ReferenceBinding binding;
-
-       private ResolvedMember[] declaredPointcuts = null;
-       private ResolvedMember[] declaredMethods = null;
-       private ResolvedMember[] declaredFields = null;
+public abstract class EclipseObjectType extends ResolvedTypeX.Name {
+       protected ResolvedPointcutDefinition[] declaredPointcuts = null;
+       protected ResolvedMember[] declaredMethods = null;
+       protected ResolvedMember[] declaredFields = null;
        
 
-       public EclipseObjectType(String signature, EclipseWorld world, ReferenceBinding binding) {
-               super(signature, world, !(binding instanceof BinaryTypeBinding));  //XXX
-               this.binding = binding;
+       public EclipseObjectType(String signature, EclipseWorld world, boolean isExposedToWeaver) {
+               super(signature, world, isExposedToWeaver);
        }
        
-       private EclipseWorld eclipseWorld() {
+       protected EclipseWorld eclipseWorld() {
                return (EclipseWorld)world;
        }
 
 
-       public boolean isAspect() {
-               if (binding instanceof BinaryTypeBinding) return false;
-               if (!(binding instanceof SourceTypeBinding)) return false;
-               //XXX assume SourceBinding throughout
-               return ((SourceTypeBinding)binding).scope.referenceContext instanceof AspectDeclaration;
-
-       }
+       public abstract boolean isAspect();
        
-       public ResolvedTypeX getSuperclass() {
-               //XXX what about java.lang.Object
-               return eclipseWorld().fromEclipse(binding.superclass());
-       }
+       public abstract ResolvedTypeX getSuperclass();
        
-       public ResolvedTypeX[] getDeclaredInterfaces() {
-               return eclipseWorld().fromEclipse(binding.superInterfaces());
-       }
+       public abstract ResolvedTypeX[] getDeclaredInterfaces();
 
        public ResolvedMember[] getDeclaredFields() {
                if (declaredFields == null) fillDeclaredMembers();
@@ -74,104 +60,14 @@ public class EclipseObjectType extends ResolvedTypeX.Name {
                return declaredPointcuts;
        }
 
-       private void fillDeclaredMembers() {
-               List declaredPointcuts = new ArrayList();
-               List declaredMethods = new ArrayList();
-               List declaredFields = new ArrayList();
-               
-               MethodBinding[] methods = binding.methods();
-               for (int i=0, len=methods.length; i < len; i++) {
-                       MethodBinding m = methods[i];
-                       AbstractMethodDeclaration amd = m.sourceMethod();
-                       if (amd == null) continue; //???
-                       if (amd instanceof PointcutDeclaration) {
-                               PointcutDeclaration d = (PointcutDeclaration)amd;
-                               ResolvedPointcutDefinition df = d.makeResolvedPointcutDefinition();
-                               declaredPointcuts.add(df);
-                       } else {
-                               //XXX this doesn't handle advice quite right
-                               declaredMethods.add(eclipseWorld().makeResolvedMember(m));
-                       }
-               }
-               
-               FieldBinding[] fields = binding.fields();
-               for (int i=0, len=fields.length; i < len; i++) {
-                       FieldBinding f = fields[i];
-                       declaredFields.add(eclipseWorld().makeResolvedMember(f));
-               }
-                       
-               this.declaredPointcuts = (ResolvedMember[])
-                       declaredPointcuts.toArray(new ResolvedMember[declaredPointcuts.size()]);
-               this.declaredMethods = (ResolvedMember[])
-                       declaredMethods.toArray(new ResolvedMember[declaredMethods.size()]);
-               this.declaredFields = (ResolvedMember[])
-                       declaredFields.toArray(new ResolvedMember[declaredFields.size()]);
-       }
+       protected abstract void fillDeclaredMembers();
 
        
-       public int getModifiers() {
-               // only return the real Java modifiers, not the extra eclipse ones
-               return binding.modifiers & CompilerModifiers.AccJustFlag;
-       }
-       
-       ReferenceBinding getBinding() {
-               return binding;
-       }
+       public abstract int getModifiers();
        
-       public String toString() {
-               return "EclipseObjectType(" + getClassName() + ")";
-       }
+
        public CrosscuttingMembers collectCrosscuttingMembers() {
                return crosscuttingMembers;
        }
 
-
-       //XXX make sure this is applied to classes and interfaces
-       public void checkPointcutDeclarations() {
-               ResolvedMember[] pointcuts = getDeclaredPointcuts();
-               boolean sawError = false;
-               for (int i=0, len=pointcuts.length; i < len; i++) {
-                       if (pointcuts[i].isAbstract()) {
-                               if (!this.isAspect()) {
-                                       eclipseWorld().showMessage(IMessage.ERROR,
-                                               "abstract pointcut only allowed in aspect" + pointcuts[i].getName(),
-                                               pointcuts[i].getSourceLocation(), null);
-                                       sawError = true;
-                               } else if (!this.isAbstract()) {
-                                       eclipseWorld().showMessage(IMessage.ERROR,
-                                               "abstract pointcut in concrete aspect" + pointcuts[i],
-                                               pointcuts[i].getSourceLocation(), null);
-                                       sawError = true;
-                               }
-                       }
-                               
-                       for (int j=i+1; j < len; j++) {
-                               if (pointcuts[i].getName().equals(pointcuts[j].getName())) {
-                                       eclipseWorld().showMessage(IMessage.ERROR,
-                                               "duplicate pointcut name: " + pointcuts[j].getName(),
-                                               pointcuts[i].getSourceLocation(), pointcuts[j].getSourceLocation());
-                                       sawError = true;
-                               }
-                       }
-               }
-               
-               //now check all inherited pointcuts to be sure that they're handled reasonably
-               if (sawError || !isAspect()) return;
-               
-
-               
-               // find all pointcuts that override ones from super and check override is legal
-               //    i.e. same signatures and greater or equal visibility
-               // find all inherited abstract pointcuts and make sure they're concretized if I'm concrete
-               // find all inherited pointcuts and make sure they don't conflict
-               getExposedPointcuts();
-
-       }
-
-       public ISourceLocation getSourceLocation() {
-               if (!(binding instanceof SourceTypeBinding) || (binding instanceof BinaryTypeBinding)) return null;
-               SourceTypeBinding sourceType = (SourceTypeBinding)binding;
-               TypeDeclaration dec = sourceType.scope.referenceContext;
-               return new EclipseSourceLocation(dec.compilationResult, dec.sourceStart, dec.sourceEnd);
-       }
 }
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
new file mode 100644 (file)
index 0000000..5e17f93
--- /dev/null
@@ -0,0 +1,144 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Common Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/cpl-v10.html 
+ *  
+ * Contributors: 
+ *     PARC     initial implementation 
+ * ******************************************************************/
+
+
+package org.aspectj.ajdt.internal.compiler.lookup;
+
+import java.util.*;
+
+import org.aspectj.ajdt.internal.compiler.ast.*;
+import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration;
+import org.aspectj.bridge.*;
+import org.aspectj.bridge.MessageUtil;
+import org.aspectj.weaver.*;
+import org.eclipse.jdt.internal.compiler.ast.*;
+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+public class EclipseSourceType extends EclipseObjectType {
+       private SourceTypeBinding binding;
+       
+
+       public EclipseSourceType(String signature, EclipseWorld world, SourceTypeBinding binding) {
+               super(signature, world, true);
+               this.binding = binding;
+       }
+
+
+       public boolean isAspect() {
+               return binding.scope.referenceContext instanceof AspectDeclaration;
+
+       }
+       
+       public ResolvedTypeX getSuperclass() {
+               if (binding.isInterface()) return world.resolve(TypeX.OBJECT);
+               //XXX what about java.lang.Object
+               return eclipseWorld().fromEclipse(binding.superclass());
+       }
+       
+       public ResolvedTypeX[] getDeclaredInterfaces() {
+               return eclipseWorld().fromEclipse(binding.superInterfaces());
+       }
+
+
+       protected void fillDeclaredMembers() {
+               List declaredPointcuts = new ArrayList();
+               List declaredMethods = new ArrayList();
+               List declaredFields = new ArrayList();
+               
+               MethodBinding[] methods = binding.methods();
+               for (int i=0, len=methods.length; i < len; i++) {
+                       MethodBinding m = methods[i];
+                       AbstractMethodDeclaration amd = m.sourceMethod();
+                       if (amd == null) continue; //???
+                       if (amd instanceof PointcutDeclaration) {
+                               PointcutDeclaration d = (PointcutDeclaration)amd;
+                               ResolvedPointcutDefinition df = d.makeResolvedPointcutDefinition();
+                               declaredPointcuts.add(df);
+                       } else {
+                               //XXX this doesn't handle advice quite right
+                               declaredMethods.add(eclipseWorld().makeResolvedMember(m));
+                       }
+               }
+               
+               FieldBinding[] fields = binding.fields();
+               for (int i=0, len=fields.length; i < len; i++) {
+                       FieldBinding f = fields[i];
+                       declaredFields.add(eclipseWorld().makeResolvedMember(f));
+               }
+                       
+               this.declaredPointcuts = (ResolvedPointcutDefinition[])
+                       declaredPointcuts.toArray(new ResolvedPointcutDefinition[declaredPointcuts.size()]);
+               this.declaredMethods = (ResolvedMember[])
+                       declaredMethods.toArray(new ResolvedMember[declaredMethods.size()]);
+               this.declaredFields = (ResolvedMember[])
+                       declaredFields.toArray(new ResolvedMember[declaredFields.size()]);
+       }
+
+       
+       public int getModifiers() {
+               // only return the real Java modifiers, not the extra eclipse ones
+               return binding.modifiers & CompilerModifiers.AccJustFlag;
+       }
+       
+       public String toString() {
+               return "EclipseSourceType(" + getClassName() + ")";
+       }
+
+
+       //XXX make sure this is applied to classes and interfaces
+       public void checkPointcutDeclarations() {
+               ResolvedMember[] pointcuts = getDeclaredPointcuts();
+               boolean sawError = false;
+               for (int i=0, len=pointcuts.length; i < len; i++) {
+                       if (pointcuts[i].isAbstract()) {
+                               if (!this.isAspect()) {
+                                       eclipseWorld().showMessage(IMessage.ERROR,
+                                               "abstract pointcut only allowed in aspect" + pointcuts[i].getName(),
+                                               pointcuts[i].getSourceLocation(), null);
+                                       sawError = true;
+                               } else if (!this.isAbstract()) {
+                                       eclipseWorld().showMessage(IMessage.ERROR,
+                                               "abstract pointcut in concrete aspect" + pointcuts[i],
+                                               pointcuts[i].getSourceLocation(), null);
+                                       sawError = true;
+                               }
+                       }
+                               
+                       for (int j=i+1; j < len; j++) {
+                               if (pointcuts[i].getName().equals(pointcuts[j].getName())) {
+                                       eclipseWorld().showMessage(IMessage.ERROR,
+                                               "duplicate pointcut name: " + pointcuts[j].getName(),
+                                               pointcuts[i].getSourceLocation(), pointcuts[j].getSourceLocation());
+                                       sawError = true;
+                               }
+                       }
+               }
+               
+               //now check all inherited pointcuts to be sure that they're handled reasonably
+               if (sawError || !isAspect()) return;
+               
+
+               
+               // find all pointcuts that override ones from super and check override is legal
+               //    i.e. same signatures and greater or equal visibility
+               // find all inherited abstract pointcuts and make sure they're concretized if I'm concrete
+               // find all inherited pointcuts and make sure they don't conflict
+               getExposedPointcuts();
+
+       }
+
+       public ISourceLocation getSourceLocation() {
+               TypeDeclaration dec = binding.scope.referenceContext;
+               return new EclipseSourceLocation(dec.compilationResult, dec.sourceStart, dec.sourceEnd);
+       }
+}
index 5edcf828a8a3ee7320f020e5f4775474fdd29db4..1815a4e7a181a74cfb2dee6e11ef5177dcda2766 100644 (file)
@@ -27,13 +27,23 @@ import org.eclipse.jdt.internal.compiler.impl.Constant;
 import org.eclipse.jdt.internal.compiler.lookup.*;
 import org.eclipse.jdt.internal.compiler.util.CharOperation;
 
+/**
+ * This holds unique ResolvedTypeXs for each type known to the compiler
+ * or looked up on the class path.  For types which are compiled from 
+ * source code, it will hold an EclipseObjectType.  Types that 
+ * come from bytecode will be delegated to buildManager.bcelWorld.
+ * 
+ * @author Jim Hugunin
+ */
 public class EclipseWorld extends World {
        public static boolean DEBUG = false;
        
        public AjBuildManager buildManager;
        private LookupEnvironment lookupEnvironment;
        
-       private Map addedTypeBindings = new HashMap();
+       private Map/*TypeX, TypeBinding*/ typexToBinding = new HashMap();
+       //XXX currently unused
+       private Map/*TypeBinding, ResolvedTypeX*/ bindingToResolvedTypeX = new HashMap();
        
        public static EclipseWorld forLookupEnvironment(LookupEnvironment env) {
                AjLookupEnvironment aenv = (AjLookupEnvironment)env;
@@ -55,7 +65,6 @@ public class EclipseWorld extends World {
        Pointcut pointcut,
         Member signature)
     {
-       //System.err.println("concrete advice: " + signature + " context " + sourceContext);
         return new EclipseAdvice(attribute, pointcut, signature);
     }
 
@@ -63,26 +72,40 @@ public class EclipseWorld extends World {
                ResolvedTypeMunger munger, ResolvedTypeX aspectType)
        {
                return null;
-               //throw new RuntimeException("unimplemented");
        }
 
-       protected ResolvedTypeX resolveObjectType(TypeX ty) {
-               String n = ty.getName();
-               //n = n.replace('$', '.');
-               char[][] name = CharOperation.splitOn('.', n.toCharArray()); //ty.getName().toCharArray());
-               ReferenceBinding ret = lookupEnvironment.getType(name);
-               //System.out.println("name: " + ty.getName() + ", " + ret);
-               if (ret == null || ret instanceof ProblemReferenceBinding) return ResolvedTypeX.MISSING;
-               return new EclipseObjectType(ty.getSignature(), this, ret);
+       protected ResolvedTypeX resolveObjectType(TypeX typeX) {
+               TypeBinding binding = makeTypeBinding(typeX);
+               
+//             System.err.println("resolvedObjectType: " + typeX + 
+//                                             " found " + 
+//                                             (binding == null ? "null" : binding.getClass().getName()));
+               
+               if (!(binding instanceof SourceTypeBinding)) {
+                       //System.err.println("missing: " + binding);
+                       return ResolvedTypeX.MISSING;
+               }
+               
+               if (binding instanceof BinaryTypeBinding) {
+                       //System.err.println("binary: " + typeX);
+                       return new EclipseBinaryType(
+                                       buildManager.bcelWorld.resolve(typeX), 
+                                       this,
+                                       (BinaryTypeBinding)binding);
+               }
+               
+               return new EclipseSourceType(typeX.getSignature(), this, 
+                                                       (SourceTypeBinding)binding);
        }
+                       
 
 
        public ResolvedTypeX fromEclipse(ReferenceBinding binding) {
                if (binding == null) return ResolvedTypeX.MISSING;
                //??? this seems terribly inefficient
-               //System.out.println("resolving: " + binding + ", name = " + getName(binding));
+               //System.err.println("resolving: " + binding.getClass() + ", name = " + getName(binding));
                ResolvedTypeX ret = resolve(fromBinding(binding));
-               //System.out.println("      got: " + ret);
+               //System.err.println("      got: " + ret);
                return ret;
        }       
        
@@ -113,16 +136,13 @@ public class EclipseWorld extends World {
 
        //??? going back and forth between strings and bindings is a waste of cycles
        public static TypeX fromBinding(TypeBinding binding) {
-//             if (binding instanceof ReferenceBinding) {
-//                     return fromEclipse( (ReferenceBinding)binding);
-//             } else {
-
                if (binding instanceof HelperInterfaceBinding) {
-                       return ((HelperInterfaceBinding)binding).getTypeX();
+                       return ((HelperInterfaceBinding) binding).getTypeX();
+               }
+               if (binding.qualifiedSourceName() == null) {
+                       return ResolvedTypeX.MISSING;
                }
-       if (binding.qualifiedSourceName() == null) return ResolvedTypeX.MISSING;
-                       return TypeX.forName(getName(binding));
-//             }
+               return TypeX.forName(getName(binding));
        }
 
        public static TypeX[] fromBindings(TypeBinding[] bindings) {
@@ -165,10 +185,15 @@ public class EclipseWorld extends World {
        }
        
        public TypeBinding makeTypeBinding(TypeX typeX) {
-               //System.out.println("in: " + typeX.getSignature() + " have: " + addedTypeBindings);
-               TypeBinding ret = (TypeBinding)addedTypeBindings.get(typeX);
-               if (ret != null) return ret;
-               
+               TypeBinding ret = (TypeBinding)typexToBinding.get(typeX);
+               if (ret == null) {
+                       ret = makeTypeBinding1(typeX);
+                       typexToBinding.put(typeX, ret);
+               }
+               return ret;
+       }
+       
+       private TypeBinding makeTypeBinding1(TypeX typeX) {
                if (typeX.isPrimitive()) {
                        if (typeX == ResolvedTypeX.BOOLEAN) return BaseTypes.BooleanBinding;
                        if (typeX == ResolvedTypeX.BYTE) return BaseTypes.ByteBinding;
@@ -188,15 +213,14 @@ public class EclipseWorld extends World {
                        }
                        return lookupEnvironment.createArrayType(makeTypeBinding(typeX), dim);
                } else {
-                       ResolvedTypeX rt = typeX.resolve(this);
-                       //System.out.println("typex: " + typeX + ", " + rt);
-                       if (rt == ResolvedTypeX.MISSING) {
-                               throw new RuntimeException("shouldn't be missing: " + typeX);
-                       }
-                       return ((EclipseObjectType)rt).getBinding();
+                       String n = typeX.getName();
+                       char[][] name = CharOperation.splitOn('.', n.toCharArray());
+                       return lookupEnvironment.getType(name);
                }
        }
        
+       
+       
        public TypeBinding[] makeTypeBindings(TypeX[] types) {
                int len = types.length;
                TypeBinding[] ret = new TypeBinding[len];
@@ -207,7 +231,7 @@ public class EclipseWorld extends World {
                return ret;
        }
        
-       
+       // just like the code above except it returns an array of ReferenceBindings
        private ReferenceBinding[] makeReferenceBindings(TypeX[] types) {
                int len = types.length;
                ReferenceBinding[] ret = new ReferenceBinding[len];
@@ -256,22 +280,15 @@ public class EclipseWorld extends World {
 
 
        public void addTypeBinding(TypeBinding binding) {
-               addedTypeBindings.put(fromBinding(binding), binding);
+               typexToBinding.put(fromBinding(binding), binding);
        }
 
-       public Shadow makeShadow(
-               AstNode location,
-               ReferenceContext context)
-       {
+
+       public Shadow makeShadow(AstNode location, ReferenceContext context) {
                return EclipseShadow.makeShadow(this, location, context);
        }
        
-       public Shadow makeShadow(
-               ReferenceContext context)
-       {
-               return EclipseShadow.makeShadow(this, (AstNode)context, context);
+       public Shadow makeShadow(ReferenceContext context) {
+               return EclipseShadow.makeShadow(this, (AstNode) context, context);
        }
-
-
-
 }
index a55df3cd30f4810fdedfb8e7aa6c842366bf5a47..2fcbc8669a0760028dcae3f6e28ff91ee99359e1 100644 (file)
@@ -50,7 +50,7 @@ public class AjBuildManager {
        public AjBuildConfig buildConfig;
     
        private BcelWeaver bcelWeaver;
-       private BcelWorld bcelWorld;
+       public BcelWorld bcelWorld;
        
     /** temp handler for callbacks */
     private IMessageHandler currentHandler; // XXX wrong lifecyle, used for callbacks
@@ -271,6 +271,12 @@ public class AjBuildManager {
                if (buildConfig.getLintSpecFile() != null) {
                        bcelWorld.getLint().setFromProperties(buildConfig.getLintSpecFile());
                }
+               
+               //??? incremental issues
+               for (Iterator i = buildConfig.getInJars().iterator(); i.hasNext(); ) {
+                       File inJar = (File)i.next();
+                       bcelWeaver.addJarFile(inJar, buildConfig.getOutputDir());
+               }
        }
        
        //??? do this well
@@ -319,10 +325,6 @@ public class AjBuildManager {
        
        void addAspectClassFilesToWeaver() throws IOException {
                //System.out.println("added or changed: " + classFileCache.getAddedOrChanged());
-               for (Iterator i = buildConfig.getInJars().iterator(); i.hasNext(); ) {
-                       File inJar = (File)i.next();
-                       bcelWeaver.addJarFile(inJar, buildConfig.getOutputDir());
-               }
                
                for (Iterator i = classFileCache.getAddedOrChanged().iterator(); i.hasNext(); ) {
                        UnwovenClassFile classFile = (UnwovenClassFile) i.next();
index b6b0a4fe32870ffb5f3f70ab8b392efa2f417c43..e13b81bf3908d44f1031e133f6cbfa7fd99942e5 100644 (file)
@@ -1065,7 +1065,7 @@ public abstract class ResolvedTypeX extends TypeX {
                        if (inherited.isAbstract()) {
                                if (!this.isAbstract()) {
                                        getWorld().showMessage(IMessage.ERROR,
-                                               "inherited abstract pointcut " + inherited.getSignature() + 
+                                               "inherited abstract " + inherited + 
                                                " is not made concrete in " + this.getName(),
                                                inherited.getSourceLocation(), this.getSourceLocation());
                                }
@@ -1080,6 +1080,7 @@ public abstract class ResolvedTypeX extends TypeX {
                for (Iterator i = added.iterator(); i.hasNext();) {
                        ResolvedPointcutDefinition toAdd =
                                (ResolvedPointcutDefinition) i.next();
+                               //System.err.println("adding: " + toAdd);
                        for (Iterator j = acc.iterator(); j.hasNext();) {
                                ResolvedPointcutDefinition existing =
                                        (ResolvedPointcutDefinition) j.next();
index 784a3b611f19fcdcc97e313a39ebf6b39e50394b..100b7d8f187183d4b8b1f885750ed57005491ae8 100644 (file)
Binary files a/weaver/testdata/dummyAspect.jar and b/weaver/testdata/dummyAspect.jar differ
index eda290200f41cc7af67a1af558cbd2222c9f4115..927615c58c0b63683fd1b12aa2294c461ae000dc 100644 (file)
Binary files a/weaver/testdata/megatrace.jar and b/weaver/testdata/megatrace.jar differ
index fcf480940144bbe2bbc206e9252235e6649dbff6..8a62739958f60833c968af3908fdcbdf7990f1a9 100644 (file)
Binary files a/weaver/testdata/megatraceNoweave.jar and b/weaver/testdata/megatraceNoweave.jar differ
index c3f5201332c1a3bf44549313a9b764dd2b422cb5..99744a6bc99d9432ef45e864439096a6775f5d1b 100644 (file)
Binary files a/weaver/testdata/tracing.jar and b/weaver/testdata/tracing.jar differ