From c60759851b345fa8ff228a1bd626a78092caa590 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 21 Jun 2005 12:26:14 +0000 Subject: [PATCH] Some refactoring to try and come up with better type names! --- .../compiler/ast/AspectDeclaration.java | 3 +- .../compiler/lookup/AjLookupEnvironment.java | 3 +- .../compiler/lookup/EclipseFactory.java | 3 +- .../compiler/lookup/EclipseSourceType.java | 10 +- .../weaver/AbstractReferenceTypeDelegate.java | 44 +++ .../src/org/aspectj/weaver/ReferenceType.java | 197 ++++++++++++++ .../aspectj/weaver/ReferenceTypeDelegate.java | 55 ++++ .../src/org/aspectj/weaver/ResolvedTypeX.java | 254 +----------------- weaver/src/org/aspectj/weaver/TypeX.java | 2 +- weaver/src/org/aspectj/weaver/World.java | 12 +- .../aspectj/weaver/bcel/BcelObjectType.java | 6 +- .../org/aspectj/weaver/bcel/BcelWorld.java | 12 +- 12 files changed, 326 insertions(+), 275 deletions(-) create mode 100644 weaver/src/org/aspectj/weaver/AbstractReferenceTypeDelegate.java create mode 100644 weaver/src/org/aspectj/weaver/ReferenceType.java create mode 100644 weaver/src/org/aspectj/weaver/ReferenceTypeDelegate.java 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 681096b24..dce72fdc8 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 @@ -51,6 +51,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.AjcMemberMaker; import org.aspectj.weaver.NameMangler; +import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedTypeX; import org.aspectj.weaver.Shadow; @@ -82,7 +83,7 @@ public class AspectDeclaration extends TypeDeclaration { public EclipseSourceType concreteName; - public ResolvedTypeX.Name typeX; + public ReferenceType typeX; public EclipseFactory factory; //??? should use this consistently 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 9629edf4f..9578f68fc 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 @@ -51,6 +51,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter; import org.aspectj.weaver.AsmRelationshipProvider; import org.aspectj.weaver.ConcreteTypeMunger; +import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ResolvedTypeMunger; import org.aspectj.weaver.ResolvedTypeX; import org.aspectj.weaver.TypeX; @@ -286,7 +287,7 @@ public class AjLookupEnvironment extends LookupEnvironment { } if (hasPointcuts || dec instanceof AspectDeclaration) { - ResolvedTypeX.Name name = (ResolvedTypeX.Name)factory.fromEclipse(sourceType); + ReferenceType name = (ReferenceType)factory.fromEclipse(sourceType); EclipseSourceType eclipseSourceType = (EclipseSourceType)name.getDelegate(); eclipseSourceType.checkPointcutDeclarations(); } 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 6380392fa..d88b9729d 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 @@ -30,6 +30,7 @@ import org.aspectj.bridge.IMessage.Kind; import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.IHasPosition; import org.aspectj.weaver.Member; +import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedTypeX; import org.aspectj.weaver.Shadow; @@ -463,7 +464,7 @@ public class EclipseFactory { public void addSourceTypeBinding(SourceTypeBinding binding) { TypeDeclaration decl = binding.scope.referenceContext; - ResolvedTypeX.Name name = getWorld().lookupOrCreateName(TypeX.forName(getName(binding))); + ReferenceType name = getWorld().lookupOrCreateName(TypeX.forName(getName(binding))); EclipseSourceType t = new EclipseSourceType(name, this, binding, decl); name.setDelegate(t); if (decl instanceof AspectDeclaration) { 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 index 88b552b59..9f4ba9574 100644 --- 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 @@ -37,7 +37,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.*; * * @author Jim Hugunin */ -public class EclipseSourceType extends ResolvedTypeX.ConcreteName { +public class EclipseSourceType extends AbstractReferenceTypeDelegate { private static final char[] pointcutSig = "Lorg/aspectj/lang/annotation/Pointcut;".toCharArray(); private static final char[] aspectSig = "Lorg/aspectj/lang/annotation/Aspect;".toCharArray(); protected ResolvedPointcutDefinition[] declaredPointcuts = null; @@ -58,7 +58,7 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName { return factory; } - public EclipseSourceType(ResolvedTypeX.Name resolvedTypeX, EclipseFactory factory, + public EclipseSourceType(ReferenceType resolvedTypeX, EclipseFactory factory, SourceTypeBinding binding, TypeDeclaration declaration) { super(resolvedTypeX, true); @@ -435,15 +435,15 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName { } - protected Collection getDeclares() { + public Collection getDeclares() { return declares; } - protected Collection getPrivilegedAccesses() { + public Collection getPrivilegedAccesses() { return Collections.EMPTY_LIST; } - protected Collection getTypeMungers() { + public Collection getTypeMungers() { return typeMungers; } diff --git a/weaver/src/org/aspectj/weaver/AbstractReferenceTypeDelegate.java b/weaver/src/org/aspectj/weaver/AbstractReferenceTypeDelegate.java new file mode 100644 index 000000000..c5e29b0e7 --- /dev/null +++ b/weaver/src/org/aspectj/weaver/AbstractReferenceTypeDelegate.java @@ -0,0 +1,44 @@ +/* ******************************************************************* + * Copyright (c) 2002 Contributors + * 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 + * Andy Clement - June 2005 - separated out from ResolvedTypeX + * ******************************************************************/ +package org.aspectj.weaver; + +public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDelegate { + protected boolean exposedToWeaver; + protected ReferenceType resolvedTypeX; + + public AbstractReferenceTypeDelegate(ReferenceType resolvedTypeX, boolean exposedToWeaver) { + this.resolvedTypeX = resolvedTypeX; + this.exposedToWeaver = exposedToWeaver; + } + + public final boolean isClass() { + return !isAspect() && !isInterface(); + } + + /** + * Designed to be overriden by EclipseType to disable collection of shadow mungers + * during pre-weave compilation phase + */ + public boolean doesNotExposeShadowMungers() { + return false; + } + + public boolean isExposedToWeaver() { + return exposedToWeaver; + } + + public ReferenceType getResolvedTypeX() { + return resolvedTypeX; + } + +} \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/ReferenceType.java b/weaver/src/org/aspectj/weaver/ReferenceType.java new file mode 100644 index 000000000..7f62a0030 --- /dev/null +++ b/weaver/src/org/aspectj/weaver/ReferenceType.java @@ -0,0 +1,197 @@ +/* ******************************************************************* + * Copyright (c) 2002 Contributors + * 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 + * Andy Clement - June 2005 - separated out from ResolvedTypeX + * ******************************************************************/ +package org.aspectj.weaver; + +import java.util.Collection; +import java.util.Iterator; + +import org.aspectj.bridge.ISourceLocation; +import org.aspectj.weaver.patterns.PerClause; + +public class ReferenceType extends ResolvedTypeX { + ReferenceTypeDelegate delegate = null; + ISourceContext sourceContext = null; + int startPos = 0; + int endPos = 0; + + //??? should set delegate before any use + public ReferenceType(String signature, World world) { + super(signature, world); + } + + public final boolean isClass() { + return delegate.isClass(); + } + + public AnnotationX[] getAnnotations() { + return delegate.getAnnotations(); + } + + public void addAnnotation(AnnotationX annotationX) { + delegate.addAnnotation(annotationX); + } + public boolean hasAnnotation(TypeX ofType) { + return delegate.hasAnnotation(ofType); + } + + public ResolvedTypeX[] getAnnotationTypes() { + return delegate.getAnnotationTypes(); + } + + public boolean isAspect() { + return delegate.isAspect(); + } + + public boolean isAnnotationStyleAspect() { + return delegate.isAnnotationStyleAspect(); + } + + public boolean isEnum() { + return delegate.isEnum(); + } + + public boolean isAnnotation() { + return delegate.isAnnotation(); + } + + public boolean isAnnotationWithRuntimeRetention() { + return delegate.isAnnotationWithRuntimeRetention(); + } + + public final boolean needsNoConversionFrom(TypeX o) { + return isAssignableFrom(o); + } + + public final boolean isAssignableFrom(TypeX o) { + if (o.isPrimitive()) { + if (!world.behaveInJava5Way) return false; + if (ResolvedTypeX.validBoxing.contains(this.getSignature()+o.getSignature())) return true; + } + ResolvedTypeX other = o.resolve(world); + + return isAssignableFrom(other); + } + + public final boolean isCoerceableFrom(TypeX o) { + ResolvedTypeX other = o.resolve(world); + + if (this.isAssignableFrom(other) || other.isAssignableFrom(this)) { + return true; + } + if (!this.isInterface() && !other.isInterface()) { + return false; + } + if (this.isFinal() || other.isFinal()) { + return false; + } + // ??? needs to be Methods, not just declared methods? JLS 5.5 unclear + ResolvedMember[] a = getDeclaredMethods(); + ResolvedMember[] b = other.getDeclaredMethods(); //??? is this cast always safe + for (int ai = 0, alen = a.length; ai < alen; ai++) { + for (int bi = 0, blen = b.length; bi < blen; bi++) { + if (! b[bi].isCompatibleWith(a[ai])) return false; + } + } + return true; + } + + private boolean isAssignableFrom(ResolvedTypeX other) { + if (this == other) return true; + for(Iterator i = other.getDirectSupertypes(); i.hasNext(); ) { + if (this.isAssignableFrom((ResolvedTypeX) i.next())) return true; + } + return false; + } + + public ISourceContext getSourceContext() { + return sourceContext; + } + + public ISourceLocation getSourceLocation() { + if (sourceContext == null) return null; + return sourceContext.makeSourceLocation(new Position(startPos, endPos)); + } + + public boolean isExposedToWeaver() { + return (delegate == null) || delegate.isExposedToWeaver(); //??? where does this belong + } + + public WeaverStateInfo getWeaverState() { + return delegate.getWeaverState(); + } + + public ResolvedMember[] getDeclaredFields() { + return delegate.getDeclaredFields(); + } + + public ResolvedTypeX[] getDeclaredInterfaces() { + return delegate.getDeclaredInterfaces(); + } + + public ResolvedMember[] getDeclaredMethods() { + return delegate.getDeclaredMethods(); + } + + public ResolvedMember[] getDeclaredPointcuts() { + return delegate.getDeclaredPointcuts(); + } + + public PerClause getPerClause() { return delegate.getPerClause(); } + protected Collection getDeclares() { return delegate.getDeclares(); } + protected Collection getTypeMungers() { return delegate.getTypeMungers(); } + + protected Collection getPrivilegedAccesses() { return delegate.getPrivilegedAccesses(); } + + + public int getModifiers() { + return delegate.getModifiers(); + } + + public ResolvedTypeX getSuperclass() { + return delegate.getSuperclass(); + } + + + public ReferenceTypeDelegate getDelegate() { + return delegate; + } + + public void setDelegate(ReferenceTypeDelegate delegate) { + this.delegate = delegate; + } + + public int getEndPos() { + return endPos; + } + + public int getStartPos() { + return startPos; + } + + public void setEndPos(int endPos) { + this.endPos = endPos; + } + + public void setSourceContext(ISourceContext sourceContext) { + this.sourceContext = sourceContext; + } + + public void setStartPos(int startPos) { + this.startPos = startPos; + } + + public boolean doesNotExposeShadowMungers() { + return delegate.doesNotExposeShadowMungers(); + } + +} \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/ReferenceTypeDelegate.java b/weaver/src/org/aspectj/weaver/ReferenceTypeDelegate.java new file mode 100644 index 000000000..34d9597fb --- /dev/null +++ b/weaver/src/org/aspectj/weaver/ReferenceTypeDelegate.java @@ -0,0 +1,55 @@ +/* ******************************************************************* + * Copyright (c) 2002 Contributors + * 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 + * Andy Clement - June 2005 - separated out from ResolvedTypeX + * ******************************************************************/ +package org.aspectj.weaver; + +import java.util.Collection; + +import org.aspectj.weaver.patterns.PerClause; + +/** + * Abstraction over a type. Abstract implementation provided by + * AbstractReferenceTypeDelegate. + */ +public interface ReferenceTypeDelegate { + + // TODO asc move to proxy + public void addAnnotation(AnnotationX annotationX); + + public boolean isAspect(); + public boolean isAnnotationStyleAspect(); + public boolean isInterface(); + public boolean isEnum(); + public boolean isAnnotation(); + public boolean isAnnotationWithRuntimeRetention(); + public boolean isClass(); + public boolean isExposedToWeaver(); + + public boolean hasAnnotation(TypeX ofType); + + public AnnotationX[] getAnnotations(); + public ResolvedTypeX[] getAnnotationTypes(); + public ResolvedMember[] getDeclaredFields(); + public ResolvedTypeX[] getDeclaredInterfaces(); + public ResolvedMember[] getDeclaredMethods(); + public ResolvedMember[] getDeclaredPointcuts(); + + public PerClause getPerClause(); + public Collection getDeclares() ; + public Collection getTypeMungers(); + public Collection getPrivilegedAccesses(); + public int getModifiers(); + public ResolvedTypeX getSuperclass(); + public WeaverStateInfo getWeaverState(); + public ReferenceType getResolvedTypeX(); + public boolean doesNotExposeShadowMungers(); +} \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java index 52813072d..45f1cfd51 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java +++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java @@ -105,7 +105,7 @@ public abstract class ResolvedTypeX extends TypeX implements AnnotatedElement { // This set contains pairs of types whose signatures are concatenated // together, this means with a fast lookup we can tell if two types // are equivalent. - private static Set validBoxing = new HashSet(); + static Set validBoxing = new HashSet(); static { validBoxing.add("Ljava/lang/Byte;B"); @@ -631,258 +631,6 @@ public abstract class ResolvedTypeX extends TypeX implements AnnotatedElement { // ---- types - public static class Name extends ResolvedTypeX { - private ConcreteName delegate = null; - private ISourceContext sourceContext = null; - private int startPos = 0; - private int endPos = 0; - - //??? should set delegate before any use - public Name(String signature, World world) { - super(signature, world); - } - - public final boolean isClass() { - return delegate.isClass(); - } - - public AnnotationX[] getAnnotations() { - return delegate.getAnnotations(); - } - - public void addAnnotation(AnnotationX annotationX) { - delegate.addAnnotation(annotationX); - } - public boolean hasAnnotation(TypeX ofType) { - return delegate.hasAnnotation(ofType); - } - - public ResolvedTypeX[] getAnnotationTypes() { - return delegate.getAnnotationTypes(); - } - - public boolean isAspect() { - return delegate.isAspect(); - } - - public boolean isAnnotationStyleAspect() { - return delegate.isAnnotationStyleAspect(); - } - - public boolean isEnum() { - return delegate.isEnum(); - } - - public boolean isAnnotation() { - return delegate.isAnnotation(); - } - - public boolean isAnnotationWithRuntimeRetention() { - return delegate.isAnnotationWithRuntimeRetention(); - } - - public final boolean needsNoConversionFrom(TypeX o) { - return isAssignableFrom(o); - } - - public final boolean isAssignableFrom(TypeX o) { - if (o.isPrimitive()) { - if (!world.behaveInJava5Way) return false; - if (validBoxing.contains(this.getSignature()+o.getSignature())) return true; - } - ResolvedTypeX other = o.resolve(world); - - return isAssignableFrom(other); - } - - public final boolean isCoerceableFrom(TypeX o) { - ResolvedTypeX other = o.resolve(world); - - if (this.isAssignableFrom(other) || other.isAssignableFrom(this)) { - return true; - } - if (!this.isInterface() && !other.isInterface()) { - return false; - } - if (this.isFinal() || other.isFinal()) { - return false; - } - // ??? needs to be Methods, not just declared methods? JLS 5.5 unclear - ResolvedMember[] a = getDeclaredMethods(); - ResolvedMember[] b = other.getDeclaredMethods(); //??? is this cast always safe - for (int ai = 0, alen = a.length; ai < alen; ai++) { - for (int bi = 0, blen = b.length; bi < blen; bi++) { - if (! b[bi].isCompatibleWith(a[ai])) return false; - } - } - return true; - } - - private boolean isAssignableFrom(ResolvedTypeX other) { - if (this == other) return true; - for(Iterator i = other.getDirectSupertypes(); i.hasNext(); ) { - if (this.isAssignableFrom((ResolvedTypeX) i.next())) return true; - } - return false; - } - - public ISourceContext getSourceContext() { - return sourceContext; - } - - public ISourceLocation getSourceLocation() { - if (sourceContext == null) return null; - return sourceContext.makeSourceLocation(new Position(startPos, endPos)); - } - - public boolean isExposedToWeaver() { - return (delegate == null) || delegate.isExposedToWeaver(); //??? where does this belong - } - - public WeaverStateInfo getWeaverState() { - return delegate.getWeaverState(); - } - - public ResolvedMember[] getDeclaredFields() { - return delegate.getDeclaredFields(); - } - - public ResolvedTypeX[] getDeclaredInterfaces() { - return delegate.getDeclaredInterfaces(); - } - - public ResolvedMember[] getDeclaredMethods() { - return delegate.getDeclaredMethods(); - } - - public ResolvedMember[] getDeclaredPointcuts() { - return delegate.getDeclaredPointcuts(); - } - - public PerClause getPerClause() { return delegate.getPerClause(); } - protected Collection getDeclares() { return delegate.getDeclares(); } - protected Collection getTypeMungers() { return delegate.getTypeMungers(); } - - protected Collection getPrivilegedAccesses() { return delegate.getPrivilegedAccesses(); } - - - public int getModifiers() { - return delegate.getModifiers(); - } - - public ResolvedTypeX getSuperclass() { - return delegate.getSuperclass(); - } - - - public ConcreteName getDelegate() { - return delegate; - } - - public void setDelegate(ConcreteName delegate) { - this.delegate = delegate; - } - - public int getEndPos() { - return endPos; - } - - public int getStartPos() { - return startPos; - } - - public void setEndPos(int endPos) { - this.endPos = endPos; - } - - public void setSourceContext(ISourceContext sourceContext) { - this.sourceContext = sourceContext; - } - - public void setStartPos(int startPos) { - this.startPos = startPos; - } - - public boolean doesNotExposeShadowMungers() { - return delegate.doesNotExposeShadowMungers(); - } - - } - - public static abstract class ConcreteName { - //protected ISourceContext sourceContext; - protected boolean exposedToWeaver; - protected ResolvedTypeX.Name resolvedTypeX; - - - public ConcreteName(ResolvedTypeX.Name resolvedTypeX, boolean exposedToWeaver) { - //???super(signature, world); - this.resolvedTypeX = resolvedTypeX; - this.exposedToWeaver = exposedToWeaver; - } - - - public final boolean isClass() { - return !isAspect() && !isInterface(); - } - - public abstract boolean isAspect(); - public abstract boolean isAnnotationStyleAspect(); - public abstract boolean isInterface(); - public abstract boolean isEnum(); - public abstract boolean isAnnotation(); - public abstract boolean isAnnotationWithRuntimeRetention(); - - public abstract AnnotationX[] getAnnotations(); - public abstract void addAnnotation(AnnotationX annotationX); - public abstract boolean hasAnnotation(TypeX ofType); - public abstract ResolvedTypeX[] getAnnotationTypes(); - - public abstract ResolvedMember[] getDeclaredFields(); - - public abstract ResolvedTypeX[] getDeclaredInterfaces(); - - public abstract ResolvedMember[] getDeclaredMethods(); - - public abstract ResolvedMember[] getDeclaredPointcuts(); - - public abstract PerClause getPerClause(); - protected abstract Collection getDeclares() ; - protected abstract Collection getTypeMungers(); - - protected abstract Collection getPrivilegedAccesses(); - - - public abstract int getModifiers(); - - public abstract ResolvedTypeX getSuperclass(); - -// public abstract ISourceLocation getSourceLocation(); - - public abstract WeaverStateInfo getWeaverState(); - -// public ISourceContext getSourceContext() { -// return sourceContext; -// } - - /** - * Designed to be overriden by EclipseType to disable collection of shadow mungers - * during pre-weave compilation phase - */ - public boolean doesNotExposeShadowMungers() { - return false; - } - - public boolean isExposedToWeaver() { - return exposedToWeaver; - } - - public ResolvedTypeX.Name getResolvedTypeX() { - return resolvedTypeX; - } - - } - static class Array extends ResolvedTypeX { ResolvedTypeX componentType; Array(String s, World world, ResolvedTypeX componentType) { diff --git a/weaver/src/org/aspectj/weaver/TypeX.java b/weaver/src/org/aspectj/weaver/TypeX.java index e57cdf5d1..9888be428 100644 --- a/weaver/src/org/aspectj/weaver/TypeX.java +++ b/weaver/src/org/aspectj/weaver/TypeX.java @@ -40,7 +40,7 @@ public class TypeX implements AnnotatedElement { // an inner type of a parameterized type that specifies no type parameters of its own. protected TypeX[] typeParameters; private boolean isParameterized = false; - private boolean isRawtype = false; + private boolean isRawtype = false; // TODO asc - change to isGeneric? /** diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java index f721cc4fb..0ab778f7d 100644 --- a/weaver/src/org/aspectj/weaver/World.java +++ b/weaver/src/org/aspectj/weaver/World.java @@ -156,14 +156,14 @@ public abstract class World implements Dump.INode { protected final ResolvedTypeX resolveObjectType(TypeX ty) { String signature = ty.getRawTypeSignature(); - ResolvedTypeX.Name name = new ResolvedTypeX.Name(signature, this); - ResolvedTypeX.ConcreteName concreteName = resolveObjectType(name); + ReferenceType name = new ReferenceType(signature, this); + ReferenceTypeDelegate concreteName = resolveObjectType(name); if (concreteName == null) return ResolvedTypeX.MISSING; name.setDelegate(concreteName); return name; } - protected abstract ResolvedTypeX.ConcreteName resolveObjectType(ResolvedTypeX.Name ty); + protected abstract ReferenceTypeDelegate resolveObjectType(ReferenceType ty); protected final boolean isCoerceableFrom(TypeX type, TypeX other) { @@ -475,11 +475,11 @@ public abstract class World implements Dump.INode { XlazyTjp = b; } - public ResolvedTypeX.Name lookupOrCreateName(TypeX ty) { + public ReferenceType lookupOrCreateName(TypeX ty) { String signature = ty.getRawTypeSignature(); - ResolvedTypeX.Name ret = (ResolvedTypeX.Name)typeMap.get(signature); + ReferenceType ret = (ReferenceType)typeMap.get(signature); if (ret == null) { - ret = new ResolvedTypeX.Name(signature, this); + ret = new ReferenceType(signature, this); typeMap.put(signature, ret); } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index 47e814f6b..b95e66ba6 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -28,9 +28,11 @@ import org.aspectj.apache.bcel.classfile.annotation.Annotation; import org.aspectj.apache.bcel.classfile.annotation.ElementNameValuePair; import org.aspectj.apache.bcel.classfile.annotation.ElementValue; import org.aspectj.bridge.ISourceLocation; +import org.aspectj.weaver.AbstractReferenceTypeDelegate; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.AnnotationX; import org.aspectj.weaver.BCException; +import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedPointcutDefinition; import org.aspectj.weaver.ResolvedTypeX; @@ -41,7 +43,7 @@ import org.aspectj.weaver.patterns.PerClause; // ??? exposed for testing -public class BcelObjectType extends ResolvedTypeX.ConcreteName { +public class BcelObjectType extends AbstractReferenceTypeDelegate { private JavaClass javaClass; private boolean isObject = false; // set upon construction private LazyClassGen lazyClassGen = null; // set lazily if it's an aspect @@ -89,7 +91,7 @@ public class BcelObjectType extends ResolvedTypeX.ConcreteName { // IMPORTANT! THIS DOESN'T do real work on the java class, just stores it away. - BcelObjectType(ResolvedTypeX.Name resolvedTypeX, JavaClass javaClass, boolean exposedToWeaver) { + BcelObjectType(ReferenceType resolvedTypeX, JavaClass javaClass, boolean exposedToWeaver) { super(resolvedTypeX, exposedToWeaver); this.javaClass = javaClass; diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index 1b8a57f90..71e8eb7cf 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -43,6 +43,8 @@ import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.ICrossReferenceHandler; import org.aspectj.weaver.Member; +import org.aspectj.weaver.ReferenceType; +import org.aspectj.weaver.ReferenceTypeDelegate; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedTypeMunger; import org.aspectj.weaver.ResolvedTypeX; @@ -217,7 +219,7 @@ public class BcelWorld extends World implements Repository { } - protected ResolvedTypeX.ConcreteName resolveObjectType(ResolvedTypeX.Name ty) { + protected ReferenceTypeDelegate resolveObjectType(ReferenceType ty) { String name = ty.getName(); JavaClass jc = null; //UnwovenClassFile classFile = (UnwovenClassFile)sourceJavaClasses.get(name); @@ -235,7 +237,7 @@ public class BcelWorld extends World implements Repository { } } - protected BcelObjectType makeBcelObjectType(ResolvedTypeX.Name resolvedTypeX, JavaClass jc, boolean exposedToWeaver) { + protected BcelObjectType makeBcelObjectType(ReferenceType resolvedTypeX, JavaClass jc, boolean exposedToWeaver) { BcelObjectType ret = new BcelObjectType(resolvedTypeX, jc, exposedToWeaver); return ret; } @@ -267,10 +269,10 @@ public class BcelWorld extends World implements Repository { public BcelObjectType addSourceObjectType(JavaClass jc) { String signature = TypeX.forName(jc.getClassName()).getSignature(); - ResolvedTypeX.Name nameTypeX = (ResolvedTypeX.Name)typeMap.get(signature); + ReferenceType nameTypeX = (ReferenceType)typeMap.get(signature); if (nameTypeX == null) { - nameTypeX = new ResolvedTypeX.Name(signature, this); + nameTypeX = new ReferenceType(signature, this); } BcelObjectType ret = makeBcelObjectType(nameTypeX, jc, true); typeMap.put(signature, nameTypeX); @@ -411,7 +413,7 @@ public class BcelWorld extends World implements Repository { public static BcelObjectType getBcelObjectType(ResolvedTypeX concreteAspect) { //XXX need error checking - return (BcelObjectType) ((ResolvedTypeX.Name)concreteAspect).getDelegate(); + return (BcelObjectType) ((ReferenceType)concreteAspect).getDelegate(); } public void tidyUp() { -- 2.39.5