* @version $Id: ExceptionConstants.java,v 1.5 2009/09/14 20:29:10 aclement Exp $ | * @version $Id: ExceptionConstants.java,v 1.5 2009/09/14 20:29:10 aclement Exp $ | ||||
* @author <A HREF="http://www.inf.fu-berlin.de/~ehaase">E. Haase</A> | * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase">E. Haase</A> | ||||
*/ | */ | ||||
@SuppressWarnings("rawtypes") | |||||
public interface ExceptionConstants { | public interface ExceptionConstants { | ||||
/** | /** | ||||
* The mother of all exceptions | * The mother of all exceptions | ||||
public static final Class<ExceptionInInitializerError> EXCEPTION_IN_INITIALIZER_ERROR = ExceptionInInitializerError.class; | public static final Class<ExceptionInInitializerError> EXCEPTION_IN_INITIALIZER_ERROR = ExceptionInInitializerError.class; | ||||
public static final Class<IncompatibleClassChangeError> INCOMPATIBLE_CLASS_CHANGE_ERROR = IncompatibleClassChangeError.class; | public static final Class<IncompatibleClassChangeError> INCOMPATIBLE_CLASS_CHANGE_ERROR = IncompatibleClassChangeError.class; | ||||
public static final Class<AbstractMethodError> ABSTRACT_METHOD_ERROR = AbstractMethodError.class; | public static final Class<AbstractMethodError> ABSTRACT_METHOD_ERROR = AbstractMethodError.class; | ||||
public static final Class ILLEGAL_ACCESS_ERROR = IllegalAccessError.class; | |||||
public static final Class<IllegalAccessError> ILLEGAL_ACCESS_ERROR = IllegalAccessError.class; | |||||
public static final Class<InstantiationError> INSTANTIATION_ERROR = InstantiationError.class; | public static final Class<InstantiationError> INSTANTIATION_ERROR = InstantiationError.class; | ||||
public static final Class<NoSuchFieldError> NO_SUCH_FIELD_ERROR = NoSuchFieldError.class; | public static final Class<NoSuchFieldError> NO_SUCH_FIELD_ERROR = NoSuchFieldError.class; | ||||
public static final Class<NoSuchMethodError> NO_SUCH_METHOD_ERROR = NoSuchMethodError.class; | public static final Class<NoSuchMethodError> NO_SUCH_METHOD_ERROR = NoSuchMethodError.class; | ||||
public static final Class<NullPointerException> NULL_POINTER_EXCEPTION = NullPointerException.class; | public static final Class<NullPointerException> NULL_POINTER_EXCEPTION = NullPointerException.class; | ||||
public static final Class<ArrayIndexOutOfBoundsException> ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION = ArrayIndexOutOfBoundsException.class; | public static final Class<ArrayIndexOutOfBoundsException> ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION = ArrayIndexOutOfBoundsException.class; | ||||
public static final Class<ArithmeticException> ARITHMETIC_EXCEPTION = ArithmeticException.class; | public static final Class<ArithmeticException> ARITHMETIC_EXCEPTION = ArithmeticException.class; | ||||
public static final Class NEGATIVE_ARRAY_SIZE_EXCEPTION = NegativeArraySizeException.class; | |||||
public static final Class<NegativeArraySizeException> NEGATIVE_ARRAY_SIZE_EXCEPTION = NegativeArraySizeException.class; | |||||
public static final Class<ClassCastException> CLASS_CAST_EXCEPTION = ClassCastException.class; | public static final Class<ClassCastException> CLASS_CAST_EXCEPTION = ClassCastException.class; | ||||
public static final Class<IllegalMonitorStateException> ILLEGAL_MONITOR_STATE = IllegalMonitorStateException.class; | public static final Class<IllegalMonitorStateException> ILLEGAL_MONITOR_STATE = IllegalMonitorStateException.class; | ||||
return sb.toString(); | return sb.toString(); | ||||
} | } | ||||
public static String getSignature(java.lang.reflect.Constructor cons) { | |||||
public static String getSignature(java.lang.reflect.Constructor<?> cons) { | |||||
StringBuffer sb = new StringBuffer("("); | StringBuffer sb = new StringBuffer("("); | ||||
Class[] params = cons.getParameterTypes(); // avoid clone | |||||
Class<?>[] params = cons.getParameterTypes(); // avoid clone | |||||
for (int j = 0; j < params.length; j++) { | for (int j = 0; j < params.length; j++) { | ||||
sb.append(getType(params[j]).getSignature()); | sb.append(getType(params[j]).getSignature()); |
synchronized (WeaverContainer.weavingAdaptors) { | synchronized (WeaverContainer.weavingAdaptors) { | ||||
if (displayProgress) { | if (displayProgress) { | ||||
System.err.println("Weaver adaptors before queue processing:"); | System.err.println("Weaver adaptors before queue processing:"); | ||||
Map m = WeaverContainer.weavingAdaptors; | |||||
Set keys = m.keySet(); | |||||
for (Iterator iterator = keys.iterator(); iterator.hasNext();) { | |||||
Map<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor> m = WeaverContainer.weavingAdaptors; | |||||
Set<AdaptorKey> keys = m.keySet(); | |||||
for (Iterator<AdaptorKey> iterator = keys.iterator(); iterator.hasNext();) { | |||||
Object object = iterator.next(); | Object object = iterator.next(); | ||||
System.err.println(object + " = " + WeaverContainer.weavingAdaptors.get(object)); | System.err.println(object + " = " + WeaverContainer.weavingAdaptors.get(object)); | ||||
} | } | ||||
} | } | ||||
if (displayProgress) { | if (displayProgress) { | ||||
System.err.println("Weaver adaptors after queue processing:"); | System.err.println("Weaver adaptors after queue processing:"); | ||||
Map m = WeaverContainer.weavingAdaptors; | |||||
Set keys = m.keySet(); | |||||
for (Iterator iterator = keys.iterator(); iterator.hasNext();) { | |||||
Map<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor> m = WeaverContainer.weavingAdaptors; | |||||
Set<AdaptorKey> keys = m.keySet(); | |||||
for (Iterator<AdaptorKey> iterator = keys.iterator(); iterator.hasNext();) { | |||||
Object object = iterator.next(); | Object object = iterator.next(); | ||||
System.err.println(object + " = " + WeaverContainer.weavingAdaptors.get(object)); | System.err.println(object + " = " + WeaverContainer.weavingAdaptors.get(object)); | ||||
} | } | ||||
*/ | */ | ||||
static class WeaverContainer { | static class WeaverContainer { | ||||
final static Map weavingAdaptors = Collections.synchronizedMap(new HashMap()); | |||||
final static Map<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor> weavingAdaptors = | |||||
Collections.synchronizedMap(new HashMap<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor>()); | |||||
static WeavingAdaptor getWeaver(ClassLoader loader, IWeavingContext weavingContext) { | static WeavingAdaptor getWeaver(ClassLoader loader, IWeavingContext weavingContext) { | ||||
ExplicitlyInitializedClassLoaderWeavingAdaptor adaptor = null; | ExplicitlyInitializedClassLoaderWeavingAdaptor adaptor = null; |
import org.aspectj.weaver.CompressingDataOutputStream; | import org.aspectj.weaver.CompressingDataOutputStream; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; | import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; | ||||
return this; | return this; | ||||
} | } | ||||
public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) { | |||||
public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap, w); | AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap, w); | ||||
AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap, w); | AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap, w); | ||||
AndAnnotationTypePattern ret = new AndAnnotationTypePattern(newLeft, newRight); | AndAnnotationTypePattern ret = new AndAnnotationTypePattern(newLeft, newRight); |
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
/** | /** | ||||
* @author colyer | |||||
* | |||||
* TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code | |||||
* Templates | |||||
* @author Adrian Colyer | |||||
*/ | */ | ||||
public class AnnotationPatternList extends PatternNode { | public class AnnotationPatternList extends PatternNode { | ||||
new AnnotationTypePattern[] { AnnotationTypePattern.ELLIPSIS }); | new AnnotationTypePattern[] { AnnotationTypePattern.ELLIPSIS }); | ||||
public AnnotationPatternList() { | public AnnotationPatternList() { | ||||
typePatterns = new AnnotationTypePattern[0]; | |||||
typePatterns = new AnnotationTypePattern[0]; | |||||
ellipsisCount = 0; | ellipsisCount = 0; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public AnnotationPatternList(List l) { | |||||
public AnnotationPatternList(List<AnnotationTypePattern> l) { | |||||
this((AnnotationTypePattern[]) l.toArray(new AnnotationTypePattern[l.size()])); | this((AnnotationTypePattern[]) l.toArray(new AnnotationTypePattern[l.size()])); | ||||
} | } | ||||
return typePatterns; | return typePatterns; | ||||
} | } | ||||
public AnnotationPatternList parameterizeWith(Map typeVariableMap, World w) { | |||||
public AnnotationPatternList parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
AnnotationTypePattern[] parameterizedPatterns = new AnnotationTypePattern[this.typePatterns.length]; | AnnotationTypePattern[] parameterizedPatterns = new AnnotationTypePattern[this.typePatterns.length]; | ||||
for (int i = 0; i < parameterizedPatterns.length; i++) { | for (int i = 0; i < parameterizedPatterns.length; i++) { | ||||
parameterizedPatterns[i] = this.typePatterns[i].parameterizeWith(typeVariableMap, w); | parameterizedPatterns[i] = this.typePatterns[i].parameterizeWith(typeVariableMap, w); |
* | * | ||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | ||||
*/ | */ | ||||
public List getBindingAnnotationTypePatterns() { | |||||
public List<BindingPattern> getBindingAnnotationTypePatterns() { | |||||
if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) { | if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) { | ||||
List l = new ArrayList(); | |||||
l.add(annotationTypePattern); | |||||
List<BindingPattern> l = new ArrayList<BindingPattern>(); | |||||
l.add((BindingPattern)annotationTypePattern); | |||||
return l; | return l; | ||||
} else { | } else { | ||||
return Collections.EMPTY_LIST; | |||||
return Collections.emptyList(); | |||||
} | } | ||||
} | } | ||||
* | * | ||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | ||||
*/ | */ | ||||
public List getBindingTypePatterns() { | |||||
return Collections.EMPTY_LIST; | |||||
public List<BindingTypePattern> getBindingTypePatterns() { | |||||
return Collections.emptyList(); | |||||
} | } | ||||
/* | /* |
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
public abstract void resolve(World world); | public abstract void resolve(World world); | ||||
public abstract AnnotationTypePattern parameterizeWith(Map/* name -> ResolvedType */typeVariableMap, World w); | |||||
public abstract AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w); | |||||
public boolean isAny() { | public boolean isAny() { | ||||
return false; | return false; |
import org.aspectj.weaver.CompressingDataOutputStream; | import org.aspectj.weaver.CompressingDataOutputStream; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
} | } | ||||
@Override | @Override | ||||
public TypePattern parameterizeWith(Map typeVariableMap, World w) { | |||||
public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith( | AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith( | ||||
typeVariableMap, w)); | typeVariableMap, w)); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); |
return ret; | return ret; | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | |||||
*/ | |||||
public List getBindingAnnotationTypePatterns() { | |||||
List l = new ArrayList(); | |||||
public List<BindingPattern> getBindingAnnotationTypePatterns() { | |||||
List<BindingPattern> l = new ArrayList<BindingPattern>(); | |||||
AnnotationTypePattern[] pats = arguments.getAnnotationPatterns(); | AnnotationTypePattern[] pats = arguments.getAnnotationPatterns(); | ||||
for (int i = 0; i < pats.length; i++) { | for (int i = 0; i < pats.length; i++) { | ||||
if (pats[i] instanceof BindingAnnotationTypePattern) { | if (pats[i] instanceof BindingAnnotationTypePattern) { | ||||
l.add(pats[i]); | |||||
l.add((BindingPattern)pats[i]); | |||||
} | } | ||||
} | } | ||||
return l; | return l; | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | |||||
*/ | |||||
public List getBindingTypePatterns() { | |||||
return Collections.EMPTY_LIST; | |||||
public List<BindingTypePattern> getBindingTypePatterns() { | |||||
return Collections.emptyList(); | |||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream) | |||||
*/ | |||||
public void write(CompressingDataOutputStream s) throws IOException { | public void write(CompressingDataOutputStream s) throws IOException { | ||||
s.writeByte(Pointcut.ATARGS); | s.writeByte(Pointcut.ATARGS); | ||||
arguments.write(s); | arguments.write(s); |
return argumentsToMatchAgainst; | return argumentsToMatchAgainst; | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | |||||
*/ | |||||
public List getBindingAnnotationTypePatterns() { | |||||
return Collections.EMPTY_LIST; | |||||
public List<BindingPattern> getBindingAnnotationTypePatterns() { | |||||
return Collections.emptyList(); | |||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | |||||
*/ | |||||
public List getBindingTypePatterns() { | |||||
public List<BindingTypePattern> getBindingTypePatterns() { | |||||
List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); | List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); | ||||
TypePattern[] pats = arguments.getTypePatterns(); | TypePattern[] pats = arguments.getTypePatterns(); | ||||
for (int i = 0; i < pats.length; i++) { | for (int i = 0; i < pats.length; i++) { |
} | } | ||||
} | } | ||||
public TypePattern parameterizeWith(Map typeVariableMap, World w) { | |||||
public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
ExactTypePattern superParameterized = (ExactTypePattern) super.parameterizeWith(typeVariableMap, w); | ExactTypePattern superParameterized = (ExactTypePattern) super.parameterizeWith(typeVariableMap, w); | ||||
BindingTypePattern ret = new BindingTypePattern(superParameterized.getExactType(), this.formalIndex, this.isVarArgs); | BindingTypePattern ret = new BindingTypePattern(superParameterized.getExactType(), this.formalIndex, this.isVarArgs); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); |
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
import org.aspectj.weaver.patterns.ConcreteCflowPointcut.Slot; | |||||
public class CflowPointcut extends Pointcut { | public class CflowPointcut extends Pointcut { | ||||
private final Pointcut entry; // The pointcut inside the cflow() that | private final Pointcut entry; // The pointcut inside the cflow() that | ||||
return ret; | return ret; | ||||
} | } | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
CflowPointcut ret = new CflowPointcut(entry.parameterizeWith(typeVariableMap, w), isBelow, freeVars); | CflowPointcut ret = new CflowPointcut(entry.parameterizeWith(typeVariableMap, w), isBelow, freeVars); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); | ||||
return ret; | return ret; | ||||
return ret; | return ret; | ||||
} else { | } else { | ||||
List slots = new ArrayList(); | |||||
List<Slot> slots = new ArrayList<Slot>(); | |||||
for (int i = 0, len = freeVars.length; i < len; i++) { | for (int i = 0, len = freeVars.length; i < len; i++) { | ||||
int freeVar = freeVars[i]; | int freeVar = freeVars[i]; |
package org.aspectj.weaver.patterns; | package org.aspectj.weaver.patterns; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
public class ConcreteCflowPointcut extends Pointcut { | public class ConcreteCflowPointcut extends Pointcut { | ||||
private final Member cflowField; | private final Member cflowField; | ||||
List/* Slot */slots; // exposed for testing | |||||
List<Slot> slots; // exposed for testing | |||||
boolean usesCounter; | boolean usesCounter; | ||||
ResolvedType aspect; | ResolvedType aspect; | ||||
// Can either use a counter or a stack to implement cflow. | // Can either use a counter or a stack to implement cflow. | ||||
public ConcreteCflowPointcut(ResolvedType aspect, Member cflowField, List slots, boolean usesCounter) { | |||||
public ConcreteCflowPointcut(ResolvedType aspect, Member cflowField, List<Slot> slots, boolean usesCounter) { | |||||
this.aspect = aspect; | this.aspect = aspect; | ||||
this.cflowField = cflowField; | this.cflowField = cflowField; | ||||
this.slots = slots; | this.slots = slots; | ||||
// this bit is for pr145693 - we cannot match at all if one of the types is missing, we will be unable | // this bit is for pr145693 - we cannot match at all if one of the types is missing, we will be unable | ||||
// to create the residue | // to create the residue | ||||
if (slots != null) { | if (slots != null) { | ||||
for (Iterator i = slots.iterator(); i.hasNext();) { | |||||
Slot slot = (Slot) i.next(); | |||||
for (Slot slot: slots) { | |||||
ResolvedType rt = slot.formalType; | ResolvedType rt = slot.formalType; | ||||
if (rt.isMissing()) { | if (rt.isMissing()) { | ||||
ISourceLocation[] locs = new ISourceLocation[] { getSourceLocation() }; | ISourceLocation[] locs = new ISourceLocation[] { getSourceLocation() }; | ||||
throw new RuntimeException("unimplemented"); | throw new RuntimeException("unimplemented"); | ||||
} | } | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
throw new RuntimeException("unimplemented"); | throw new RuntimeException("unimplemented"); | ||||
} | } | ||||
return Test.makeFieldGetCall(cflowField, cflowCounterIsValidMethod, Expr.NONE); | return Test.makeFieldGetCall(cflowField, cflowCounterIsValidMethod, Expr.NONE); | ||||
} else { | } else { | ||||
if (slots != null) { // null for cflows managed by counters | if (slots != null) { // null for cflows managed by counters | ||||
for (Iterator i = slots.iterator(); i.hasNext();) { | |||||
Slot slot = (Slot) i.next(); | |||||
for (Slot slot: slots) { | |||||
// System.out.println("slot: " + slot.formalIndex); | // System.out.println("slot: " + slot.formalIndex); | ||||
state.set(slot.formalIndex, | state.set(slot.formalIndex, | ||||
aspect.getWorld().getWeavingSupport().makeCflowAccessVar(slot.formalType, cflowField, slot.arrayIndex)); | aspect.getWorld().getWeavingSupport().makeCflowAccessVar(slot.formalType, cflowField, slot.arrayIndex)); |
import org.aspectj.weaver.CompressingDataOutputStream; | import org.aspectj.weaver.CompressingDataOutputStream; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
pointcut = pointcut.resolve(scope); | pointcut = pointcut.resolve(scope); | ||||
} | } | ||||
public Declare parameterizeWith(Map typeVariableBindingMap, World w) { | |||||
public Declare parameterizeWith(Map<String,UnresolvedType> typeVariableBindingMap, World w) { | |||||
Declare ret = new DeclareErrorOrWarning(isError, pointcut.parameterizeWith(typeVariableBindingMap, w), message); | Declare ret = new DeclareErrorOrWarning(isError, pointcut.parameterizeWith(typeVariableBindingMap, w), message); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); | ||||
return ret; | return ret; |
return Test.makeInstanceof(var, myType.resolve(world)); | return Test.makeInstanceof(var, myType.resolve(world)); | ||||
} | } | ||||
public abstract List/*<BindingTypePattern>*/ getBindingTypePatterns(); | |||||
public abstract List/*<BindingAnnotationTypePattern>*/ getBindingAnnotationTypePatterns(); | |||||
public abstract List<BindingTypePattern> getBindingTypePatterns(); | |||||
public abstract List<BindingPattern> getBindingAnnotationTypePatterns(); | |||||
} | } |
import org.aspectj.weaver.CompressingDataOutputStream; | import org.aspectj.weaver.CompressingDataOutputStream; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; | import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; | ||||
return this; | return this; | ||||
} | } | ||||
public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) { | |||||
public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
AnnotationTypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap, w); | AnnotationTypePattern newNegatedPattern = negatedPattern.parameterizeWith(typeVariableMap, w); | ||||
NotAnnotationTypePattern ret = new NotAnnotationTypePattern(newNegatedPattern); | NotAnnotationTypePattern ret = new NotAnnotationTypePattern(newNegatedPattern); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); |
import org.aspectj.weaver.CompressingDataOutputStream; | import org.aspectj.weaver.CompressingDataOutputStream; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; | import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; | ||||
right.resolve(world); | right.resolve(world); | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.AnnotationTypePattern#resolveBindings(org.aspectj.weaver.patterns.IScope, | |||||
* org.aspectj.weaver.patterns.Bindings, boolean) | |||||
*/ | |||||
public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) { | public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) { | ||||
left = left.resolveBindings(scope, bindings, allowBinding); | left = left.resolveBindings(scope, bindings, allowBinding); | ||||
right = right.resolveBindings(scope, bindings, allowBinding); | right = right.resolveBindings(scope, bindings, allowBinding); | ||||
return this; | return this; | ||||
} | } | ||||
public AnnotationTypePattern parameterizeWith(Map typeVariableMap, World w) { | |||||
public AnnotationTypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap, w); | AnnotationTypePattern newLeft = left.parameterizeWith(typeVariableMap, w); | ||||
AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap, w); | AnnotationTypePattern newRight = right.parameterizeWith(typeVariableMap, w); | ||||
OrAnnotationTypePattern ret = new OrAnnotationTypePattern(newLeft, newRight); | OrAnnotationTypePattern ret = new OrAnnotationTypePattern(newLeft, newRight); |
entry.resolve(scope); | entry.resolve(scope); | ||||
} | } | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
PerCflow ret = new PerCflow(entry.parameterizeWith(typeVariableMap, w), isBelow); | PerCflow ret = new PerCflow(entry.parameterizeWith(typeVariableMap, w), isBelow); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); | ||||
return ret; | return ret; |
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.WeaverMessages; | import org.aspectj.weaver.WeaverMessages; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
} | } | ||||
} | } | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
return this; | return this; | ||||
} | } | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.ResolvedTypeMunger; | import org.aspectj.weaver.ResolvedTypeMunger; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.ast.Expr; | import org.aspectj.weaver.ast.Expr; | ||||
entry.resolve(scope); | entry.resolve(scope); | ||||
} | } | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
PerObject ret = new PerObject(entry.parameterizeWith(typeVariableMap, w), isThis); | PerObject ret = new PerObject(entry.parameterizeWith(typeVariableMap, w), isThis); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); | ||||
return ret; | return ret; |
import org.aspectj.weaver.ResolvedMember; | import org.aspectj.weaver.ResolvedMember; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.ast.Expr; | import org.aspectj.weaver.ast.Expr; | ||||
// this method intentionally left blank | // this method intentionally left blank | ||||
} | } | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
return this; | return this; | ||||
} | } | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.ResolvedTypeMunger; | import org.aspectj.weaver.ResolvedTypeMunger; | ||||
import org.aspectj.weaver.Shadow; | import org.aspectj.weaver.Shadow; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
import org.aspectj.weaver.ast.Expr; | import org.aspectj.weaver.ast.Expr; | ||||
return kindSet; | return kindSet; | ||||
} | } | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
PerTypeWithin ret = new PerTypeWithin(typePattern.parameterizeWith(typeVariableMap, w)); | PerTypeWithin ret = new PerTypeWithin(typePattern.parameterizeWith(typeVariableMap, w)); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); | ||||
return ret; | return ret; |
} | } | ||||
@Override | @Override | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
ExactAnnotationTypePattern newPattern = (ExactAnnotationTypePattern) this.annotationTypePattern.parameterizeWith( | ExactAnnotationTypePattern newPattern = (ExactAnnotationTypePattern) this.annotationTypePattern.parameterizeWith( | ||||
typeVariableMap, w); | typeVariableMap, w); | ||||
if (newPattern.getAnnotationType() instanceof ResolvedType) { | if (newPattern.getAnnotationType() instanceof ResolvedType) { | ||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | ||||
*/ | */ | ||||
@Override | @Override | ||||
public List getBindingAnnotationTypePatterns() { | |||||
public List<BindingPattern> getBindingAnnotationTypePatterns() { | |||||
if (annotationTypePattern instanceof BindingAnnotationTypePattern) { | if (annotationTypePattern instanceof BindingAnnotationTypePattern) { | ||||
List l = new ArrayList(); | |||||
l.add(annotationTypePattern); | |||||
List<BindingPattern> l = new ArrayList<BindingPattern>(); | |||||
l.add((BindingPattern)annotationTypePattern); | |||||
return l; | return l; | ||||
} else { | } else { | ||||
return Collections.EMPTY_LIST; | |||||
return Collections.emptyList(); | |||||
} | } | ||||
} | } | ||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | * @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | ||||
*/ | */ | ||||
@Override | @Override | ||||
public List getBindingTypePatterns() { | |||||
return Collections.EMPTY_LIST; | |||||
public List<BindingTypePattern> getBindingTypePatterns() { | |||||
return Collections.emptyList(); | |||||
} | } | ||||
/* | /* |
import org.aspectj.weaver.ast.Test; | import org.aspectj.weaver.ast.Test; | ||||
import org.aspectj.weaver.ast.Var; | import org.aspectj.weaver.ast.Var; | ||||
// | |||||
/** | /** | ||||
* Corresponds to target or this pcd. | * Corresponds to target or this pcd. | ||||
* | * | ||||
} | } | ||||
@Override | @Override | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis, typePattern.parameterizeWith(typeVariableMap, w)); | ThisOrTargetPointcut ret = new ThisOrTargetPointcut(isThis, typePattern.parameterizeWith(typeVariableMap, w)); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); | ||||
return ret; | return ret; | ||||
typePattern.postRead(enclosingType); | typePattern.postRead(enclosingType); | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | |||||
*/ | |||||
@Override | @Override | ||||
public List getBindingAnnotationTypePatterns() { | |||||
return Collections.EMPTY_LIST; | |||||
public List<BindingPattern> getBindingAnnotationTypePatterns() { | |||||
return Collections.emptyList(); | |||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | |||||
*/ | |||||
@Override | @Override | ||||
public List getBindingTypePatterns() { | |||||
public List<BindingTypePattern> getBindingTypePatterns() { | |||||
if (typePattern instanceof BindingTypePattern) { | if (typePattern instanceof BindingTypePattern) { | ||||
List l = new ArrayList(); | |||||
l.add(typePattern); | |||||
List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); | |||||
l.add((BindingTypePattern)typePattern); | |||||
return l; | return l; | ||||
} else { | } else { | ||||
return Collections.EMPTY_LIST; | |||||
return Collections.emptyList(); | |||||
} | } | ||||
} | } | ||||
return this; | return this; | ||||
} | } | ||||
public ThrowsPattern parameterizeWith(Map/* name -> resolved type */typeVariableMap, World w) { | |||||
public ThrowsPattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
ThrowsPattern ret = new ThrowsPattern(required.parameterizeWith(typeVariableMap, w), forbidden.parameterizeWith( | ThrowsPattern ret = new ThrowsPattern(required.parameterizeWith(typeVariableMap, w), forbidden.parameterizeWith( | ||||
typeVariableMap, w)); | typeVariableMap, w)); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); |
import org.aspectj.weaver.CompressingDataOutputStream; | import org.aspectj.weaver.CompressingDataOutputStream; | ||||
import org.aspectj.weaver.ISourceContext; | import org.aspectj.weaver.ISourceContext; | ||||
import org.aspectj.weaver.ResolvedType; | import org.aspectj.weaver.ResolvedType; | ||||
import org.aspectj.weaver.UnresolvedType; | |||||
import org.aspectj.weaver.VersionedDataInputStream; | import org.aspectj.weaver.VersionedDataInputStream; | ||||
import org.aspectj.weaver.World; | import org.aspectj.weaver.World; | ||||
} | } | ||||
@Override | @Override | ||||
public TypePattern parameterizeWith(Map typeVariableMap, World w) { | |||||
public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
return this; | return this; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public TypePatternList(List l) { | |||||
public TypePatternList(List<TypePattern> l) { | |||||
this((TypePattern[]) l.toArray(new TypePattern[l.size()])); | this((TypePattern[]) l.toArray(new TypePattern[l.size()])); | ||||
} | } | ||||
* @param typeVariableMap | * @param typeVariableMap | ||||
* @return | * @return | ||||
*/ | */ | ||||
public TypePatternList parameterizeWith(Map typeVariableMap, World w) { | |||||
public TypePatternList parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
TypePattern[] parameterizedPatterns = new TypePattern[typePatterns.length]; | TypePattern[] parameterizedPatterns = new TypePattern[typePatterns.length]; | ||||
for (int i = 0; i < parameterizedPatterns.length; i++) { | for (int i = 0; i < parameterizedPatterns.length; i++) { | ||||
parameterizedPatterns[i] = typePatterns[i].parameterizeWith(typeVariableMap, w); | parameterizedPatterns[i] = typePatterns[i].parameterizeWith(typeVariableMap, w); |
public class TypePatternQuestions { | public class TypePatternQuestions { | ||||
private Map questionsAndAnswers = new HashMap(); | |||||
private Map<Question,FuzzyBoolean> questionsAndAnswers = new HashMap<Question,FuzzyBoolean>(); | |||||
public FuzzyBoolean askQuestion(TypePattern pattern, ResolvedType type, | public FuzzyBoolean askQuestion(TypePattern pattern, ResolvedType type, | ||||
TypePattern.MatchKind kind) | TypePattern.MatchKind kind) | ||||
} | } | ||||
public Question anyChanges() { | public Question anyChanges() { | ||||
for (Iterator i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) { | |||||
Map.Entry entry = (Map.Entry)i.next(); | |||||
for (Iterator<Map.Entry<Question,FuzzyBoolean>> i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) { | |||||
Map.Entry<Question,FuzzyBoolean> entry = i.next(); | |||||
Question question = (Question)entry.getKey(); | Question question = (Question)entry.getKey(); | ||||
FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue(); | FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue(); | ||||
public String toString() { | public String toString() { | ||||
StringBuffer buf = new StringBuffer(); | StringBuffer buf = new StringBuffer(); | ||||
buf.append("TypePatternQuestions{"); | buf.append("TypePatternQuestions{"); | ||||
for (Iterator i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) { | |||||
Map.Entry entry = (Map.Entry)i.next(); | |||||
for (Map.Entry<Question,FuzzyBoolean> entry: questionsAndAnswers.entrySet()) { | |||||
Question question = (Question)entry.getKey(); | Question question = (Question)entry.getKey(); | ||||
FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue(); | FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue(); | ||||
buf.append(question); | buf.append(question); |
} | } | ||||
@Override | @Override | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
WithinAnnotationPointcut ret = new WithinAnnotationPointcut(this.annotationTypePattern.parameterizeWith(typeVariableMap, w)); | WithinAnnotationPointcut ret = new WithinAnnotationPointcut(this.annotationTypePattern.parameterizeWith(typeVariableMap, w)); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); | ||||
return ret; | return ret; | ||||
return match(shadow).alwaysTrue() ? Literal.TRUE : Literal.FALSE; | return match(shadow).alwaysTrue() ? Literal.TRUE : Literal.FALSE; | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | |||||
*/ | |||||
@Override | @Override | ||||
public List getBindingAnnotationTypePatterns() { | |||||
public List<BindingPattern> getBindingAnnotationTypePatterns() { | |||||
if (annotationTypePattern instanceof BindingAnnotationTypePattern) { | if (annotationTypePattern instanceof BindingAnnotationTypePattern) { | ||||
List l = new ArrayList(); | |||||
l.add(annotationTypePattern); | |||||
List<BindingPattern> l = new ArrayList<BindingPattern>(); | |||||
l.add((BindingPattern)annotationTypePattern); | |||||
return l; | return l; | ||||
} else { | } else { | ||||
return Collections.EMPTY_LIST; | |||||
return Collections.emptyList(); | |||||
} | } | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | |||||
*/ | |||||
@Override | @Override | ||||
public List getBindingTypePatterns() { | |||||
return Collections.EMPTY_LIST; | |||||
public List<BindingTypePattern> getBindingTypePatterns() { | |||||
return Collections.emptyList(); | |||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream) | |||||
*/ | |||||
@Override | @Override | ||||
public void write(CompressingDataOutputStream s) throws IOException { | public void write(CompressingDataOutputStream s) throws IOException { | ||||
s.writeByte(Pointcut.ATWITHIN); | s.writeByte(Pointcut.ATWITHIN); |
return matchedShadowKinds; | return matchedShadowKinds; | ||||
} | } | ||||
public Pointcut parameterizeWith(Map typeVariableMap, World w) { | |||||
public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { | |||||
WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern) this.annotationTypePattern | WithinCodeAnnotationPointcut ret = new WithinCodeAnnotationPointcut((ExactAnnotationTypePattern) this.annotationTypePattern | ||||
.parameterizeWith(typeVariableMap, w)); | .parameterizeWith(typeVariableMap, w)); | ||||
ret.copyLocationFrom(this); | ret.copyLocationFrom(this); | ||||
} | } | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingAnnotationTypePatterns() | |||||
*/ | |||||
public List getBindingAnnotationTypePatterns() { | |||||
public List<BindingPattern> getBindingAnnotationTypePatterns() { | |||||
if (annotationTypePattern instanceof BindingAnnotationTypePattern) { | if (annotationTypePattern instanceof BindingAnnotationTypePattern) { | ||||
List l = new ArrayList(); | |||||
l.add(annotationTypePattern); | |||||
List<BindingPattern> l = new ArrayList<BindingPattern>(); | |||||
l.add((BindingPattern)annotationTypePattern); | |||||
return l; | return l; | ||||
} else { | } else { | ||||
return Collections.EMPTY_LIST; | |||||
return Collections.emptyList(); | |||||
} | } | ||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.NameBindingPointcut#getBindingTypePatterns() | |||||
*/ | |||||
public List getBindingTypePatterns() { | |||||
return Collections.EMPTY_LIST; | |||||
public List<BindingTypePattern> getBindingTypePatterns() { | |||||
return Collections.emptyList(); | |||||
} | } | ||||
/* | |||||
* (non-Javadoc) | |||||
* | |||||
* @see org.aspectj.weaver.patterns.PatternNode#write(java.io.DataOutputStream) | |||||
*/ | |||||
public void write(CompressingDataOutputStream s) throws IOException { | public void write(CompressingDataOutputStream s) throws IOException { | ||||
s.writeByte(Pointcut.ATWITHINCODE); | s.writeByte(Pointcut.ATWITHINCODE); | ||||
annotationTypePattern.write(s); | annotationTypePattern.write(s); |
protected Commandline vmcmd; | protected Commandline vmcmd; | ||||
private Path sourcepath; | private Path sourcepath; | ||||
private File destdir; | private File destdir; | ||||
private Collection sourcefiles; | |||||
private Collection packagenames; | |||||
private Collection<String> sourcefiles; | |||||
private Collection<String> packagenames; | |||||
private File packageList; | private File packageList; | ||||
private Path bootclasspath; | private Path bootclasspath; | ||||
private Path extdirs; | private Path extdirs; | ||||
private Path classpath; | private Path classpath; | ||||
private Path internalclasspath; | private Path internalclasspath; | ||||
private List argfiles; | |||||
private List<File> argfiles; | |||||
private Path docletpath; | private Path docletpath; | ||||
private Collection links; | |||||
private Collection groups; | |||||
private Collection<Link> links; | |||||
private Collection<Group> groups; | |||||
private Doclet doclet; | private Doclet doclet; | ||||
private boolean failonerror; | private boolean failonerror; | ||||
private boolean fork; | private boolean fork; | ||||
private String source; | private String source; | ||||
private Html bottom; | private Html bottom; | ||||
private Vector fileSets = new Vector(); | |||||
private Vector<FileSet> fileSets = new Vector<FileSet>(); | |||||
/** reset all to initial values - permit gc if Ajdoc is held */ | /** reset all to initial values - permit gc if Ajdoc is held */ | ||||
public Ajdoc() { | public Ajdoc() { | ||||
reset(); | reset(); | ||||
internalclasspath = null; | internalclasspath = null; | ||||
argfiles = null; | argfiles = null; | ||||
docletpath = null; | docletpath = null; | ||||
links = new ArrayList(); | |||||
groups = new ArrayList(); | |||||
links = new ArrayList<Link>(); | |||||
groups = new ArrayList<Group>(); | |||||
doclet = null; | doclet = null; | ||||
failonerror = false; | failonerror = false; | ||||
fork = false; | fork = false; | ||||
private void addFileSets() { | private void addFileSets() { | ||||
if(sourcefiles == null) | if(sourcefiles == null) | ||||
sourcefiles = new ArrayList(); | |||||
sourcefiles = new ArrayList<String>(); | |||||
Enumeration e = fileSets.elements(); | |||||
Enumeration<FileSet> e = fileSets.elements(); | |||||
while (e.hasMoreElements()) { | while (e.hasMoreElements()) { | ||||
FileSet fs = (FileSet) e.nextElement(); | FileSet fs = (FileSet) e.nextElement(); | ||||
if (!fs.hasPatterns() && !fs.hasSelectors()) { | if (!fs.hasPatterns() && !fs.hasSelectors()) { | ||||
public void setPackagenames(String list) { | public void setPackagenames(String list) { | ||||
(packagenames == null ? | (packagenames == null ? | ||||
packagenames = new ArrayList() : | |||||
packagenames = new ArrayList<String>() : | |||||
packagenames).addAll(strings(list, true)); | packagenames).addAll(strings(list, true)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public List createArgfiles() { | |||||
public List<File> createArgfiles() { | |||||
return (argfiles == null ? | return (argfiles == null ? | ||||
argfiles = new ArrayList() : | |||||
argfiles = new ArrayList<File>() : | |||||
argfiles); | argfiles); | ||||
} | } | ||||
public class Group { | public class Group { | ||||
private String title; | private String title; | ||||
private List packages; | |||||
private List<String> packages; | |||||
public Group() {} | public Group() {} | ||||
public void setTitle(String title) { | public void setTitle(String title) { | ||||
this.title = title; | this.title = title; | ||||
public class Doclet { | public class Doclet { | ||||
protected String name; | protected String name; | ||||
protected Path path; | protected Path path; | ||||
protected List params = new ArrayList(); | |||||
protected List<Param> params = new ArrayList<Param>(); | |||||
public Doclet() {} | public Doclet() {} | ||||
public void setName(String name) { | public void setName(String name) { | ||||
this.name = name; | this.name = name; | ||||
cmd.createArgument().setValue(getProject().replaceProperties(bottom.getText())); | cmd.createArgument().setValue(getProject().replaceProperties(bottom.getText())); | ||||
} | } | ||||
for (Iterator i = links.iterator(); i.hasNext();) { | |||||
Link link = (Link)i.next(); | |||||
for (Link link: links) { | |||||
if (link.href == null) { | if (link.href == null) { | ||||
throw new BuildException("Link href cannot be null!", getLocation()); | throw new BuildException("Link href cannot be null!", getLocation()); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
Map groupMap = new HashMap(); | |||||
for (Iterator i = groups.iterator(); i.hasNext();) { | |||||
Group group = (Group)i.next(); | |||||
Map<String,List<String>> groupMap = new HashMap<String,List<String>>(); | |||||
for (Group group: groups) { | |||||
if (group.title == null) { | if (group.title == null) { | ||||
throw new BuildException("Group names cannot be null!", | throw new BuildException("Group names cannot be null!", | ||||
getLocation()); | getLocation()); | ||||
throw new BuildException("Group packages cannot be null!", | throw new BuildException("Group packages cannot be null!", | ||||
getLocation()); | getLocation()); | ||||
} | } | ||||
List packages = (List)groupMap.get(group.title); | |||||
List<String> packages = groupMap.get(group.title); | |||||
if (packages == null) { | if (packages == null) { | ||||
packages = new ArrayList(); | |||||
packages = new ArrayList<String>(); | |||||
} | } | ||||
packages.addAll(group.packages); | packages.addAll(group.packages); | ||||
groupMap.put(group.title, packages); | groupMap.put(group.title, packages); | ||||
} | } | ||||
for (Iterator i = groupMap.keySet().iterator(); i.hasNext();) { | |||||
String title = (String)i.next(); | |||||
List packages = (List)groupMap.get(title); | |||||
for (String title: groupMap.keySet()) { | |||||
List<String> packages = groupMap.get(title); | |||||
String pkgstr = ""; | String pkgstr = ""; | ||||
for (Iterator j = packages.iterator(); j.hasNext();) { | |||||
for (Iterator<String> j = packages.iterator(); j.hasNext();) { | |||||
pkgstr += j.next(); | pkgstr += j.next(); | ||||
if (j.hasNext()) pkgstr += ","; | if (j.hasNext()) pkgstr += ","; | ||||
} | } | ||||
cmd.createArgument().setValue("@" + packageList); | cmd.createArgument().setValue("@" + packageList); | ||||
} | } | ||||
if (null != packagenames) { | if (null != packagenames) { | ||||
for (Iterator i = packagenames.iterator(); i.hasNext();) { | |||||
for (Iterator<String> i = packagenames.iterator(); i.hasNext();) { | |||||
cmd.createArgument().setValue((String)i.next()); | cmd.createArgument().setValue((String)i.next()); | ||||
} | } | ||||
} | } | ||||
addFileSets(); | addFileSets(); | ||||
if (sourcefiles != null) { | if (sourcefiles != null) { | ||||
for (Iterator i = sourcefiles.iterator(); i.hasNext();) { | |||||
for (Iterator<String> i = sourcefiles.iterator(); i.hasNext();) { | |||||
// let ajdoc resolve sourcefiles relative to sourcepath, | // let ajdoc resolve sourcefiles relative to sourcepath, | ||||
cmd.createArgument().setValue((String)i.next()); | |||||
cmd.createArgument().setValue(i.next()); | |||||
} | } | ||||
} | } | ||||
// XXX PR682 weak way to report errors - need to refactor | // XXX PR682 weak way to report errors - need to refactor | ||||
} | } | ||||
} | } | ||||
protected interface Mapper { | |||||
public Object map(String str); | |||||
protected interface Mapper<T> { | |||||
public T map(String str); | |||||
} | } | ||||
protected final List list(String str, Mapper mapper) { | |||||
if (str == null) return Collections.EMPTY_LIST; | |||||
List list = new ArrayList(); | |||||
protected final <T> List<T> list(String str, Mapper<T> mapper) { | |||||
if (str == null) return Collections.emptyList(); | |||||
List<T> list = new ArrayList<T>(); | |||||
for (StringTokenizer t = new StringTokenizer(str, ",", false); | for (StringTokenizer t = new StringTokenizer(str, ",", false); | ||||
t.hasMoreTokens();) { | t.hasMoreTokens();) { | ||||
list.add(mapper.map(t.nextToken().trim())); | list.add(mapper.map(t.nextToken().trim())); | ||||
return list; | return list; | ||||
} | } | ||||
protected final List files(String str) { | |||||
return list(str, new Mapper() { | |||||
public Object map(String s) { | |||||
protected final List<File> files(String str) { | |||||
return list(str, new Mapper<File>() { | |||||
public File map(String s) { | |||||
return getProject().resolveFile(s); | return getProject().resolveFile(s); | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
protected final List strings(String str) { | |||||
protected final List<String> strings(String str) { | |||||
return strings(str, false); | return strings(str, false); | ||||
} | } | ||||
protected final List strings(String str, final boolean filterSlashes) { | |||||
return list(str, new Mapper() { | |||||
public Object map(String s) { | |||||
protected final List<String> strings(String str, final boolean filterSlashes) { | |||||
return list(str, new Mapper<String>() { | |||||
public String map(String s) { | |||||
return filterSlashes ? filterSlashes(s) : s; | return filterSlashes ? filterSlashes(s) : s; | ||||
} | } | ||||
}); | }); |
import java.lang.reflect.Modifier; | import java.lang.reflect.Modifier; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Collection; | |||||
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.Comparator; | import java.util.Comparator; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Set; | import java.util.Set; | ||||
import org.aspectj.apache.bcel.Constants; | import org.aspectj.apache.bcel.Constants; | ||||
import org.aspectj.apache.bcel.classfile.Attribute; | |||||
import org.aspectj.apache.bcel.classfile.BootstrapMethods; | import org.aspectj.apache.bcel.classfile.BootstrapMethods; | ||||
import org.aspectj.apache.bcel.classfile.ConstantInvokeDynamic; | |||||
import org.aspectj.apache.bcel.classfile.ConstantMethodHandle; | |||||
import org.aspectj.apache.bcel.classfile.ConstantMethodref; | |||||
import org.aspectj.apache.bcel.classfile.ConstantPool; | import org.aspectj.apache.bcel.classfile.ConstantPool; | ||||
import org.aspectj.apache.bcel.classfile.Method; | import org.aspectj.apache.bcel.classfile.Method; | ||||
import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; | import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; | ||||
import org.aspectj.apache.bcel.generic.InstructionList; | import org.aspectj.apache.bcel.generic.InstructionList; | ||||
import org.aspectj.apache.bcel.generic.InstructionSelect; | import org.aspectj.apache.bcel.generic.InstructionSelect; | ||||
import org.aspectj.apache.bcel.generic.InstructionTargeter; | import org.aspectj.apache.bcel.generic.InstructionTargeter; | ||||
import org.aspectj.apache.bcel.generic.InvokeDynamic; | |||||
import org.aspectj.apache.bcel.generic.InvokeInstruction; | import org.aspectj.apache.bcel.generic.InvokeInstruction; | ||||
import org.aspectj.apache.bcel.generic.LineNumberTag; | import org.aspectj.apache.bcel.generic.LineNumberTag; | ||||
import org.aspectj.apache.bcel.generic.LocalVariableTag; | import org.aspectj.apache.bcel.generic.LocalVariableTag; | ||||
import org.aspectj.weaver.IClassWeaver; | import org.aspectj.weaver.IClassWeaver; | ||||
import org.aspectj.weaver.IntMap; | import org.aspectj.weaver.IntMap; | ||||
import org.aspectj.weaver.Member; | import org.aspectj.weaver.Member; | ||||
import org.aspectj.weaver.MemberKind; | |||||
import org.aspectj.weaver.MissingResolvedTypeWithKnownSignature; | import org.aspectj.weaver.MissingResolvedTypeWithKnownSignature; | ||||
import org.aspectj.weaver.NameMangler; | import org.aspectj.weaver.NameMangler; | ||||
import org.aspectj.weaver.NewConstructorTypeMunger; | import org.aspectj.weaver.NewConstructorTypeMunger; |