<project xmlns="http://maven.apache.org/POM/4.0.0" | <project xmlns="http://maven.apache.org/POM/4.0.0" | ||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
<parent> | |||||
<groupId>org.aspectj</groupId> | |||||
<artifactId>aspectj-parent</artifactId> | |||||
<version>1.9.3.BUILD-SNAPSHOT</version> | |||||
<relativePath>..</relativePath> | |||||
</parent> | |||||
<parent> | |||||
<groupId>org.aspectj</groupId> | |||||
<artifactId>aspectj-parent</artifactId> | |||||
<version>1.9.3.BUILD-SNAPSHOT</version> | |||||
<relativePath>..</relativePath> | |||||
</parent> | |||||
<artifactId>runtime</artifactId> | |||||
<packaging>jar</packaging> | |||||
<name>runtime</name> | |||||
<artifactId>runtime</artifactId> | |||||
<packaging>jar</packaging> | |||||
<name>runtime</name> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>org.aspectj</groupId> | |||||
<artifactId>testing-util</artifactId> | |||||
<version>${project.version}</version> | |||||
</dependency> | |||||
</dependencies> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>org.aspectj</groupId> | |||||
<artifactId>testing-util</artifactId> | |||||
<version>${project.version}</version> | |||||
</dependency> | |||||
</dependencies> | |||||
<build> | |||||
<plugins> | |||||
<plugin> | |||||
<groupId>org.apache.maven.plugins</groupId> | |||||
<artifactId>maven-javadoc-plugin</artifactId> | |||||
<version>3.0.1</version> | |||||
<configuration> | |||||
</configuration> | |||||
<executions> | |||||
<execution> | |||||
<id>javadoc</id> | |||||
<phase>package</phase> | |||||
<goals> | |||||
<goal>javadoc</goal> | |||||
</goals> | |||||
<configuration> | |||||
</configuration> | |||||
</execution> | |||||
</executions> | |||||
</plugin> | |||||
</plugins> | |||||
</build> | |||||
</project> | </project> |
return this.declaredITDMethods; | return this.declaredITDMethods; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getITDMethod(java.lang.String, java.lang.Class, java.lang.Class...) | |||||
*/ | |||||
public InterTypeMethodDeclaration getITDMethod(String name, AjType<?> target, | public InterTypeMethodDeclaration getITDMethod(String name, AjType<?> target, | ||||
AjType<?>... parameterTypes) | AjType<?>... parameterTypes) | ||||
throws NoSuchMethodException { | throws NoSuchMethodException { | ||||
throw new NoSuchMethodException(name); | throw new NoSuchMethodException(name); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getITDMethods() | |||||
*/ | |||||
public InterTypeMethodDeclaration[] getITDMethods() { | public InterTypeMethodDeclaration[] getITDMethods() { | ||||
if (this.itdMethods == null) { | if (this.itdMethods == null) { | ||||
List<InterTypeMethodDeclaration> itdms = new ArrayList<InterTypeMethodDeclaration>(); | List<InterTypeMethodDeclaration> itdms = new ArrayList<InterTypeMethodDeclaration>(); | ||||
return; | return; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclaredITDConstructor(java.lang.Class, java.lang.Class...) | |||||
*/ | |||||
public InterTypeConstructorDeclaration getDeclaredITDConstructor( | public InterTypeConstructorDeclaration getDeclaredITDConstructor( | ||||
AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException { | AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException { | ||||
InterTypeConstructorDeclaration[] itdcs = getDeclaredITDConstructors(); | InterTypeConstructorDeclaration[] itdcs = getDeclaredITDConstructors(); | ||||
throw new NoSuchMethodException(); | throw new NoSuchMethodException(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclaredITDConstructors() | |||||
*/ | |||||
public InterTypeConstructorDeclaration[] getDeclaredITDConstructors() { | public InterTypeConstructorDeclaration[] getDeclaredITDConstructors() { | ||||
if (this.declaredITDCons == null) { | if (this.declaredITDCons == null) { | ||||
List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>(); | List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>(); | ||||
return this.declaredITDCons; | return this.declaredITDCons; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getITDConstructor(java.lang.Class, java.lang.Class...) | |||||
*/ | |||||
public InterTypeConstructorDeclaration getITDConstructor(AjType<?> target, | public InterTypeConstructorDeclaration getITDConstructor(AjType<?> target, | ||||
AjType<?>... parameterTypes) throws NoSuchMethodException { | AjType<?>... parameterTypes) throws NoSuchMethodException { | ||||
InterTypeConstructorDeclaration[] itdcs = getITDConstructors(); | InterTypeConstructorDeclaration[] itdcs = getITDConstructors(); | ||||
throw new NoSuchMethodException(); | throw new NoSuchMethodException(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getITDConstructors() | |||||
*/ | |||||
public InterTypeConstructorDeclaration[] getITDConstructors() { | public InterTypeConstructorDeclaration[] getITDConstructors() { | ||||
if (this.itdCons == null) { | if (this.itdCons == null) { | ||||
List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>(); | List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>(); | ||||
} | } | ||||
return this.itdCons; } | return this.itdCons; } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclaredITDField(java.lang.String, java.lang.Class) | |||||
*/ | |||||
public InterTypeFieldDeclaration getDeclaredITDField(String name, | public InterTypeFieldDeclaration getDeclaredITDField(String name, | ||||
AjType<?> target) throws NoSuchFieldException { | AjType<?> target) throws NoSuchFieldException { | ||||
InterTypeFieldDeclaration[] itdfs = getDeclaredITDFields(); | InterTypeFieldDeclaration[] itdfs = getDeclaredITDFields(); | ||||
throw new NoSuchFieldException(name); | throw new NoSuchFieldException(name); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclaredITDFields() | |||||
*/ | |||||
public InterTypeFieldDeclaration[] getDeclaredITDFields() { | public InterTypeFieldDeclaration[] getDeclaredITDFields() { | ||||
List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>(); | List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>(); | ||||
if (this.declaredITDFields == null) { | if (this.declaredITDFields == null) { | ||||
return this.declaredITDFields; | return this.declaredITDFields; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getITDField(java.lang.String, java.lang.Class) | |||||
*/ | |||||
public InterTypeFieldDeclaration getITDField(String name, AjType<?> target) | public InterTypeFieldDeclaration getITDField(String name, AjType<?> target) | ||||
throws NoSuchFieldException { | throws NoSuchFieldException { | ||||
InterTypeFieldDeclaration[] itdfs = getITDFields(); | InterTypeFieldDeclaration[] itdfs = getITDFields(); | ||||
throw new NoSuchFieldException(name); | throw new NoSuchFieldException(name); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getITDFields() | |||||
*/ | |||||
public InterTypeFieldDeclaration[] getITDFields() { | public InterTypeFieldDeclaration[] getITDFields() { | ||||
List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>(); | List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>(); | ||||
if (this.itdFields == null) { | if (this.itdFields == null) { | ||||
return this.itdFields; | return this.itdFields; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclareErrorOrWarnings() | |||||
*/ | |||||
public DeclareErrorOrWarning[] getDeclareErrorOrWarnings() { | public DeclareErrorOrWarning[] getDeclareErrorOrWarnings() { | ||||
List<DeclareErrorOrWarning> deows = new ArrayList<DeclareErrorOrWarning>(); | List<DeclareErrorOrWarning> deows = new ArrayList<DeclareErrorOrWarning>(); | ||||
for (Field field : clazz.getDeclaredFields()) { | for (Field field : clazz.getDeclaredFields()) { | ||||
return ret; | return ret; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclareParents() | |||||
*/ | |||||
public DeclareParents[] getDeclareParents() { | public DeclareParents[] getDeclareParents() { | ||||
List<DeclareParents> decps = new ArrayList<DeclareParents>(); | List<DeclareParents> decps = new ArrayList<DeclareParents>(); | ||||
for (Method method : clazz.getDeclaredMethods()) { | for (Method method : clazz.getDeclaredMethods()) { | ||||
} | } | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclareSofts() | |||||
*/ | |||||
public DeclareSoft[] getDeclareSofts() { | public DeclareSoft[] getDeclareSofts() { | ||||
List<DeclareSoft> decs = new ArrayList<DeclareSoft>(); | List<DeclareSoft> decs = new ArrayList<DeclareSoft>(); | ||||
for (Method method : clazz.getDeclaredMethods()) { | for (Method method : clazz.getDeclaredMethods()) { | ||||
return ret; | return ret; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclareAnnotations() | |||||
*/ | |||||
public DeclareAnnotation[] getDeclareAnnotations() { | public DeclareAnnotation[] getDeclareAnnotations() { | ||||
List<DeclareAnnotation> decAs = new ArrayList<DeclareAnnotation>(); | List<DeclareAnnotation> decAs = new ArrayList<DeclareAnnotation>(); | ||||
for (Method method : clazz.getDeclaredMethods()) { | for (Method method : clazz.getDeclaredMethods()) { | ||||
return ret; | return ret; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getDeclarePrecedence() | |||||
*/ | |||||
public DeclarePrecedence[] getDeclarePrecedence() { | public DeclarePrecedence[] getDeclarePrecedence() { | ||||
List<DeclarePrecedence> decps = new ArrayList<DeclarePrecedence>(); | List<DeclarePrecedence> decps = new ArrayList<DeclarePrecedence>(); | ||||
return ret; | return ret; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getEnumConstants() | |||||
*/ | |||||
public T[] getEnumConstants() { | public T[] getEnumConstants() { | ||||
return clazz.getEnumConstants(); | return clazz.getEnumConstants(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#getTypeParameters() | |||||
*/ | |||||
public TypeVariable<Class<T>>[] getTypeParameters() { | public TypeVariable<Class<T>>[] getTypeParameters() { | ||||
return clazz.getTypeParameters(); | return clazz.getTypeParameters(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isEnum() | |||||
*/ | |||||
public boolean isEnum() { | public boolean isEnum() { | ||||
return clazz.isEnum(); | return clazz.isEnum(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isInstance(java.lang.Object) | |||||
*/ | |||||
public boolean isInstance(Object o) { | public boolean isInstance(Object o) { | ||||
return clazz.isInstance(o); | return clazz.isInstance(o); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isInterface() | |||||
*/ | |||||
public boolean isInterface() { | public boolean isInterface() { | ||||
return clazz.isInterface(); | return clazz.isInterface(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isLocalClass() | |||||
*/ | |||||
public boolean isLocalClass() { | public boolean isLocalClass() { | ||||
return clazz.isLocalClass() && !isAspect(); | return clazz.isLocalClass() && !isAspect(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isMemberClass() | |||||
*/ | |||||
public boolean isMemberClass() { | public boolean isMemberClass() { | ||||
return clazz.isMemberClass() && !isAspect(); | return clazz.isMemberClass() && !isAspect(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isArray() | |||||
*/ | |||||
public boolean isArray() { | public boolean isArray() { | ||||
return clazz.isArray(); | return clazz.isArray(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isPrimitive() | |||||
*/ | |||||
public boolean isPrimitive() { | public boolean isPrimitive() { | ||||
return clazz.isPrimitive(); | return clazz.isPrimitive(); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isAspect() | |||||
*/ | |||||
public boolean isAspect() { | public boolean isAspect() { | ||||
return clazz.getAnnotation(Aspect.class) != null; | return clazz.getAnnotation(Aspect.class) != null; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.AjType#isMemberAspect() | |||||
*/ | |||||
public boolean isMemberAspect() { | public boolean isMemberAspect() { | ||||
return clazz.isMemberClass() && isAspect(); | return clazz.isMemberClass() && isAspect(); | ||||
} | } |
this.annText = annText; | this.annText = annText; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareAnnotation#getDeclaringType() | |||||
*/ | |||||
public AjType<?> getDeclaringType() { | public AjType<?> getDeclaringType() { | ||||
return this.declaringType; | return this.declaringType; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareAnnotation#getKind() | |||||
*/ | |||||
public Kind getKind() { | public Kind getKind() { | ||||
return this.kind; | return this.kind; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareAnnotation#getSignaturePattern() | |||||
*/ | |||||
public SignaturePattern getSignaturePattern() { | public SignaturePattern getSignaturePattern() { | ||||
return this.signaturePattern; | return this.signaturePattern; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareAnnotation#getTypePattern() | |||||
*/ | |||||
public TypePattern getTypePattern() { | public TypePattern getTypePattern() { | ||||
return this.typePattern; | return this.typePattern; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareAnnotation#getAnnotation() | |||||
*/ | |||||
public Annotation getAnnotation() { | public Annotation getAnnotation() { | ||||
return this.theAnnotation; | return this.theAnnotation; | ||||
} | } |
public AjType getDeclaringType() { return this.declaringType; } | public AjType getDeclaringType() { return this.declaringType; } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareErrorOrWarning#getPointcutExpression() | |||||
*/ | |||||
public PointcutExpression getPointcutExpression() { | public PointcutExpression getPointcutExpression() { | ||||
return pc; | return pc; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareErrorOrWarning#getMessage() | |||||
*/ | |||||
public String getMessage() { | public String getMessage() { | ||||
return msg; | return msg; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareErrorOrWarning#isError() | |||||
*/ | |||||
public boolean isError() { | public boolean isError() { | ||||
return isError; | return isError; | ||||
} | } |
private boolean isExtends; | private boolean isExtends; | ||||
private boolean parentsError = false; | private boolean parentsError = false; | ||||
/** | |||||
* Parents arg is a comma-separate list of type names that needs to be turned into | |||||
* AjTypes | |||||
*/ | |||||
// Parents arg is a comma-separate list of type names that needs to be turned into | |||||
// AjTypes | |||||
public DeclareParentsImpl(String targets, String parentsAsString, boolean isExtends, AjType<?> declaring) | public DeclareParentsImpl(String targets, String parentsAsString, boolean isExtends, AjType<?> declaring) | ||||
{ | { | ||||
this.targetTypesPattern = new TypePatternImpl(targets); | this.targetTypesPattern = new TypePatternImpl(targets); | ||||
} | } | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareParents#getDeclaringType() | |||||
*/ | |||||
public AjType getDeclaringType() { | public AjType getDeclaringType() { | ||||
return this.declaringType; | return this.declaringType; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareParents#getTargetTypesPattern() | |||||
*/ | |||||
public TypePattern getTargetTypesPattern() { | public TypePattern getTargetTypesPattern() { | ||||
return this.targetTypesPattern; | return this.targetTypesPattern; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareParents#isExtends() | |||||
*/ | |||||
public boolean isExtends() { | public boolean isExtends() { | ||||
return this.isExtends; | return this.isExtends; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareParents#isImplements() | |||||
*/ | |||||
public boolean isImplements() { | public boolean isImplements() { | ||||
return !this.isExtends; | return !this.isExtends; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareParents#getParentTypes() | |||||
*/ | |||||
public Type[] getParentTypes() throws ClassNotFoundException { | public Type[] getParentTypes() throws ClassNotFoundException { | ||||
if (parentsError) { | if (parentsError) { | ||||
throw new ClassNotFoundException(this.firstMissingTypeName); | throw new ClassNotFoundException(this.firstMissingTypeName); |
} | } | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclarePrecedence#getDeclaringType() | |||||
*/ | |||||
public AjType getDeclaringType() { | public AjType getDeclaringType() { | ||||
return this.declaringType; | return this.declaringType; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclarePrecedence#getPrecedenceOrder() | |||||
*/ | |||||
public TypePattern[] getPrecedenceOrder() { | public TypePattern[] getPrecedenceOrder() { | ||||
return this.precedenceList; | return this.precedenceList; | ||||
} | } |
} | } | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareSoft#getDeclaringType() | |||||
*/ | |||||
public AjType getDeclaringType() { | public AjType getDeclaringType() { | ||||
return this.declaringType; | return this.declaringType; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareSoft#getSoftenedExceptionType() | |||||
*/ | |||||
public AjType getSoftenedExceptionType() throws ClassNotFoundException { | public AjType getSoftenedExceptionType() throws ClassNotFoundException { | ||||
if (this.missingTypeName != null) throw new ClassNotFoundException(this.missingTypeName); | if (this.missingTypeName != null) throw new ClassNotFoundException(this.missingTypeName); | ||||
return this.exceptionType; | return this.exceptionType; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.DeclareSoft#getPointcutExpression() | |||||
*/ | |||||
public PointcutExpression getPointcutExpression() { | public PointcutExpression getPointcutExpression() { | ||||
return this.pointcut; | return this.pointcut; | ||||
} | } |
private Method baseMethod; | private Method baseMethod; | ||||
/** | |||||
* @param decType | |||||
* @param target | |||||
* @param mods | |||||
*/ | |||||
public InterTypeConstructorDeclarationImpl(AjType<?> decType, | public InterTypeConstructorDeclarationImpl(AjType<?> decType, | ||||
String target, int mods, Method baseMethod) { | String target, int mods, Method baseMethod) { | ||||
super(decType, target, mods); | super(decType, target, mods); | ||||
this.baseMethod = baseMethod; | this.baseMethod = baseMethod; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeConstructorDeclaration#getParameters() | |||||
*/ | |||||
public AjType<?>[] getParameterTypes() { | public AjType<?>[] getParameterTypes() { | ||||
Class<?>[] baseTypes = baseMethod.getParameterTypes(); | Class<?>[] baseTypes = baseMethod.getParameterTypes(); | ||||
AjType<?>[] ret = new AjType<?>[baseTypes.length-1]; | AjType<?>[] ret = new AjType<?>[baseTypes.length-1]; | ||||
return ret; | return ret; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeConstructorDeclaration#getGenericParameters() | |||||
*/ | |||||
public Type[] getGenericParameterTypes() { | public Type[] getGenericParameterTypes() { | ||||
Type[] baseTypes = baseMethod.getGenericParameterTypes(); | Type[] baseTypes = baseMethod.getGenericParameterTypes(); | ||||
Type[] ret = new AjType<?>[baseTypes.length-1]; | Type[] ret = new AjType<?>[baseTypes.length-1]; | ||||
return ret; | return ret; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeConstructorDeclaration#getDeclaredExceptionTypes() | |||||
*/ | |||||
public AjType<?>[] getExceptionTypes() { | public AjType<?>[] getExceptionTypes() { | ||||
Class<?>[] baseTypes = baseMethod.getExceptionTypes(); | Class<?>[] baseTypes = baseMethod.getExceptionTypes(); | ||||
AjType<?>[] ret = new AjType<?>[baseTypes.length]; | AjType<?>[] ret = new AjType<?>[baseTypes.length]; |
this.modifiers = mods; | this.modifiers = mods; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeDeclaration#getDeclaringType() | |||||
*/ | |||||
public AjType<?> getDeclaringType() { | public AjType<?> getDeclaringType() { | ||||
return this.declaringType; | return this.declaringType; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeDeclaration#getTargetType() | |||||
*/ | |||||
public AjType<?> getTargetType() throws ClassNotFoundException { | public AjType<?> getTargetType() throws ClassNotFoundException { | ||||
if (this.targetType == null) throw new ClassNotFoundException(this.targetTypeName); | if (this.targetType == null) throw new ClassNotFoundException(this.targetTypeName); | ||||
return this.targetType; | return this.targetType; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeDeclaration#getModifiers() | |||||
*/ | |||||
public int getModifiers() { | public int getModifiers() { | ||||
return this.modifiers; | return this.modifiers; | ||||
} | } |
private AjType<?> type; | private AjType<?> type; | ||||
private Type genericType; | private Type genericType; | ||||
/** | |||||
* @param decType | |||||
* @param target | |||||
* @param mods | |||||
*/ | |||||
public InterTypeFieldDeclarationImpl(AjType<?> decType, String target, | public InterTypeFieldDeclarationImpl(AjType<?> decType, String target, | ||||
int mods, String name, AjType<?> type, Type genericType) { | int mods, String name, AjType<?> type, Type genericType) { | ||||
super(decType, target, mods); | super(decType, target, mods); | ||||
} | } | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeFieldDeclaration#getName() | |||||
*/ | |||||
public String getName() { | public String getName() { | ||||
return this.name; | return this.name; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeFieldDeclaration#getType() | |||||
*/ | |||||
public AjType<?> getType() { | public AjType<?> getType() { | ||||
return this.type; | return this.type; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeFieldDeclaration#getGenericType() | |||||
*/ | |||||
public Type getGenericType() { | public Type getGenericType() { | ||||
return this.genericType; | return this.genericType; | ||||
} | } |
private Type genericReturnType; | private Type genericReturnType; | ||||
private AjType<?>[] exceptionTypes; | private AjType<?>[] exceptionTypes; | ||||
/** | |||||
* @param decType | |||||
* @param target | |||||
* @param mods | |||||
*/ | |||||
public InterTypeMethodDeclarationImpl(AjType<?> decType, String target, | public InterTypeMethodDeclarationImpl(AjType<?> decType, String target, | ||||
int mods, String name, Method itdInterMethod) { | int mods, String name, Method itdInterMethod) { | ||||
super(decType, target, mods); | super(decType, target, mods); | ||||
this.baseMethod = base; | this.baseMethod = base; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeMethodDeclaration#getName() | |||||
*/ | |||||
public String getName() { | public String getName() { | ||||
return this.name; | return this.name; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeMethodDeclaration#getReturnType() | |||||
*/ | |||||
public AjType<?> getReturnType() { | public AjType<?> getReturnType() { | ||||
return AjTypeSystem.getAjType(baseMethod.getReturnType()); | return AjTypeSystem.getAjType(baseMethod.getReturnType()); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeMethodDeclaration#getGenericReturnType() | |||||
*/ | |||||
public Type getGenericReturnType() { | public Type getGenericReturnType() { | ||||
Type gRet = baseMethod.getGenericReturnType(); | Type gRet = baseMethod.getGenericReturnType(); | ||||
if (gRet instanceof Class) { | if (gRet instanceof Class) { | ||||
return gRet; | return gRet; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeMethodDeclaration#getParameters() | |||||
*/ | |||||
public AjType<?>[] getParameterTypes() { | public AjType<?>[] getParameterTypes() { | ||||
Class<?>[] baseTypes = baseMethod.getParameterTypes(); | Class<?>[] baseTypes = baseMethod.getParameterTypes(); | ||||
AjType<?>[] ret = new AjType<?>[baseTypes.length -parameterAdjustmentFactor]; | AjType<?>[] ret = new AjType<?>[baseTypes.length -parameterAdjustmentFactor]; | ||||
return ret; | return ret; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeMethodDeclaration#getGenericParameters() | |||||
*/ | |||||
public Type[] getGenericParameterTypes() { | public Type[] getGenericParameterTypes() { | ||||
Type[] baseTypes = baseMethod.getGenericParameterTypes(); | Type[] baseTypes = baseMethod.getGenericParameterTypes(); | ||||
Type[] ret = new AjType<?>[baseTypes.length-parameterAdjustmentFactor]; | Type[] ret = new AjType<?>[baseTypes.length-parameterAdjustmentFactor]; | ||||
return ret; | return ret; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.InterTypeMethodDeclaration#getTypeParameters() | |||||
*/ | |||||
public TypeVariable<Method>[] getTypeParameters() { | public TypeVariable<Method>[] getTypeParameters() { | ||||
return baseMethod.getTypeParameters(); | return baseMethod.getTypeParameters(); | ||||
} | } |
this.kind = kind; | this.kind = kind; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.PerClause#getKind() | |||||
*/ | |||||
public PerClauseKind getKind() { | public PerClauseKind getKind() { | ||||
return kind; | return kind; | ||||
} | } |
this.sigPattern = pattern; | this.sigPattern = pattern; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.SignaturePattern#asString() | |||||
*/ | |||||
public String asString() { | public String asString() { | ||||
return sigPattern; | return sigPattern; | ||||
} | } |
this.typePattern = new TypePatternImpl(pattern); | this.typePattern = new TypePatternImpl(pattern); | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.TypePatternBasedPerClause#getTypePattern() | |||||
*/ | |||||
public TypePattern getTypePattern() { | public TypePattern getTypePattern() { | ||||
return this.typePattern; | return this.typePattern; | ||||
} | } |
this.typePattern = pattern; | this.typePattern = pattern; | ||||
} | } | ||||
/* (non-Javadoc) | |||||
* @see org.aspectj.lang.reflect.TypePattern#asString() | |||||
*/ | |||||
public String asString() { | public String asString() { | ||||
return this.typePattern; | return this.typePattern; | ||||
} | } |
/** | /** | ||||
* Handles generic aspectOf method when those are not available in the aspects but added later on | * Handles generic aspectOf method when those are not available in the aspects but added later on | ||||
* thru load time weaving. | * thru load time weaving. | ||||
* <p/> | |||||
* Aspects.aspectOf(..) is doing reflective calls to the aspect aspectOf, so for better performance | * Aspects.aspectOf(..) is doing reflective calls to the aspect aspectOf, so for better performance | ||||
* consider using ajc compilation of the aspects and using them as a binary dependancies in your project. | * consider using ajc compilation of the aspects and using them as a binary dependancies in your project. | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
public class Aspects { | public class Aspects { | ||||
private final static String HASASPECT = "hasAspect"; | private final static String HASASPECT = "hasAspect"; | ||||
/** | /** | ||||
* Returns the singleton aspect or the percflow / percflowbelow associated with the current thread | |||||
* | |||||
* @param aspectClass | |||||
* @return | |||||
* @param <T> the expected class of the aspect | |||||
* @param aspectClass the aspect class | |||||
* @return the singleton aspect or the percflow / percflowbelow associated with the current thread | |||||
* @throws NoAspectBoundException if no such aspect | * @throws NoAspectBoundException if no such aspect | ||||
*/ | */ | ||||
public static <T> T aspectOf(Class<T> aspectClass) throws NoAspectBoundException { | public static <T> T aspectOf(Class<T> aspectClass) throws NoAspectBoundException { | ||||
} | } | ||||
/** | /** | ||||
* Returns the perthis / pertarget aspect | |||||
* @param aspectClass | |||||
* @param perObject | |||||
* @return | |||||
* @param <T> the expected class of the aspect | |||||
* @param aspectClass the aspect class | |||||
* @param perObject the this/target object for which to look for an aspect instance | |||||
* @return the associated perthis / pertarget aspect instance | |||||
* @throws NoAspectBoundException if no such aspect, or no aspect bound | * @throws NoAspectBoundException if no such aspect, or no aspect bound | ||||
*/ | */ | ||||
public static <T> T aspectOf(Class<T> aspectClass, Object perObject) throws NoAspectBoundException { | public static <T> T aspectOf(Class<T> aspectClass, Object perObject) throws NoAspectBoundException { | ||||
} | } | ||||
/** | /** | ||||
* Returns the pertypewithin aspect | |||||
* @param aspectClass | |||||
* @param perTypeWithin class | |||||
* @return | |||||
* @param <T> the expected class of the aspect | |||||
* @param aspectClass the aspect class | |||||
* @param perTypeWithin the class for which to search for an aspect instance | |||||
* @return the associated aspect instance | |||||
* @throws NoAspectBoundException if no such aspect, or no aspect bound | * @throws NoAspectBoundException if no such aspect, or no aspect bound | ||||
*/ | */ | ||||
public static <T> T aspectOf(Class<T> aspectClass, Class<?> perTypeWithin) throws NoAspectBoundException { | public static <T> T aspectOf(Class<T> aspectClass, Class<?> perTypeWithin) throws NoAspectBoundException { | ||||
} | } | ||||
/** | /** | ||||
* Returns true if singleton aspect or percflow / percflowbelow aspect is bound | |||||
* | |||||
* @param aspectClass | |||||
* @return | |||||
* @param aspectClass the aspect class | |||||
* @return true if singleton aspect or percflow / percflowbelow aspect is bound | |||||
* @throws NoAspectBoundException if not bound | * @throws NoAspectBoundException if not bound | ||||
*/ | */ | ||||
public static boolean hasAspect(Class<?> aspectClass) throws NoAspectBoundException { | public static boolean hasAspect(Class<?> aspectClass) throws NoAspectBoundException { | ||||
} | } | ||||
/** | /** | ||||
* Returns true if the perthis / pertarget aspect is bound | |||||
* @param aspectClass | |||||
* @param perObject | |||||
* @return | |||||
* @param aspectClass the aspect class | |||||
* @param perObject the this/target object for which to look for an aspect instance | |||||
* @return true if the perthis / pertarget aspect is bound | |||||
* @throws NoAspectBoundException if not bound | * @throws NoAspectBoundException if not bound | ||||
*/ | */ | ||||
public static boolean hasAspect(Class<?> aspectClass, Object perObject) throws NoAspectBoundException { | public static boolean hasAspect(Class<?> aspectClass, Object perObject) throws NoAspectBoundException { | ||||
} | } | ||||
/** | /** | ||||
* Returns true if the pertypewithin aspect is bound | |||||
* @param aspectClass | |||||
* @param aspectClass the aspect class | |||||
* @param perTypeWithin class | * @param perTypeWithin class | ||||
* @return | |||||
* @return true if the pertypewithin aspect is bound | |||||
* @throws NoAspectBoundException if not bound | * @throws NoAspectBoundException if not bound | ||||
*/ | */ | ||||
public static boolean hasAspect(Class<?> aspectClass, Class<?> perTypeWithin) throws NoAspectBoundException { | public static boolean hasAspect(Class<?> aspectClass, Class<?> perTypeWithin) throws NoAspectBoundException { |
* For users working on a level of Java prior to Java5, Aspects14 handles generic aspectOf methods when they | * For users working on a level of Java prior to Java5, Aspects14 handles generic aspectOf methods when they | ||||
* are not available in the aspects but added later on through load time weaving. Users on Java5 should use | * are not available in the aspects but added later on through load time weaving. Users on Java5 should use | ||||
* the class Aspects instead. | * the class Aspects instead. | ||||
* <p/> | |||||
* Aspects14.aspectOf(..) is doing reflective calls to the aspect aspectOf, so for better performance | * Aspects14.aspectOf(..) is doing reflective calls to the aspect aspectOf, so for better performance | ||||
* consider using ajc compilation of the aspects and using them as a binary dependancies in your project. | * consider using ajc compilation of the aspects and using them as a binary dependancies in your project. | ||||
*/ | */ | ||||
* Returns the pertypewithin aspect | * Returns the pertypewithin aspect | ||||
* @param aspectClass aspect class for which to discover the aspect instance | * @param aspectClass aspect class for which to discover the aspect instance | ||||
* @param perTypeWithin class | * @param perTypeWithin class | ||||
* @return | |||||
* @return the aspect instance | |||||
* @throws NoAspectBoundException if no such aspect, or no aspect bound | * @throws NoAspectBoundException if no such aspect, or no aspect bound | ||||
*/ | */ | ||||
public static Object aspectOf(Class aspectClass, Class perTypeWithin) throws NoAspectBoundException { | public static Object aspectOf(Class aspectClass, Class perTypeWithin) throws NoAspectBoundException { | ||||
* Returns true if singleton aspect or percflow / percflowbelow aspect is bound | * Returns true if singleton aspect or percflow / percflowbelow aspect is bound | ||||
* | * | ||||
* @param aspectClass aspect class for which to check the aspect instance | * @param aspectClass aspect class for which to check the aspect instance | ||||
* @return | |||||
* @return true if an aspect instance is bound | |||||
* @throws NoAspectBoundException if not bound | * @throws NoAspectBoundException if not bound | ||||
*/ | */ | ||||
public static boolean hasAspect(Class aspectClass) throws NoAspectBoundException { | public static boolean hasAspect(Class aspectClass) throws NoAspectBoundException { | ||||
/** | /** | ||||
* Returns true if the perthis / pertarget aspect is bound | * Returns true if the perthis / pertarget aspect is bound | ||||
* @param aspectClass aspect class for which to check the aspect instance | * @param aspectClass aspect class for which to check the aspect instance | ||||
* @param perObject | |||||
* @param perObject the this/target for which to check for an aspect | |||||
* @return true if aspect instance exists for the class/object combination | * @return true if aspect instance exists for the class/object combination | ||||
* @throws NoAspectBoundException if not bound | * @throws NoAspectBoundException if not bound | ||||
*/ | */ |
* | * | ||||
* <pre> | * <pre> | ||||
* aspect Logging { | * aspect Logging { | ||||
* before(): within(com.bigboxco..*) && execution(public * *(..)) { | |||||
* before(): within(com.bigboxco..*) && execution(public * *(..)) { | |||||
* System.err.println("entering: " + thisJoinPoint); | * System.err.println("entering: " + thisJoinPoint); | ||||
* System.err.println(" w/args: " + thisJoinPoint.getArgs()); | * System.err.println(" w/args: " + thisJoinPoint.getArgs()); | ||||
* System.err.println(" at: " + thisJoinPoint.getSourceLocation()); | * System.err.println(" at: " + thisJoinPoint.getSourceLocation()); | ||||
String toString(); | String toString(); | ||||
/** | /** | ||||
* Returns an abbreviated string representation of the join point. | |||||
* @return an abbreviated string representation of the join point. | |||||
*/ | */ | ||||
String toShortString(); | String toShortString(); | ||||
/** | /** | ||||
* Returns an extended string representation of the join point. | |||||
* @return an extended string representation of the join point. | |||||
*/ | */ | ||||
String toLongString(); | String toLongString(); | ||||
* | * | ||||
* <p> Returns null when there is no currently executing object available. | * <p> Returns null when there is no currently executing object available. | ||||
* This includes all join points that occur in a static context.</p> | * This includes all join points that occur in a static context.</p> | ||||
* | |||||
* @return the currently executing object (or null if not available - e.g. static context) | |||||
*/ | */ | ||||
Object getThis(); | Object getThis(); | ||||
/** | /** | ||||
* <p> Returns the target object. This will always be | |||||
* Returns the target object. This will always be | |||||
* the same object as that matched by the <code>target</code> pointcut | * the same object as that matched by the <code>target</code> pointcut | ||||
* designator. Unless you specifically need this reflective access, | * designator. Unless you specifically need this reflective access, | ||||
* you should use the <code>target</code> pointcut designator to | * you should use the <code>target</code> pointcut designator to | ||||
* get at this object for better static typing and performance.</p> | |||||
* get at this object for better static typing and performance. | |||||
* | * | ||||
* <p> Returns null when there is no target object.</p> | |||||
* Returns null when there is no target object | |||||
* | |||||
* @return the target object (or null if there isn't one) | |||||
*/ | */ | ||||
Object getTarget(); | Object getTarget(); | ||||
/** | /** | ||||
* <p>Returns the arguments at this join point.</p> | |||||
* @return the arguments at this join point | |||||
*/ | */ | ||||
Object[] getArgs(); | Object[] getArgs(); | ||||
/** Returns the signature at the join point. | |||||
* | |||||
/** | |||||
* <code>getStaticPart().getSignature()</code> returns the same object | * <code>getStaticPart().getSignature()</code> returns the same object | ||||
* @return the signature at the join point. | |||||
*/ | */ | ||||
Signature getSignature(); | Signature getSignature(); | ||||
/** <p>Returns the source location corresponding to the join point.</p> | |||||
/** | |||||
* | * | ||||
* <p>If there is no source location available, returns null.</p> | * <p>If there is no source location available, returns null.</p> | ||||
* | * | ||||
* <p>Returns the SourceLocation of the defining class for default constructors.</p> | * <p>Returns the SourceLocation of the defining class for default constructors.</p> | ||||
* | * | ||||
* <p> <code>getStaticPart().getSourceLocation()</code> returns the same object. </p> | * <p> <code>getStaticPart().getSourceLocation()</code> returns the same object. </p> | ||||
* | |||||
* @return the source location corresponding to the join point. | |||||
*/ | */ | ||||
SourceLocation getSourceLocation(); | SourceLocation getSourceLocation(); | ||||
/** Returns a String representing the kind of join point. This | |||||
* String is guaranteed to be | |||||
* interned. <code>getStaticPart().getKind()</code> returns | |||||
* the same object. | |||||
/** This string is guaranteed to be interned. | |||||
* <code>getStaticPart().getKind()</code> returns the same object. | |||||
* | |||||
* @return a string representing the kind of join point. | |||||
*/ | */ | ||||
String getKind(); | String getKind(); | ||||
* @see JoinPoint#getStaticPart() | * @see JoinPoint#getStaticPart() | ||||
*/ | */ | ||||
public interface StaticPart { | public interface StaticPart { | ||||
/** Returns the signature at the join point. */ | |||||
/** @return the signature at the join point. */ | |||||
Signature getSignature(); | Signature getSignature(); | ||||
/** <p>Returns the source location corresponding to the join point.</p> | |||||
/** Returns the source location corresponding to the join point. | |||||
* | * | ||||
* <p>If there is no source location available, returns null.</p> | |||||
* If there is no source location available, returns null. | |||||
* | * | ||||
* <p>Returns the SourceLocation of the defining class for default constructors.</p> | |||||
* @return the SourceLocation of the defining class for default constructors | |||||
*/ | */ | ||||
SourceLocation getSourceLocation(); | SourceLocation getSourceLocation(); | ||||
/** <p> Returns a String representing the kind of join point. This String | |||||
* is guaranteed to be interned</p> | |||||
/** @return a string representing the kind of join point. This String | |||||
* is guaranteed to be interned | |||||
*/ | */ | ||||
String getKind(); | String getKind(); | ||||
String toString(); | String toString(); | ||||
/** | /** | ||||
* Returns an abbreviated string representation of the join point | |||||
* @return an abbreviated string representation of the join point | |||||
*/ | */ | ||||
String toShortString(); | String toShortString(); | ||||
/** | /** | ||||
* Returns an extended string representation of the join point | |||||
* @return an extended string representation of the join point | |||||
*/ | */ | ||||
String toLongString(); | String toLongString(); | ||||
} | } | ||||
public interface EnclosingStaticPart extends StaticPart {} | public interface EnclosingStaticPart extends StaticPart {} | ||||
/** | /** | ||||
* Returns an object that encapsulates the static parts of this join point. | |||||
* @return an object that encapsulates the static parts of this join point. | |||||
*/ | */ | ||||
StaticPart getStaticPart(); | StaticPart getStaticPart(); | ||||
/** | /** | ||||
* ProceedingJoinPoint exposes the proceed(..) method in order to support around advice in @AJ aspects | * ProceedingJoinPoint exposes the proceed(..) method in order to support around advice in @AJ aspects | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
public interface ProceedingJoinPoint extends JoinPoint { | public interface ProceedingJoinPoint extends JoinPoint { | ||||
/** | /** | ||||
* The joinpoint needs to know about its closure so that proceed can delegate to closure.run() | |||||
* <p/> | |||||
* The joinpoint needs to know about its closure so that proceed can delegate to closure.run(). | |||||
* This internal method should not be called directly, and won't be visible to the end-user when | * This internal method should not be called directly, and won't be visible to the end-user when | ||||
* packed in a jar (synthetic method) | |||||
* packed in a jar (synthetic method). | |||||
* | * | ||||
* @param arc | |||||
* @param arc the around closure to associate with this joinpoint | |||||
*/ | */ | ||||
void set$AroundClosure(AroundClosure arc); | void set$AroundClosure(AroundClosure arc); | ||||
/** | /** | ||||
* Proceed with the next advice or target method invocation | * Proceed with the next advice or target method invocation | ||||
* | * | ||||
* @return | |||||
* @throws Throwable | |||||
* @return the result of proceeding | |||||
* @throws Throwable if the invoked proceed throws anything | |||||
*/ | */ | ||||
public Object proceed() throws Throwable; | public Object proceed() throws Throwable; | ||||
/** | /** | ||||
* Proceed with the next advice or target method invocation | |||||
* <p/> | |||||
* <p>Unlike code style, proceed(..) in annotation style places different requirements on the | |||||
* Proceed with the next advice or target method invocation. | |||||
* | |||||
* Unlike code style, proceed(..) in annotation style places different requirements on the | |||||
* parameters passed to it. The proceed(..) call takes, in this order: | * parameters passed to it. The proceed(..) call takes, in this order: | ||||
* <ul> | * <ul> | ||||
* <li> If 'this()' was used in the pointcut for binding, it must be passed first in proceed(..). | * <li> If 'this()' was used in the pointcut for binding, it must be passed first in proceed(..). | ||||
* if a subset of arguments were bound or the ordering was changed in the advice signature, | * if a subset of arguments were bound or the ordering was changed in the advice signature, | ||||
* the proceed(..) calls takes all of them in the right order for the join point. | * the proceed(..) calls takes all of them in the right order for the join point. | ||||
* </ul> | * </ul> | ||||
* <p>Since proceed(..) in this case takes an Object array, AspectJ cannot do as much | |||||
* Since proceed(..) in this case takes an Object array, AspectJ cannot do as much | |||||
* compile time checking as it can for code style. If the rules above aren't obeyed | * compile time checking as it can for code style. If the rules above aren't obeyed | ||||
* then it will unfortunately manifest as a runtime error. | * then it will unfortunately manifest as a runtime error. | ||||
* </p> | |||||
* | * | ||||
* @param args | |||||
* @return | |||||
* @throws Throwable | |||||
* @param args the arguments to proceed with | |||||
* @return the result of proceeding | |||||
* @throws Throwable if the invoked proceed throws anything | |||||
*/ | */ | ||||
public Object proceed(Object[] args) throws Throwable; | public Object proceed(Object[] args) throws Throwable; | ||||
* aspect Logging { | * aspect Logging { | ||||
* Logger logger = Logger.getLogger("MethodEntries"); | * Logger logger = Logger.getLogger("MethodEntries"); | ||||
* | * | ||||
* before(): within(com.bigboxco..*) && execution(public * *(..)) { | |||||
* before(): within(com.bigboxco..*) && execution(public * *(..)) { | |||||
* Signature sig = thisJoinPoint.getSignature(); | * Signature sig = thisJoinPoint.getSignature(); | ||||
* logger.entering(sig.getDeclaringType().getName(), | * logger.entering(sig.getDeclaringType().getName(), | ||||
* sig.getName()); | * sig.getName()); | ||||
*/ | */ | ||||
public interface Signature { | public interface Signature { | ||||
String toString(); | String toString(); | ||||
/** | /** | ||||
* Returns an abbreviated string representation of this signature. | |||||
* @return an abbreviated string representation of this signature. | |||||
*/ | */ | ||||
String toShortString(); | String toShortString(); | ||||
/** | /** | ||||
* Returns an extended string representation of this signature. | |||||
* @return an extended string representation of this signature. | |||||
*/ | */ | ||||
String toLongString(); | String toLongString(); | ||||
/** | /** | ||||
* Returns the identifier part of this signature. For methods this | |||||
* @return the identifier part of this signature. For methods this | |||||
* will return the method name. | * will return the method name. | ||||
* | * | ||||
* @see java.lang.reflect.Member#getName | * @see java.lang.reflect.Member#getName | ||||
* java.lang.reflect.Modifier.toString(sig.getModifiers()); | * java.lang.reflect.Modifier.toString(sig.getModifiers()); | ||||
* </pre> | * </pre> | ||||
* | * | ||||
* @return the modifiers on this signature represented as an int | |||||
* @see java.lang.reflect.Member#getModifiers | * @see java.lang.reflect.Member#getModifiers | ||||
* @see java.lang.reflect.Modifier | * @see java.lang.reflect.Modifier | ||||
*/ | */ | ||||
* <p>For consistency with <code>java.lang.reflect.Member</code>, this | * <p>For consistency with <code>java.lang.reflect.Member</code>, this | ||||
* method should have been named <code>getDeclaringClass()</code>.</p> | * method should have been named <code>getDeclaringClass()</code>.</p> | ||||
* | * | ||||
* @return the class, interface or aspect that declared this member | |||||
* @see java.lang.reflect.Member#getDeclaringClass | * @see java.lang.reflect.Member#getDeclaringClass | ||||
*/ | */ | ||||
Class getDeclaringType(); | Class getDeclaringType(); | ||||
/** | /** | ||||
* Returns the fully-qualified name of the declaring type. This is | |||||
* equivalent to calling getDeclaringType().getName(), but caches | |||||
* This is equivalent to calling getDeclaringType().getName(), but caches | |||||
* the result for greater efficiency. | * the result for greater efficiency. | ||||
* | |||||
* @return the fully qualified name of the declaring type | |||||
*/ | */ | ||||
String getDeclaringTypeName(); | String getDeclaringTypeName(); | ||||
} | } |
public @interface AdviceName { | public @interface AdviceName { | ||||
/** | /** | ||||
* The name of the advice | |||||
* @return the name of the advice | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
} | } |
/** | /** | ||||
* After finally advice | * After finally advice | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target(ElementType.METHOD) | @Target(ElementType.METHOD) | ||||
public @interface After { | public @interface After { | ||||
/** | /** | ||||
* The pointcut expression where to bind the advice | |||||
* @return the pointcut expression where to bind the advice | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
* Under these circumstances only, it is necessary to provide the arg names in | * Under these circumstances only, it is necessary to provide the arg names in | ||||
* the annotation - these MUST duplicate the names used in the annotated method. | * the annotation - these MUST duplicate the names used in the annotated method. | ||||
* Format is a simple comma-separated list. | * Format is a simple comma-separated list. | ||||
* | |||||
* @return the argument names (should duplicate the names used for the annotated method parameters) | |||||
*/ | */ | ||||
String argNames() default ""; | String argNames() default ""; | ||||
} | } |
/** | /** | ||||
* After returning advice | * After returning advice | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target(ElementType.METHOD) | @Target(ElementType.METHOD) | ||||
public @interface AfterReturning { | public @interface AfterReturning { | ||||
/** | /** | ||||
* The pointcut expression where to bind the advice | |||||
* @return the pointcut expression where to bind the advice | |||||
*/ | */ | ||||
String value() default ""; | String value() default ""; | ||||
/** | /** | ||||
* The pointcut expression where to bind the advice, overrides "value" when specified | |||||
* @return the pointcut expression where to bind the advice, overrides "value" when specified | |||||
*/ | */ | ||||
String pointcut() default ""; | String pointcut() default ""; | ||||
/** | /** | ||||
* The name of the argument in the advice signature to bind the returned value to | |||||
* @return the name of the argument in the advice signature to bind the returned value to | |||||
*/ | */ | ||||
String returning() default ""; | String returning() default ""; | ||||
* Under these circumstances only, it is necessary to provide the arg names in | * Under these circumstances only, it is necessary to provide the arg names in | ||||
* the annotation - these MUST duplicate the names used in the annotated method. | * the annotation - these MUST duplicate the names used in the annotated method. | ||||
* Format is a simple comma-separated list. | * Format is a simple comma-separated list. | ||||
* @return the argument names (that should match names used in the annotated method) | |||||
*/ | */ | ||||
String argNames() default ""; | String argNames() default ""; | ||||
/** | /** | ||||
* After throwing advice | * After throwing advice | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target(ElementType.METHOD) | @Target(ElementType.METHOD) | ||||
public @interface AfterThrowing { | public @interface AfterThrowing { | ||||
/** | /** | ||||
* The pointcut expression where to bind the advice | |||||
* @return the pointcut expression where to bind the advice | |||||
*/ | */ | ||||
String value() default ""; | String value() default ""; | ||||
/** | /** | ||||
* The pointcut expression where to bind the advice, overrides "value" when specified | |||||
* @return the pointcut expression where to bind the advice, overrides "value" when specified | |||||
*/ | */ | ||||
String pointcut() default ""; | String pointcut() default ""; | ||||
/** | /** | ||||
* The name of the argument in the advice signature to bind the thrown exception to | |||||
* @return the name of the argument in the advice signature to bind the thrown exception to | |||||
*/ | */ | ||||
String throwing() default ""; | String throwing() default ""; | ||||
* Under these circumstances only, it is necessary to provide the arg names in | * Under these circumstances only, it is necessary to provide the arg names in | ||||
* the annotation - these MUST duplicate the names used in the annotated method. | * the annotation - these MUST duplicate the names used in the annotated method. | ||||
* Format is a simple comma-separated list. | * Format is a simple comma-separated list. | ||||
* @return the argument names (that should match names used in the annotated method) | |||||
*/ | */ | ||||
String argNames() default ""; | String argNames() default ""; | ||||
/** | /** | ||||
* Around advice | * Around advice | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target(ElementType.METHOD) | @Target(ElementType.METHOD) | ||||
public @interface Around { | public @interface Around { | ||||
/** | /** | ||||
* The pointcut expression where to bind the advice | |||||
* @return the pointcut expression where to bind the advice | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
* Under these circumstances only, it is necessary to provide the arg names in | * Under these circumstances only, it is necessary to provide the arg names in | ||||
* the annotation - these MUST duplicate the names used in the annotated method. | * the annotation - these MUST duplicate the names used in the annotated method. | ||||
* Format is a simple comma-separated list. | * Format is a simple comma-separated list. | ||||
* @return the argument names (should match the names on the annotated method) | |||||
*/ | */ | ||||
String argNames() default ""; | String argNames() default ""; | ||||
/** | /** | ||||
* Aspect declaration | * Aspect declaration | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target(ElementType.TYPE) | @Target(ElementType.TYPE) | ||||
public @interface Aspect { | public @interface Aspect { | ||||
/** | /** | ||||
* Per clause expression, defaults to singleton aspect | |||||
* <p/> | |||||
* @return the per clause expression, defaults to singleton aspect. | |||||
* Valid values are "" (singleton), "perthis(...)", etc | * Valid values are "" (singleton), "perthis(...)", etc | ||||
*/ | */ | ||||
public String value() default ""; | public String value() default ""; |
/** | /** | ||||
* Before advice | * Before advice | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target(ElementType.METHOD) | @Target(ElementType.METHOD) | ||||
public @interface Before { | public @interface Before { | ||||
/** | /** | ||||
* The pointcut expression where to bind the advice | |||||
* @return the pointcut expression where to bind the advice | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
* Under these circumstances only, it is necessary to provide the arg names in | * Under these circumstances only, it is necessary to provide the arg names in | ||||
* the annotation - these MUST duplicate the names used in the annotated method. | * the annotation - these MUST duplicate the names used in the annotated method. | ||||
* Format is a simple comma-separated list. | * Format is a simple comma-separated list. | ||||
* | |||||
* @return the argument names (should match the annotated method parameter names) | |||||
*/ | */ | ||||
String argNames() default ""; | String argNames() default ""; | ||||
import java.lang.annotation.ElementType; | import java.lang.annotation.ElementType; | ||||
/** | /** | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) | @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) | ||||
public @interface DeclareAnnotation { | public @interface DeclareAnnotation { | ||||
/** | /** | ||||
* pointcut (type pattern for type, or method/ctor/field signature pattern) | |||||
* @return the pointcut (type pattern for type, or method/ctor/field signature pattern) | |||||
*/ | */ | ||||
public String value(); | public String value(); | ||||
@Target(ElementType.FIELD) | @Target(ElementType.FIELD) | ||||
public @interface DeclareError { | public @interface DeclareError { | ||||
/** | /** | ||||
* The pointcut expression where to bind the error (don't use if, formal bindings, cflow etc) | |||||
* @return the pointcut expression where to bind the error (don't use if, formal bindings, cflow etc) | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
} | } |
/** | /** | ||||
* DeclareMixin annotation - see design and usage in https://bugs.eclipse.org/bugs/show_bug.cgi?id=266552 | * DeclareMixin annotation - see design and usage in https://bugs.eclipse.org/bugs/show_bug.cgi?id=266552 | ||||
* | |||||
* <p> | * <p> | ||||
* Attached to a factory method, this annotation indicates that any types matching the pattern specified in the annotation value | * Attached to a factory method, this annotation indicates that any types matching the pattern specified in the annotation value | ||||
* will have new methods mixed in. The methods will be selected based on a combination of the return type of the factory method, | * will have new methods mixed in. The methods will be selected based on a combination of the return type of the factory method, | ||||
public @interface DeclareMixin { | public @interface DeclareMixin { | ||||
/** | /** | ||||
* The target types expression | |||||
* @return the target types expression | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
/** | /** | ||||
* Array of interfaces that are to be mixed in. This is optional and if not specified the return type of the annotated method | |||||
* @return array of interfaces that are to be mixed in. This is optional and if not specified the return type of the annotated method | |||||
* will be used to determine the interface to mix in. | * will be used to determine the interface to mix in. | ||||
*/ | */ | ||||
Class[] interfaces() default { Object.class }; | Class[] interfaces() default { Object.class }; |
public @interface DeclareParents { | public @interface DeclareParents { | ||||
/** | /** | ||||
* The target types expression | |||||
* @return the target types expression | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
* of interface members (equivalent to defining | * of interface members (equivalent to defining | ||||
* a set of interface member ITDs for the | * a set of interface member ITDs for the | ||||
* public methods of the interface). | * public methods of the interface). | ||||
* | |||||
* @return define the default implementation of interface members (should always be specified) | |||||
*/ | */ | ||||
Class defaultImpl() default DeclareParents.class; | Class defaultImpl() default DeclareParents.class; | ||||
/** | /** | ||||
* Aspect precedence declaration | * Aspect precedence declaration | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target(ElementType.TYPE) | @Target(ElementType.TYPE) | ||||
public @interface DeclarePrecedence { | public @interface DeclarePrecedence { | ||||
/** | /** | ||||
* The precedence pattern list | |||||
* @return the precedence pattern list | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
@Target(ElementType.FIELD) | @Target(ElementType.FIELD) | ||||
public @interface DeclareWarning { | public @interface DeclareWarning { | ||||
/** | /** | ||||
* The pointcut expression where to bind the error (don't use if, formal bindings, cflow etc) | |||||
* @return the pointcut expression where to bind the error (don't use if, formal bindings, cflow etc) | |||||
*/ | */ | ||||
String value(); | String value(); | ||||
} | } |
/** | /** | ||||
* Pointcut declaration | * Pointcut declaration | ||||
* | * | ||||
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> | |||||
* @author Alexandre Vasseur | |||||
*/ | */ | ||||
@Retention(RetentionPolicy.RUNTIME) | @Retention(RetentionPolicy.RUNTIME) | ||||
@Target(ElementType.METHOD) | @Target(ElementType.METHOD) | ||||
public @interface Pointcut { | public @interface Pointcut { | ||||
/** | /** | ||||
* The pointcut expression | |||||
* @return the pointcut expression | |||||
* We allow "" as default for abstract pointcut | * We allow "" as default for abstract pointcut | ||||
*/ | */ | ||||
String value() default ""; | String value() default ""; | ||||
* Under these circumstances only, it is necessary to provide the arg names in | * Under these circumstances only, it is necessary to provide the arg names in | ||||
* the annotation - these MUST duplicate the names used in the annotated method. | * the annotation - these MUST duplicate the names used in the annotated method. | ||||
* Format is a simple comma-separated list. | * Format is a simple comma-separated list. | ||||
* | |||||
* @return argNames the argument names (should match those in the annotated method) | |||||
*/ | */ | ||||
String argNames() default ""; | String argNames() default ""; | ||||
} | } |
public @interface CodeGenerationHint { | public @interface CodeGenerationHint { | ||||
/** | /** | ||||
* Defines the name suffix to use for a generated member representing an if pointcut (prefix will be 'ajc$if$'). | |||||
* @return the name suffix to use for a generated member representing an if pointcut (prefix will be 'ajc$if$'). | |||||
* If left blank, a suffix will be generated. | * If left blank, a suffix will be generated. | ||||
*/ | */ | ||||
String ifNameSuffix() default ""; | String ifNameSuffix() default ""; |
public interface Advice { | public interface Advice { | ||||
/** | /** | ||||
* The declaring aspect | |||||
* @return the declaring aspect | |||||
*/ | */ | ||||
AjType getDeclaringType(); | AjType getDeclaringType(); | ||||
/** | /** | ||||
* The kind of advice (before, after-returning, after-throwing, etc.) | |||||
* @return the kind of advice (before, after-returning, after-throwing, etc.) | |||||
*/ | */ | ||||
AdviceKind getKind(); | AdviceKind getKind(); | ||||
/** | /** | ||||
* Returns the advice name, or the empty string if the advice is anonymous. | |||||
* If using the @AspectJ annotations, the advice name is the name of the | * If using the @AspectJ annotations, the advice name is the name of the | ||||
* annotated advice method. If using the code style, the advice is | * annotated advice method. If using the code style, the advice is | ||||
* anonymous, unless the advice is annotated with the @AdviceName annotation, | * anonymous, unless the advice is annotated with the @AdviceName annotation, | ||||
* in which case the name given in the annotation is returned. | |||||
* in which case the name given in the annotation is returned. | |||||
* | |||||
* @return the advice name, or the empty string if the advice is anonymous. | |||||
*/ | */ | ||||
String getName(); | String getName(); | ||||
/** | /** | ||||
* The advice parameters | |||||
* @return the advice parameters | |||||
*/ | */ | ||||
AjType<?>[] getParameterTypes(); | AjType<?>[] getParameterTypes(); | ||||
/** | /** | ||||
* The generic parameter types, @see java.lang.reflect.Method.getGenericParameterTypes | |||||
* @return the generic parameter types, @see java.lang.reflect.Method.getGenericParameterTypes | |||||
*/ | */ | ||||
Type[] getGenericParameterTypes(); | Type[] getGenericParameterTypes(); | ||||
/** | /** | ||||
* The declared thrown exceptions by the advice | |||||
* @return the declared thrown exceptions by the advice | |||||
*/ | */ | ||||
AjType<?>[] getExceptionTypes(); | AjType<?>[] getExceptionTypes(); | ||||
/** | /** | ||||
* The pointcut expression associated with the advice declaration. | |||||
* @return the pointcut expression associated with the advice declaration. | |||||
*/ | */ | ||||
PointcutExpression getPointcutExpression(); | PointcutExpression getPointcutExpression(); | ||||
} | } |
public interface AjType<T> extends Type, AnnotatedElement { | public interface AjType<T> extends Type, AnnotatedElement { | ||||
/** | /** | ||||
* The name of this type, in the same format as returned by Class.getName() | |||||
* @return the name of this type, in the same format as returned by Class.getName() | |||||
*/ | */ | ||||
public String getName(); | public String getName(); | ||||
/** | /** | ||||
* The package in which this type is declared | |||||
* @return the package in which this type is declared | |||||
*/ | */ | ||||
public Package getPackage(); | public Package getPackage(); | ||||
/** | /** | ||||
* The interfaces implemented by this type | |||||
* @return the interfaces implemented by this type | |||||
*/ | */ | ||||
public AjType<?>[] getInterfaces(); | public AjType<?>[] getInterfaces(); | ||||
/** | /** | ||||
* The modifiers declared for this type. The return value can be interpreted | |||||
* @return the modifiers declared for this type. The return value can be interpreted | |||||
* using java.lang.reflect.Modifier | * using java.lang.reflect.Modifier | ||||
*/ | */ | ||||
public int getModifiers(); | public int getModifiers(); | ||||
/** | /** | ||||
* The java.lang.Class that corresponds to this AjType | |||||
* @return the java.lang.Class that corresponds to this AjType | |||||
*/ | */ | ||||
public Class<T> getJavaClass(); | public Class<T> getJavaClass(); | ||||
// scope | // scope | ||||
/** | /** | ||||
* The supertype of this type. If this type represents Object or a primitive type | |||||
* @return the supertype of this type. If this type represents Object or a primitive type | |||||
* then null is returned. | * then null is returned. | ||||
*/ | */ | ||||
public AjType<?> getSupertype(); | public AjType<?> getSupertype(); | ||||
/** | /** | ||||
* The generic supertype of this type, as defined by Class.getGenericSupertype | |||||
* @return the generic supertype of this type, as defined by Class.getGenericSupertype | |||||
*/ | */ | ||||
public Type getGenericSupertype(); | public Type getGenericSupertype(); | ||||
/** | /** | ||||
* If this type represents a local or anonymous type declared within a method, return | |||||
* then enclosing Method object. | |||||
* @return the enclosing Method if this type represents a local or anonymous type declared within a method | |||||
*/ | */ | ||||
public Method getEnclosingMethod(); | public Method getEnclosingMethod(); | ||||
/** | /** | ||||
* If this type represents a local or anonymous type declared within a constructor, return | |||||
* then enclosing Method object. | |||||
* @return the enclosing Method if this type represents a local or anonymous type declared within a constructor | |||||
*/ | */ | ||||
public Constructor getEnclosingConstructor(); | public Constructor getEnclosingConstructor(); | ||||
/** | /** | ||||
* Returns the immediately enclosing type of this type. | |||||
* @return the immediately enclosing type of this type. | |||||
*/ | */ | ||||
public AjType<?> getEnclosingType(); | public AjType<?> getEnclosingType(); | ||||
/** | /** | ||||
* If this type is a member of another type, return the AjType representing the type | |||||
* in which it was declared. | |||||
* @return the AjType representing the typei n which it was declared (if this type is a member of another type) | |||||
*/ | */ | ||||
public AjType<?> getDeclaringType(); | public AjType<?> getDeclaringType(); | ||||
/** | /** | ||||
* If this type represents an aspect, returns the associated per-clause. | |||||
* Returns null for non-aspect types. | |||||
* @return the per-clause if this is an aspect, otherwise null | |||||
*/ | */ | ||||
public PerClause getPerClause(); | public PerClause getPerClause(); | ||||
// inner types | // inner types | ||||
/** | /** | ||||
* Returns an array containing all the public types that are members of this type | |||||
* @return an array containing all the public types that are members of this type | |||||
*/ | */ | ||||
public AjType<?>[] getAjTypes(); | public AjType<?>[] getAjTypes(); | ||||
/** | /** | ||||
* Returns an array containing all the types declared by this type | |||||
* @return an array containing all the types declared by this type | |||||
*/ | */ | ||||
public AjType<?>[] getDeclaredAjTypes(); | public AjType<?>[] getDeclaredAjTypes(); | ||||
// constructors | // constructors | ||||
/** | /** | ||||
* Returns the constructor object for the specified public constructor of this type | |||||
* @param parameterTypes the types of the constructor parameters | |||||
* @return the constructor object for the specified public constructor of this type | |||||
* @throws NoSuchMethodException if constructor not found | |||||
*/ | */ | ||||
public Constructor getConstructor(AjType<?>... parameterTypes) throws NoSuchMethodException; | public Constructor getConstructor(AjType<?>... parameterTypes) throws NoSuchMethodException; | ||||
/** | /** | ||||
* Returns all of the public constructors of this type | |||||
* @return all of the public constructors of this type | |||||
*/ | */ | ||||
public Constructor[] getConstructors(); | public Constructor[] getConstructors(); | ||||
/** | /** | ||||
* Returns the constructor object for the specified constructor of this type | |||||
* @param parameterTypes the types of the constructor parameters | |||||
* @return the constructor object for the specified constructor of this type | |||||
* @throws NoSuchMethodException if constructor not found | |||||
*/ | */ | ||||
public Constructor getDeclaredConstructor(AjType<?>... parameterTypes) throws NoSuchMethodException; | public Constructor getDeclaredConstructor(AjType<?>... parameterTypes) throws NoSuchMethodException; | ||||
/** | /** | ||||
* Returns all the constructors declared in this type | |||||
* @return all the constructors declared in this type | |||||
*/ | */ | ||||
public Constructor[] getDeclaredConstructors(); | public Constructor[] getDeclaredConstructors(); | ||||
// fields | // fields | ||||
/** | /** | ||||
* Return the field declared in this type with the given name | |||||
* @param name the field name | |||||
* @return the declared field | |||||
* @throws NoSuchFieldException if no field of that name is found | |||||
*/ | */ | ||||
public Field getDeclaredField(String name) throws NoSuchFieldException; | public Field getDeclaredField(String name) throws NoSuchFieldException; | ||||
/** | /** | ||||
* Returns all the fields declared in this type | |||||
* @return all the fields declared in this type | |||||
*/ | */ | ||||
public Field[] getDeclaredFields(); | public Field[] getDeclaredFields(); | ||||
/** | /** | ||||
* Return the public field with the given name | |||||
* @param name the field name | |||||
* @return the public field with the given name | |||||
* @throws NoSuchFieldException if field not found | |||||
*/ | */ | ||||
public Field getField(String name) throws NoSuchFieldException; | public Field getField(String name) throws NoSuchFieldException; | ||||
/** | /** | ||||
* Return the public fields declared by this type | |||||
* @return the public fields declared by this type | |||||
*/ | */ | ||||
public Field[] getFields(); | public Field[] getFields(); | ||||
// methods | // methods | ||||
/** | /** | ||||
* Return the method object for the specified method declared in this type | |||||
* @param name the method name | |||||
* @param parameterTypes the types of the method parameters | |||||
* @return the method object for the specified method declared in this type | |||||
* @throws NoSuchMethodException if the method cannot be found | |||||
*/ | */ | ||||
public Method getDeclaredMethod(String name, AjType<?>... parameterTypes) throws NoSuchMethodException; | public Method getDeclaredMethod(String name, AjType<?>... parameterTypes) throws NoSuchMethodException; | ||||
/** | /** | ||||
* Return the method object for the specified public method declared in this type | |||||
* @param name the method name | |||||
* @param parameterTypes the types of the method parameters | |||||
* @return the method object for the specified public method declared in this type | |||||
* @throws NoSuchMethodException if the method cannot be found | |||||
*/ | */ | ||||
public Method getMethod(String name, AjType<?>... parameterTypes) throws NoSuchMethodException; | public Method getMethod(String name, AjType<?>... parameterTypes) throws NoSuchMethodException; | ||||
/** | /** | ||||
* Return all the methods declared by this type | |||||
* @return all the methods declared by this type | |||||
*/ | */ | ||||
public Method[] getDeclaredMethods(); | public Method[] getDeclaredMethods(); | ||||
/** | /** | ||||
* Returns all the public methods of this type | |||||
* @return all the public methods of this type | |||||
*/ | */ | ||||
public Method[] getMethods(); | public Method[] getMethods(); | ||||
// pointcuts | // pointcuts | ||||
/** | /** | ||||
* Return the pointcut object representing the specified pointcut declared by this type | |||||
* @param name the pointcut name | |||||
* @return the pointcut object representing the specified pointcut declared by this type | |||||
* @throws NoSuchPointcutException if no pointcut of that name can be found | |||||
*/ | */ | ||||
public Pointcut getDeclaredPointcut(String name) throws NoSuchPointcutException; | public Pointcut getDeclaredPointcut(String name) throws NoSuchPointcutException; | ||||
/** | /** | ||||
* Return the pointcut object representing the specified public pointcut | |||||
* @param name the pointcut name | |||||
* @return the pointcut object representing the specified public pointcut | |||||
* @throws NoSuchPointcutException if no pointcut of that name can be found | |||||
*/ | */ | ||||
public Pointcut getPointcut(String name) throws NoSuchPointcutException; | public Pointcut getPointcut(String name) throws NoSuchPointcutException; | ||||
/** | /** | ||||
* Returns all of the pointcuts declared by this type | |||||
* @return all of the pointcuts declared by this type | |||||
*/ | */ | ||||
public Pointcut[] getDeclaredPointcuts(); | public Pointcut[] getDeclaredPointcuts(); | ||||
/** | /** | ||||
* Returns all of the public pointcuts of this type | |||||
* @return all of the public pointcuts of this type | |||||
*/ | */ | ||||
public Pointcut[] getPointcuts(); | public Pointcut[] getPointcuts(); | ||||
// advice | // advice | ||||
/** | /** | ||||
* Returns all of the advice declared by this type, of an advice kind contained in the | |||||
* @param ofTypes the {@link AdviceKind}s of interest | |||||
* @return all of the advice declared by this type, of an advice kind contained in the | |||||
* parameter list. | * parameter list. | ||||
*/ | */ | ||||
public Advice[] getDeclaredAdvice(AdviceKind... ofTypes); | public Advice[] getDeclaredAdvice(AdviceKind... ofTypes); | ||||
/** | /** | ||||
* Returns all of the advice for this type, of an advice kind contained in the parameter | |||||
* @param ofTypes the {@link AdviceKind}s of interest | |||||
* @return all of the advice for this type, of an advice kind contained in the parameter | |||||
* list. | * list. | ||||
*/ | */ | ||||
public Advice[] getAdvice(AdviceKind... ofTypes); | public Advice[] getAdvice(AdviceKind... ofTypes); | ||||
/** | /** | ||||
* Returns the advice with the given name. For an @AspectJ declared advice member, | |||||
* For an annotation style advice member, | |||||
* this is the name of the annotated method. For a code-style advice declaration, this | * this is the name of the annotated method. For a code-style advice declaration, this | ||||
* is the name given in the @AdviceName annotation if present. | * is the name given in the @AdviceName annotation if present. | ||||
* | |||||
* @param name the advice name | |||||
* @return the advice with the given name. | |||||
* @throws NoSuchAdviceException if no advice can be found with that name | |||||
*/ | */ | ||||
public Advice getAdvice(String name) throws NoSuchAdviceException; | public Advice getAdvice(String name) throws NoSuchAdviceException; | ||||
/** | |||||
* Returns the advice declared in this type with the given name. For an @AspectJ declared advice member, | |||||
/** For an annotation style advice member, | |||||
* this is the name of the annotated method. For a code-style advice declaration, this | * this is the name of the annotated method. For a code-style advice declaration, this | ||||
* is the name given in the @AdviceName annotation if present. | * is the name given in the @AdviceName annotation if present. | ||||
* | |||||
* @param name the advice name | |||||
* @return the advice declared in this type with the given name. | |||||
* @throws NoSuchAdviceException if no advice can be found with that name | |||||
*/ | */ | ||||
public Advice getDeclaredAdvice(String name) throws NoSuchAdviceException; | public Advice getDeclaredAdvice(String name) throws NoSuchAdviceException; | ||||
// inter-type declarations | // inter-type declarations | ||||
/** | /** | ||||
* Return the inter-type method declared by this type matching the given specification | |||||
* @param name the method name | |||||
* @param target the target of the inter-type declaration | |||||
* @param parameterTypes the types of the inter-type method declaration | |||||
* @return the inter-type method declared by this type matching the given specification | |||||
* @throws NoSuchMethodException if the inter-type declaration cannot be found | |||||
*/ | */ | ||||
public InterTypeMethodDeclaration getDeclaredITDMethod(String name, AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException; | public InterTypeMethodDeclaration getDeclaredITDMethod(String name, AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException; | ||||
/** | /** | ||||
* Return all of the inter-type methods declared by this type | |||||
* @return all of the inter-type methods declared by this type | |||||
*/ | */ | ||||
public InterTypeMethodDeclaration[] getDeclaredITDMethods(); | public InterTypeMethodDeclaration[] getDeclaredITDMethods(); | ||||
/** | /** | ||||
* Return the public inter-type method of this type matching the given specification | |||||
* @param name the method name | |||||
* @param target the target of the inter-type declaration | |||||
* @param parameterTypes the types of the inter-type method declaration | |||||
* @return the public inter-type method of this type matching the given specification | |||||
* @throws NoSuchMethodException if the inter-type declaration cannot be found | |||||
*/ | */ | ||||
public InterTypeMethodDeclaration getITDMethod(String name, AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException; | public InterTypeMethodDeclaration getITDMethod(String name, AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException; | ||||
/** | /** | ||||
* Return all of the public inter-type declared methods of this type | |||||
* @return all of the public inter-type declared methods of this type | |||||
*/ | */ | ||||
public InterTypeMethodDeclaration[] getITDMethods(); | public InterTypeMethodDeclaration[] getITDMethods(); | ||||
/** | /** | ||||
* Return the inter-type constructor declared by this type matching the given specification | |||||
* @param target the target of the inter-type constructor of interest | |||||
* @param parameterTypes the types of the parameter of the inter-type constructor of interest | |||||
* @return the inter-type constructor declared by this type matching the given specification | |||||
* @throws NoSuchMethodException if the inter-type declaration cannot be found | |||||
*/ | */ | ||||
public InterTypeConstructorDeclaration getDeclaredITDConstructor(AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException; | public InterTypeConstructorDeclaration getDeclaredITDConstructor(AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException; | ||||
/** | /** | ||||
* Returns all of the inter-type constructors declared by this type | |||||
* @return all of the inter-type constructors declared by this type | |||||
*/ | */ | ||||
public InterTypeConstructorDeclaration[] getDeclaredITDConstructors(); | public InterTypeConstructorDeclaration[] getDeclaredITDConstructors(); | ||||
/** | /** | ||||
* Return the public inter-type constructor matching the given specification | |||||
* @param target the target of the inter-type constructor of interest | |||||
* @param parameterTypes the types of the parameter of the inter-type constructor of interest | |||||
* @return the public inter-type constructor matching the given specification | |||||
* @throws NoSuchMethodException if the inter-type declaration cannot be found | |||||
*/ | */ | ||||
public InterTypeConstructorDeclaration getITDConstructor(AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException; | public InterTypeConstructorDeclaration getITDConstructor(AjType<?> target, AjType<?>... parameterTypes) throws NoSuchMethodException; | ||||
/** | /** | ||||
* Return all of the public inter-type constructors of this type | |||||
* @return all of the public inter-type constructors of this type | |||||
*/ | */ | ||||
public InterTypeConstructorDeclaration[] getITDConstructors(); | public InterTypeConstructorDeclaration[] getITDConstructors(); | ||||
/** | /** | ||||
* Return the inter-type field declared in this type with the given specification | |||||
* @param name the field name | |||||
* @param target the target type for the inter-type declaration | |||||
* @return the inter-type field declared in this type with the given specification | |||||
* @throws NoSuchFieldException if the inter-type declaration cannot be found | |||||
*/ | */ | ||||
public InterTypeFieldDeclaration getDeclaredITDField(String name, AjType<?> target) throws NoSuchFieldException; | public InterTypeFieldDeclaration getDeclaredITDField(String name, AjType<?> target) throws NoSuchFieldException; | ||||
/** | /** | ||||
* Return all of the inter-type fields declared in this type | |||||
* @return all of the inter-type fields declared in this type | |||||
*/ | */ | ||||
public InterTypeFieldDeclaration[] getDeclaredITDFields(); | public InterTypeFieldDeclaration[] getDeclaredITDFields(); | ||||
/** | /** | ||||
* Return the public inter-type field matching the given specification | |||||
* @param name the field name | |||||
* @param target the target type for the inter-type declaration | |||||
* @return the public inter-type field matching the given specification | |||||
* @throws NoSuchFieldException if the inter-type declaration cannot be found | |||||
*/ | */ | ||||
public InterTypeFieldDeclaration getITDField(String name, AjType<?> target) throws NoSuchFieldException; | public InterTypeFieldDeclaration getITDField(String name, AjType<?> target) throws NoSuchFieldException; | ||||
/** | /** | ||||
* Return all of the public inter-type fields for this type | |||||
* @return all of the public inter-type fields for this type | |||||
*/ | */ | ||||
public InterTypeFieldDeclaration[] getITDFields(); | public InterTypeFieldDeclaration[] getITDFields(); | ||||
// declare statements | // declare statements | ||||
/** | /** | ||||
* Returns all of the declare error and declare warning members of this type, | |||||
* @return all of the declare error and declare warning members of this type, | |||||
* including declare error/warning members inherited from super-types | * including declare error/warning members inherited from super-types | ||||
*/ | */ | ||||
public DeclareErrorOrWarning[] getDeclareErrorOrWarnings(); | public DeclareErrorOrWarning[] getDeclareErrorOrWarnings(); | ||||
/** | /** | ||||
* Returns all of the declare parents members of this type, including | |||||
* @return all of the declare parents members of this type, including | |||||
* declare parent members inherited from super-types | * declare parent members inherited from super-types | ||||
*/ | */ | ||||
public DeclareParents[] getDeclareParents(); | public DeclareParents[] getDeclareParents(); | ||||
/** | /** | ||||
* Return all of the declare soft members of this type, including declare | |||||
* @return all of the declare soft members of this type, including declare | |||||
* soft members inherited from super-types | * soft members inherited from super-types | ||||
*/ | */ | ||||
public DeclareSoft[] getDeclareSofts(); | public DeclareSoft[] getDeclareSofts(); | ||||
/** | /** | ||||
* Return all of the declare annotation members of this type, including declare | |||||
* @return all of the declare annotation members of this type, including declare | |||||
* annotation members inherited from super-types | * annotation members inherited from super-types | ||||
*/ | */ | ||||
public DeclareAnnotation[] getDeclareAnnotations(); | public DeclareAnnotation[] getDeclareAnnotations(); | ||||
/** | /** | ||||
* Return all of the declare precedence members of this type, including declare | |||||
* @return all of the declare precedence members of this type, including declare | |||||
* precedence members inherited from super-types | * precedence members inherited from super-types | ||||
*/ | */ | ||||
public DeclarePrecedence[] getDeclarePrecedence(); | public DeclarePrecedence[] getDeclarePrecedence(); | ||||
// misc | // misc | ||||
/** | /** | ||||
* Returns the elements of this enum class, or null if this type does not represent | |||||
* @return the elements of this enum class, or null if this type does not represent | |||||
* an enum type. | * an enum type. | ||||
*/ | */ | ||||
public T[] getEnumConstants(); | public T[] getEnumConstants(); | ||||
/** | /** | ||||
* Returns an array of TypeVariable objects that represent the type variables declared by | |||||
* @return an array of TypeVariable objects that represent the type variables declared by | |||||
* this type (if any) | * this type (if any) | ||||
*/ | */ | ||||
public TypeVariable<Class<T>>[] getTypeParameters(); | public TypeVariable<Class<T>>[] getTypeParameters(); | ||||
/** | /** | ||||
* True if this is an enum type | |||||
* @return true if this is an enum type | |||||
*/ | */ | ||||
public boolean isEnum(); | public boolean isEnum(); | ||||
/** | /** | ||||
* True if the given object is assignment-compatible with an object of the type represented | |||||
* @param o the object to check for assignment compatibility | |||||
* @return true if the given object is assignment-compatible with an object of the type represented | |||||
* by this AjType | * by this AjType | ||||
*/ | */ | ||||
public boolean isInstance(Object o); | public boolean isInstance(Object o); | ||||
/** | /** | ||||
* True if this is an interface type | |||||
* @return true if this is an interface type | |||||
*/ | */ | ||||
public boolean isInterface(); | public boolean isInterface(); | ||||
/** | /** | ||||
* Returns true if and only if the underlying type is a local class | |||||
* @return true if and only if the underlying type is a local class | |||||
*/ | */ | ||||
public boolean isLocalClass(); | public boolean isLocalClass(); | ||||
/** | /** | ||||
* Returns true if and only if the underlying type is a member class | |||||
* @return true if and only if the underlying type is a member class | |||||
*/ | */ | ||||
public boolean isMemberClass(); | public boolean isMemberClass(); | ||||
/** | /** | ||||
* Return true if this is an array type | |||||
* @return true if this is an array type | |||||
*/ | */ | ||||
public boolean isArray(); | public boolean isArray(); | ||||
/** | /** | ||||
* Return true if this object represents a primitive type | |||||
* @return true if this object represents a primitive type | |||||
*/ | */ | ||||
public boolean isPrimitive(); | public boolean isPrimitive(); | ||||
/** | /** | ||||
* Return true if this is an aspect type | |||||
* @return true if this is an aspect type | |||||
*/ | */ | ||||
public boolean isAspect(); | public boolean isAspect(); | ||||
/** | /** | ||||
* Returns true if and only if the underlying type is a member aspect | |||||
* @return true if and only if the underlying type is a member aspect | |||||
*/ | */ | ||||
public boolean isMemberAspect(); | public boolean isMemberAspect(); | ||||
/** | /** | ||||
* Returns true if and only if the underlying type is a privileged aspect | |||||
* @return true if and only if the underlying type is a privileged aspect | |||||
*/ | */ | ||||
public boolean isPrivileged(); | public boolean isPrivileged(); | ||||
/** | /** | ||||
* This is the anchor for the AspectJ runtime type system. | * This is the anchor for the AspectJ runtime type system. | ||||
* Typical usage to get the AjType representation of a given type | * Typical usage to get the AjType representation of a given type | ||||
* at runtime is to call <code>AjType<Foo> fooType = AjTypeSystem.getAjType(Foo.class);</code> | |||||
* at runtime is to call <code>AjType<Foo> fooType = AjTypeSystem.getAjType(Foo.class);</code> | |||||
*/ | */ | ||||
public class AjTypeSystem { | public class AjTypeSystem { | ||||
* and other AspectJ type members. AjType is the recommended reflection API for | * and other AspectJ type members. AjType is the recommended reflection API for | ||||
* AspectJ programs as it offers everything that java.lang.reflect does, with | * AspectJ programs as it offers everything that java.lang.reflect does, with | ||||
* AspectJ-awareness on top. | * AspectJ-awareness on top. | ||||
* @param <T> the expected type associated with the returned AjType | |||||
* @param fromClass the class for which to discover the AjType | |||||
* @return the AjType corresponding to the input class | |||||
*/ | */ | ||||
public static <T> AjType<T> getAjType(Class<T> fromClass) { | public static <T> AjType<T> getAjType(Class<T> fromClass) { | ||||
WeakReference<AjType> weakRefToAjType = ajTypes.get(fromClass); | WeakReference<AjType> weakRefToAjType = ajTypes.get(fromClass); |
public enum Kind { Field, Method, Constructor, Type }; | public enum Kind { Field, Method, Constructor, Type }; | ||||
/** | /** | ||||
* The aspect that declared this member. | |||||
* @return the aspect that declared this member. | |||||
*/ | */ | ||||
AjType<?> getDeclaringType(); | AjType<?> getDeclaringType(); | ||||
/** | /** | ||||
* The target element kind | |||||
* @return the target element kind | |||||
*/ | */ | ||||
Kind getKind(); | Kind getKind(); | ||||
/** | /** | ||||
* The target signature pattern. Returns null if getKind() == Type | |||||
* @return the target signature pattern. Returns null if getKind() == Type | |||||
*/ | */ | ||||
SignaturePattern getSignaturePattern(); | SignaturePattern getSignaturePattern(); | ||||
/** | /** | ||||
* The target type pattern. Returns null if getKind() != Type | |||||
* @return the target type pattern. Returns null if getKind() != Type | |||||
*/ | */ | ||||
TypePattern getTypePattern(); | TypePattern getTypePattern(); | ||||
/** | /** | ||||
* The declared annotation. If the declared annotation does not have runtime retention, | |||||
* @return the declared annotation. If the declared annotation does not have runtime retention, | |||||
* this method returns null. | * this method returns null. | ||||
*/ | */ | ||||
Annotation getAnnotation(); | Annotation getAnnotation(); | ||||
/** | /** | ||||
* Returns the text of the annotation as declared in this member. Available for | |||||
* @return the text of the annotation as declared in this member. Available for | |||||
* both runtime and class-file retention annotations | * both runtime and class-file retention annotations | ||||
*/ | */ | ||||
String getAnnotationAsText(); | String getAnnotationAsText(); |
public interface DeclareErrorOrWarning { | public interface DeclareErrorOrWarning { | ||||
/** | /** | ||||
* The type that declared this declare warning or declare error member. | |||||
* @return the type that declared this declare warning or declare error member. | |||||
*/ | */ | ||||
AjType getDeclaringType(); | AjType getDeclaringType(); | ||||
/** | /** | ||||
* The pointcut expression associated with the warning or error | |||||
* @return the pointcut expression associated with the warning or error | |||||
*/ | */ | ||||
PointcutExpression getPointcutExpression(); | PointcutExpression getPointcutExpression(); | ||||
/** | /** | ||||
* The message associated with the declare warning / declare error | |||||
* @return the message associated with the declare warning / declare error | |||||
*/ | */ | ||||
String getMessage(); | String getMessage(); | ||||
/** | /** | ||||
* True if this is a declare error member, false if it is declare warning | |||||
* @return true if this is a declare error member, false if it is declare warning | |||||
*/ | */ | ||||
boolean isError(); | boolean isError(); | ||||
public interface DeclareParents { | public interface DeclareParents { | ||||
/** | /** | ||||
* The declaring aspect | |||||
* @return the declaring aspect | |||||
*/ | */ | ||||
AjType getDeclaringType(); | AjType getDeclaringType(); | ||||
/** | /** | ||||
* The target type pattern | |||||
* @return the target type pattern | |||||
*/ | */ | ||||
TypePattern getTargetTypesPattern(); | TypePattern getTargetTypesPattern(); | ||||
/** | /** | ||||
* True if this is a declare parents...extends member declaration | |||||
* @return true if this is a declare parents...extends member declaration | |||||
*/ | */ | ||||
boolean isExtends(); | boolean isExtends(); | ||||
/** | /** | ||||
* True if this is a declare parents...implements member declaration | |||||
* @return true if this is a declare parents...implements member declaration | |||||
*/ | */ | ||||
boolean isImplements(); | boolean isImplements(); | ||||
/** | /** | ||||
* The set of types that the types matching getTargetTypesPattern are | |||||
* @return the set of types that the types matching getTargetTypesPattern are | |||||
* declared to implement or extend | * declared to implement or extend | ||||
* @throws ClassNotFoundException if any types cannot be found | |||||
*/ | */ | ||||
Type[] getParentTypes() throws ClassNotFoundException; | Type[] getParentTypes() throws ClassNotFoundException; | ||||
public interface DeclarePrecedence { | public interface DeclarePrecedence { | ||||
/** | /** | ||||
* The declaring aspect | |||||
* @return the declaring aspect | |||||
*/ | */ | ||||
AjType getDeclaringType(); | AjType getDeclaringType(); | ||||
/** | /** | ||||
* Returns an ordered set of type patterns. An aspect matching | |||||
* @return an ordered set of type patterns. An aspect matching | |||||
* a type pattern at a lower index in the array takes precedence | * a type pattern at a lower index in the array takes precedence | ||||
* over an aspect that only matches a type pattern at a higher | * over an aspect that only matches a type pattern at a higher | ||||
* index in the array. | * index in the array. |
public interface DeclareSoft { | public interface DeclareSoft { | ||||
/** | /** | ||||
* The aspect that declared this member | |||||
* @return the aspect that declared this member | |||||
*/ | */ | ||||
AjType getDeclaringType(); | AjType getDeclaringType(); | ||||
/** | /** | ||||
* The softened exception type | |||||
* @return the softened exception type | |||||
* @throws ClassNotFoundException if exception type cannot be found | |||||
*/ | */ | ||||
AjType getSoftenedExceptionType() throws ClassNotFoundException; | AjType getSoftenedExceptionType() throws ClassNotFoundException; | ||||
/** | /** | ||||
* The pointcut determining the join points at which the exception is to be softened. | |||||
* @return the pointcut determining the join points at which the exception is to be softened. | |||||
*/ | */ | ||||
PointcutExpression getPointcutExpression(); | PointcutExpression getPointcutExpression(); | ||||
public interface InterTypeConstructorDeclaration extends InterTypeDeclaration { | public interface InterTypeConstructorDeclaration extends InterTypeDeclaration { | ||||
/** | /** | ||||
* The constructor parameters | |||||
* @return the constructor parameters | |||||
*/ | */ | ||||
AjType<?>[] getParameterTypes(); | AjType<?>[] getParameterTypes(); | ||||
/** | /** | ||||
* The generic constructor parameters | |||||
* @return the generic constructor parameters | |||||
*/ | */ | ||||
Type[] getGenericParameterTypes(); | Type[] getGenericParameterTypes(); | ||||
/** | /** | ||||
* The declared exceptions thrown by this constructor | |||||
* @return the declared exceptions thrown by this constructor | |||||
*/ | */ | ||||
AjType<?>[] getExceptionTypes(); | AjType<?>[] getExceptionTypes(); | ||||
} | } |
public interface InterTypeDeclaration { | public interface InterTypeDeclaration { | ||||
/** | /** | ||||
* The declaring aspect | |||||
* @return the declaring aspect | |||||
*/ | */ | ||||
AjType<?> getDeclaringType(); | AjType<?> getDeclaringType(); | ||||
/** | /** | ||||
* The target type of this ITD | |||||
* @return the target type of this ITD | |||||
* @throws ClassNotFoundException if the type cannot be found | |||||
*/ | */ | ||||
AjType<?> getTargetType() throws ClassNotFoundException; | AjType<?> getTargetType() throws ClassNotFoundException; | ||||
/** | /** | ||||
* Member modifiers, can be interpreted using java.lang.reflect.Modifier | |||||
* @return member modifiers, can be interpreted using java.lang.reflect.Modifier | |||||
*/ | */ | ||||
int getModifiers(); | int getModifiers(); | ||||
} | } |
public interface InterTypeFieldDeclaration extends InterTypeDeclaration { | public interface InterTypeFieldDeclaration extends InterTypeDeclaration { | ||||
/** | /** | ||||
* The field name | |||||
* @return the field name | |||||
*/ | */ | ||||
String getName(); | String getName(); | ||||
/** | /** | ||||
* The field type | |||||
* @return the field type | |||||
*/ | */ | ||||
AjType<?> getType(); | AjType<?> getType(); | ||||
/** | /** | ||||
* The generic field type | |||||
* @return the generic field type | |||||
*/ | */ | ||||
Type getGenericType(); | Type getGenericType(); | ||||
public interface InterTypeMethodDeclaration extends InterTypeDeclaration { | public interface InterTypeMethodDeclaration extends InterTypeDeclaration { | ||||
/** | /** | ||||
* The name of this method | |||||
* @return the name of this method | |||||
*/ | */ | ||||
String getName(); | String getName(); | ||||
/** | /** | ||||
* The method return type | |||||
* @return the method return type | |||||
*/ | */ | ||||
AjType<?> getReturnType(); | AjType<?> getReturnType(); | ||||
/** | /** | ||||
* The generic return type | |||||
* @return the generic return type | |||||
*/ | */ | ||||
Type getGenericReturnType(); | Type getGenericReturnType(); | ||||
/** | /** | ||||
* The method parameters | |||||
* @return the method parameters | |||||
*/ | */ | ||||
AjType<?>[] getParameterTypes(); | AjType<?>[] getParameterTypes(); | ||||
/** | /** | ||||
* The generic method parameters | |||||
* @return the generic method parameters | |||||
*/ | */ | ||||
Type[] getGenericParameterTypes(); | Type[] getGenericParameterTypes(); | ||||
/** | /** | ||||
* The type variables declared by this method | |||||
* @return the type variables declared by this method | |||||
*/ | */ | ||||
TypeVariable<Method>[] getTypeParameters(); | TypeVariable<Method>[] getTypeParameters(); | ||||
/** | /** | ||||
* The declared exceptions thrown by this method | |||||
* @return the declared exceptions thrown by this method | |||||
*/ | */ | ||||
AjType<?>[] getExceptionTypes(); | AjType<?>[] getExceptionTypes(); | ||||
} | } |
} | } | ||||
/** | /** | ||||
* The advice name that could not be found. | |||||
* @return the advice name that could not be found. | |||||
*/ | */ | ||||
public String getName() { | public String getName() { | ||||
return name; | return name; |
} | } | ||||
/** | /** | ||||
* The name of the pointcut that could not be found. | |||||
* @return the name of the pointcut that could not be found. | |||||
*/ | */ | ||||
public String getName() { | public String getName() { | ||||
return name; | return name; |
* AspectJ runtime representation of the per-clause associated with an aspect. | * AspectJ runtime representation of the per-clause associated with an aspect. | ||||
*/ | */ | ||||
public interface PerClause { | public interface PerClause { | ||||
/** | /** | ||||
* The kind of per-clause (singleton, perthis, pertarget,...) | |||||
* @return the kind of per-clause (singleton, perthis, pertarget,...) | |||||
*/ | */ | ||||
PerClauseKind getKind(); | PerClauseKind getKind(); | ||||
public interface Pointcut { | public interface Pointcut { | ||||
/** | /** | ||||
* The declared name of the pointcut. | |||||
* @return the declared name of the pointcut. | |||||
*/ | */ | ||||
String getName(); | String getName(); | ||||
/** | /** | ||||
* The modifiers associated with the pointcut declaration. | |||||
* @return the modifiers associated with the pointcut declaration. | |||||
* Use java.lang.reflect.Modifier to interpret the return value | * Use java.lang.reflect.Modifier to interpret the return value | ||||
*/ | */ | ||||
int getModifiers(); | int getModifiers(); | ||||
/** | /** | ||||
* The pointcut parameter types. | |||||
* @return the pointcut parameter types. | |||||
*/ | */ | ||||
AjType<?>[] getParameterTypes(); | AjType<?>[] getParameterTypes(); | ||||
/** | /** | ||||
* The pointcut parameter names. Returns an array of empty strings | |||||
* @return the pointcut parameter names. Returns an array of empty strings | |||||
* of length getParameterTypes().length if parameter names are not | * of length getParameterTypes().length if parameter names are not | ||||
* available at runtime. | * available at runtime. | ||||
*/ | */ | ||||
String[] getParameterNames(); | String[] getParameterNames(); | ||||
/** | /** | ||||
* The type that declared this pointcut | |||||
* @return the type that declared this pointcut | |||||
*/ | */ | ||||
AjType getDeclaringType(); | AjType getDeclaringType(); | ||||
/** | /** | ||||
* The pointcut expression associated with this pointcut. | |||||
* @return the pointcut expression associated with this pointcut. | |||||
*/ | */ | ||||
PointcutExpression getPointcutExpression(); | PointcutExpression getPointcutExpression(); | ||||
/** | /** | ||||
* Representation of a pointcut based per-clause associated with an aspect | * Representation of a pointcut based per-clause associated with an aspect | ||||
* (perthis/target/cflow/cflowbelow) | * (perthis/target/cflow/cflowbelow) | ||||
* | |||||
*/ | */ | ||||
public interface PointcutBasedPerClause extends PerClause { | public interface PointcutBasedPerClause extends PerClause { | ||||
/** | /** | ||||
* Get the associated pointcut expression | |||||
* @return the associated pointcut expression | |||||
*/ | */ | ||||
PointcutExpression getPointcutExpression(); | PointcutExpression getPointcutExpression(); | ||||
} | } |
public interface PointcutExpression { | public interface PointcutExpression { | ||||
/** | /** | ||||
* Returns a String representation of the pointcut expression | |||||
* @return a string representation of the pointcut expression | |||||
*/ | */ | ||||
String asString(); | String asString(); | ||||
} | } |
*/ | */ | ||||
public interface SignaturePattern { | public interface SignaturePattern { | ||||
/** return a String representation of this pattern */ | |||||
/** @return a string representation of this pattern */ | |||||
String asString(); | String asString(); | ||||
} | } |
/** | /** | ||||
* @deprecated can not be implemented for bytecode weaving, may | * @deprecated can not be implemented for bytecode weaving, may | ||||
* be removed in 1.1gold. | * be removed in 1.1gold. | ||||
* @return the column | |||||
*/ | */ | ||||
int getColumn(); | int getColumn(); | ||||
} | } |
package org.aspectj.lang.reflect; | package org.aspectj.lang.reflect; | ||||
/** | /** | ||||
* AspectJ runtime representation of a type pattern as used in member declarations | |||||
* such as declare parents. | |||||
* AspectJ runtime representation of a type pattern as used in member | |||||
* declarations such as declare parents. | |||||
*/ | */ | ||||
public interface TypePattern { | public interface TypePattern { | ||||
/** a string representation of the pattern */ | |||||
/** | |||||
* @return a string representation of the pattern | |||||
*/ | |||||
String asString(); | String asString(); | ||||
} | } |
public interface TypePatternBasedPerClause { | public interface TypePatternBasedPerClause { | ||||
/** | /** | ||||
* Get the associated type pattern | |||||
* @return the associated type pattern | |||||
*/ | */ | ||||
TypePattern getTypePattern(); | TypePattern getTypePattern(); | ||||
} | } | ||||
/** | /** | ||||
* This takes in the same arguments as are passed to the proceed | |||||
* call in the around advice (with primitives coerced to Object types) | |||||
* @param args the same arguments as passed to the proceed (with primitives coerced to Object types) | |||||
* @return the result of the invocation with those arguments | |||||
* @throws Throwable if underlying invoked code throws an exception | |||||
*/ | */ | ||||
public abstract Object run(Object[] args) throws Throwable; | public abstract Object run(Object[] args) throws Throwable; | ||||
/** | /** | ||||
* This method is called to implicitly associate the closure with the joinpoint | * This method is called to implicitly associate the closure with the joinpoint | ||||
* as required for @AJ aspect proceed() | * as required for @AJ aspect proceed() | ||||
* | |||||
* @return the associated ProceedingJoinPoint | |||||
*/ | */ | ||||
public ProceedingJoinPoint linkClosureAndJoinPoint() { | public ProceedingJoinPoint linkClosureAndJoinPoint() { | ||||
//TODO is this cast safe ? | //TODO is this cast safe ? | ||||
/** | /** | ||||
* This method is called to implicitly associate the closure with the joinpoint | * This method is called to implicitly associate the closure with the joinpoint | ||||
* as required for @AJ aspect proceed() | * as required for @AJ aspect proceed() | ||||
* | |||||
* @param flags indicating whether this/target found at joinpoint and bound | |||||
* @return the associated ProceedingJoinPoint | |||||
*/ | */ | ||||
public ProceedingJoinPoint linkClosureAndJoinPoint(int flags) { | public ProceedingJoinPoint linkClosureAndJoinPoint(int flags) { | ||||
//TODO is this cast safe ? | //TODO is this cast safe ? |
} | } | ||||
} | } | ||||
/** | |||||
* identity function for now. This is not typed to "void" because we happen | |||||
* to know that in Java, any void context (i.e., {@link ExprStmt}) | |||||
* can also handle a return value. | |||||
*/ | |||||
// identity function for now. This is not typed to "void" because we happen | |||||
// to know that in Java, any void context (i.e., {@link ExprStmt}) | |||||
// can also handle a return value. | |||||
public static Object voidValue(Object o) { | public static Object voidValue(Object o) { | ||||
if (o == null) { | if (o == null) { | ||||
return o; | return o; |
} | } | ||||
/** | |||||
* Create a signature and build a JoinPoint in one step. Prior to 1.6.10 this was done as a two step operation in the generated | |||||
* code but merging these methods in the runtime library enables the generated code to be shorter. Generating code that | |||||
* uses this method requires the weaver to be invoked with <tt>-Xset:targetRuntime1_6_10=true</tt>. | |||||
* | |||||
* @since 1.6.10 | |||||
*/ | |||||
// | |||||
// Create a signature and build a JoinPoint in one step. Prior to 1.6.10 this was done as a two step operation in the generated | |||||
// code but merging these methods in the runtime library enables the generated code to be shorter. Generating code that | |||||
// uses this method requires the weaver to be invoked with <tt>-Xset:targetRuntime1_6_10=true</tt>. | |||||
// @since 1.6.10 | |||||
public JoinPoint.StaticPart makeSJP(String kind, String modifiers, String methodName, String declaringType, String paramTypes, | public JoinPoint.StaticPart makeSJP(String kind, String modifiers, String methodName, String declaringType, String paramTypes, | ||||
String paramNames, String exceptionTypes, String returnType, int l) { | String paramNames, String exceptionTypes, String returnType, int l) { | ||||
Signature sig = this.makeMethodSig(modifiers, methodName, declaringType, paramTypes, paramNames, exceptionTypes, returnType); | Signature sig = this.makeMethodSig(modifiers, methodName, declaringType, paramTypes, paramNames, exceptionTypes, returnType); | ||||
return new JoinPointImpl.StaticPartImpl(count++, kind, sig, makeSourceLoc(l, -1)); | return new JoinPointImpl.StaticPartImpl(count++, kind, sig, makeSourceLoc(l, -1)); | ||||
} | } | ||||
/** | |||||
* Create a signature and build a JoinPoint in one step. Prior to 1.6.10 this was done as a two step operation in the generated | |||||
* code but merging these methods in the runtime library enables the generated code to be shorter. Generating code that | |||||
* uses this method requires the weaver to be invoked with <tt>-Xset:targetRuntime1_6_10=true</tt>. | |||||
* <p> | |||||
* This method differs from the previous one in that it includes no exceptionTypes parameter - it is an optimization for the | |||||
* case where there are no exceptions. The generated code won't build an empty string and will not pass it into here. | |||||
* | |||||
* @since 1.6.10 | |||||
*/ | |||||
// Create a signature and build a JoinPoint in one step. Prior to 1.6.10 this was done as a two step operation in the generated | |||||
// code but merging these methods in the runtime library enables the generated code to be shorter. Generating code that | |||||
// uses this method requires the weaver to be invoked with <tt>-Xset:targetRuntime1_6_10=true</tt>. | |||||
// This method differs from the previous one in that it includes no exceptionTypes parameter - it is an optimization for the | |||||
// case where there are no exceptions. The generated code won't build an empty string and will not pass it into here. | |||||
// | |||||
// @since 1.6.10 | |||||
public JoinPoint.StaticPart makeSJP(String kind, String modifiers, String methodName, String declaringType, String paramTypes, | public JoinPoint.StaticPart makeSJP(String kind, String modifiers, String methodName, String declaringType, String paramTypes, | ||||
String paramNames, String returnType, int l) { | String paramNames, String returnType, int l) { | ||||
Signature sig = this.makeMethodSig(modifiers, methodName, declaringType, paramTypes, paramNames, "", returnType); | Signature sig = this.makeMethodSig(modifiers, methodName, declaringType, paramTypes, paramNames, "", returnType); |