return realMember.canBeParameterized();
}
- public int getCallsiteModifiers() {
- return realMember.getCallsiteModifiers();
- }
-
public String getExtractableName() {
return realMember.getExtractableName();
}
import java.util.Collection;
import java.util.Iterator;
+/**
+ * Abstract representation of a member within a type.
+ */
public interface Member extends Comparable {
public static final Member[] NONE = new Member[0];
public UnresolvedType[] getParameterTypes();
-
/**
- * Return full signature, including return type, e.g. "()LFastCar;" for a signature without the return type,
- * use getParameterSignature() - it is importnant to choose the right one in the face of covariance.
+ * Return full signature, including return type, e.g. "()LFastCar;". For a signature without the return type,
+ * use getParameterSignature() - it is important to choose the right one in the face of covariance.
*/
public String getSignature();
- /**
- * All the signatures that a join point with this member as its signature has.
- */
public Iterator getJoinPointSignatures(World world);
public int getArity();
public int getModifiers();
-
public boolean isStatic();
public boolean isInterface();
/**
* Returns true iff the member is generic (NOT parameterized)
- * For example, a method declared in a generic type
*/
public boolean canBeParameterized();
- public int getCallsiteModifiers();
-
public String getExtractableName();
public AnnotationX[] getAnnotations();
public String getSignatureMakerName();
public String getSignatureType();
-
public Collection/* ResolvedType */getDeclaringTypes(World world);
* PARC initial implementation
* ******************************************************************/
-
package org.aspectj.weaver;
import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.List;
-
public class MemberImpl implements Member {
protected MemberKind kind;
- protected String name;
- protected UnresolvedType declaringType;
+
protected int modifiers;
+ protected String name;
protected UnresolvedType returnType;
+ protected UnresolvedType declaringType;
protected UnresolvedType[] parameterTypes;
private final String signature;
private String paramSignature;
* @param signature the JVM bytecode method signature string we want to break apart
* @return a pair of UnresolvedType, UnresolvedType[] representing the return types and parameter types.
*/
+ // OPTIMIZE move static util methods out into a memberutils class
public static String typesToSignature(UnresolvedType returnType, UnresolvedType[] paramTypes, boolean useRawTypes) {
StringBuffer buf = new StringBuffer();
buf.append("(");
public UnresolvedType getGenericReturnType() { return getReturnType(); }
public UnresolvedType[] getGenericParameterTypes() { return getParameterTypes(); }
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getType()
- */
- public UnresolvedType getType() { return returnType; }
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getName()
- */
+ public final UnresolvedType getType() { return returnType; }
public String getName() { return name; }
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getParameterTypes()
- */
public UnresolvedType[] getParameterTypes() { return parameterTypes; }
-
-
+
public String getSignature() { return signature; }
public int getArity() { return parameterTypes.length; }
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getParameterSignature()
- */
public String getParameterSignature() {
if (paramSignature != null) return paramSignature;
StringBuffer sb = new StringBuffer();
return false;
}
- public final int getCallsiteModifiers() {
- return modifiers & ~ Modifier.INTERFACE;
- }
-
public int getModifiers() {
return modifiers;
}
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getExtractableName()
- */
public final String getExtractableName() {
// OPTIMIZE remove silly string compares for init - use kind==CTOR/STATIC_INITIALIZATION
if (name.equals("<init>")) return "init$";
else return name;
}
-
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getAnnotations()
- */
public AnnotationX[] getAnnotations() {
throw new UnsupportedOperationException("You should resolve this member '"+this+"' and call getAnnotations() on the result...");
}
// ---- fields 'n' stuff
-
-
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getDeclaringTypes(org.aspectj.weaver.World)
- */
public Collection/*ResolvedType*/ getDeclaringTypes(World world) {
ResolvedType myType = getDeclaringType().resolve(world);
Collection ret = new HashSet();
}
-
-
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getSignatureType()
- */
public String getSignatureType() {
MemberKind kind = getKind();
if (getName().equals("<clinit>")) return "org.aspectj.lang.reflect.InitializerSignature";
return buf.toString();
}
- /* (non-Javadoc)
- * @see org.aspectj.weaver.Member#getParameterNames(org.aspectj.weaver.World)
- */
public String[] getParameterNames(World world) {
ResolvedMember resolved = resolve(world);
if (resolved == null) {
public UnresolvedType[] getExceptions();
public ShadowMunger getAssociatedShadowMunger();
-//OPTIMIZE have param annotation (and anno default value) related stuff here rather than above
+
+ //OPTIMIZE have param annotation (and anno default value) related stuff here rather than above
// ??? true or false?
public boolean isAjSynthetic();
public boolean hasAnnotation(UnresolvedType ofType);
+ public AnnotationX[] getAnnotations();
+
public ResolvedType[] getAnnotationTypes();
public void setAnnotationTypes(UnresolvedType[] annotationtypes);
}
// 'declaring' type
- r.append(getGenericReturnType().toDebugString());
+ r.append(getGenericReturnType().toString());
r.append(' ');
// name
if (params.length != 0) {
for (int i=0, len = params.length; i < len; i++) {
if (i>0) r.append(", ");
- r.append(params[i].toDebugString());
+ r.append(params[i].toString());
if (parameterNamesExist) r.append(" ").append(parameterNames[i]);
}
}
* A UnresolvedType represents a type to the weaver. It has a basic signature that knows
* nothing about type variables, type parameters, etc.. UnresolvedTypes are resolved in some World
* (a repository of types). When a UnresolvedType is resolved it turns into a
- * ResolvedType which may be a primitive type, an array type or a ReferenceType.
+ * ResolvedType which may be a primitive type, or a ReferenceType.
* ReferenceTypes may refer to simple, generic, parameterized or type-variable
* based reference types. A ReferenceType is backed by a delegate that provides
* information about the type based on some repository (currently either BCEL
throw new UnsupportedOperationException("unable to parameterize unresolved type: " + signature);
}
- /**
- * protected constructor for use only within UnresolvedType hierarchy. Use
- * one of the UnresolvedType.forXXX static methods for normal creation of
- * TypeXs.
- * Picks apart the signature string to set the type kind and calculates the
- * corresponding signatureErasure. A SIMPLE type created from a plain
- * Java signature may turn into a GENERIC type when it is resolved.
- *
- * This method should never be called for a primitive type. (UnresolvedType. forSignature
- * deals with those).
- *
- * @param signature in the form described in the class comment at the
- * top of this file.
- */
-// protected UnresolvedType(String aSignature) {
-// this.signature = aSignature;
-//
-//
-// }
-
- // -----------------------------
- // old stuff...
-
-
-
- /**
- * @param signature the bytecode string representation of this Type
- */
protected UnresolvedType(String signature) {
super();
this.signature = signature;
public String toString() {
return getName(); // + " - " + getKind();
}
-
- public String toDebugString() {
- return getName();
- }
// ---- requires worlds