diff options
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java | 12 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseBinaryType.java | 106 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseObjectType.java | 130 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java | 144 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java | 105 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java | 12 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/ResolvedTypeX.java | 3 | ||||
-rw-r--r-- | weaver/testdata/dummyAspect.jar | bin | 589 -> 589 bytes | |||
-rw-r--r-- | weaver/testdata/megatrace.jar | bin | 4895 -> 3555 bytes | |||
-rw-r--r-- | weaver/testdata/megatraceNoweave.jar | bin | 2696 -> 2709 bytes | |||
-rw-r--r-- | weaver/testdata/tracing.jar | bin | 2268 -> 2291 bytes |
11 files changed, 336 insertions, 176 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java index c6a4a3b58..c85ba8355 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java @@ -13,21 +13,15 @@ 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 index 000000000..4fb4f54a6 --- /dev/null +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseBinaryType.java @@ -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() + ")"; + } + +} diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseObjectType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseObjectType.java index 2429196d7..9477a7268 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseObjectType.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseObjectType.java @@ -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 index 000000000..5e17f93c5 --- /dev/null +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java @@ -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); + } +} diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java index 5edcf828a..1815a4e7a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java @@ -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); } - - - } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index a55df3cd3..2fcbc8669 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -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(); diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java index b6b0a4fe3..e13b81bf3 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java +++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java @@ -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(); diff --git a/weaver/testdata/dummyAspect.jar b/weaver/testdata/dummyAspect.jar Binary files differindex 784a3b611..100b7d8f1 100644 --- a/weaver/testdata/dummyAspect.jar +++ b/weaver/testdata/dummyAspect.jar diff --git a/weaver/testdata/megatrace.jar b/weaver/testdata/megatrace.jar Binary files differindex eda290200..927615c58 100644 --- a/weaver/testdata/megatrace.jar +++ b/weaver/testdata/megatrace.jar diff --git a/weaver/testdata/megatraceNoweave.jar b/weaver/testdata/megatraceNoweave.jar Binary files differindex fcf480940..8a6273995 100644 --- a/weaver/testdata/megatraceNoweave.jar +++ b/weaver/testdata/megatraceNoweave.jar diff --git a/weaver/testdata/tracing.jar b/weaver/testdata/tracing.jar Binary files differindex c3f520133..99744a6bc 100644 --- a/weaver/testdata/tracing.jar +++ b/weaver/testdata/tracing.jar |