Changes contributed by Manfred under https://github.com/eclipse/org.aspectj/pull/5/commitstags/V1_9_2RC3
@@ -57,6 +57,9 @@ import org.aspectj.weaver.patterns.TypePatternList; | |||
*/ | |||
public class AsmElementFormatter { | |||
private final static String ASPECTJ_ANNOTATION_PACKAGE = "org.aspectj.lang.annotation"; | |||
private final static char PACKAGE_INITIAL_CHAR = ASPECTJ_ANNOTATION_PACKAGE.charAt(0); | |||
public void genLabelAndKind(MethodDeclaration methodDeclaration, IProgramElement node) { | |||
if (methodDeclaration instanceof AdviceDeclaration) { | |||
@@ -219,7 +222,7 @@ public class AsmElementFormatter { | |||
// Note: AV: implicit single advice type support here (should be enforced somewhere as well (APT etc)) | |||
Annotation annotation = methodDeclaration.annotations[i]; | |||
String annotationSig = new String(annotation.type.getTypeBindingPublic(methodDeclaration.scope).signature()); | |||
if (annotationSig.charAt(1) == 'o') { | |||
if (annotationSig.charAt(1) == PACKAGE_INITIAL_CHAR) { | |||
if ("Lorg/aspectj/lang/annotation/Pointcut;".equals(annotationSig)) { | |||
node.setKind(IProgramElement.Kind.POINTCUT); | |||
node.setAnnotationStyleDeclaration(true); // pointcuts don't seem to get handled quite right... | |||
@@ -459,7 +462,7 @@ public class AsmElementFormatter { | |||
// TODO: fix this way of determing ajc-added arguments, make subtype of Argument with extra info | |||
private boolean acceptArgument(String name, String type) { | |||
if (name.charAt(0) != 'a' && type.charAt(0) != 'o') { | |||
if (name.charAt(0) != 'a' && type.charAt(0) != PACKAGE_INITIAL_CHAR) { | |||
return true; | |||
} | |||
return !name.startsWith("ajc$this_") && !type.equals("org.aspectj.lang.JoinPoint.StaticPart") |
@@ -98,6 +98,8 @@ public class AtAjAttributes { | |||
private final static String THROWING = "throwing"; | |||
private final static String RETURNING = "returning"; | |||
private final static String STRING_DESC = "Ljava/lang/String;"; | |||
private final static String ASPECTJ_ANNOTATION_PACKAGE = "org.aspectj.lang.annotation"; | |||
private final static char PACKAGE_INITIAL_CHAR = ASPECTJ_ANNOTATION_PACKAGE.charAt(0); | |||
/** | |||
* A struct that allows to add extra arguments without always breaking the API | |||
@@ -193,8 +195,8 @@ public class AtAjAttributes { | |||
*/ | |||
public static List<AjAttribute> readAj5ClassAttributes(AsmManager model, JavaClass javaClass, ReferenceType type, | |||
ISourceContext context, IMessageHandler msgHandler, boolean isCodeStyleAspect) { | |||
boolean ignoreThisClass = javaClass.getClassName().charAt(0) == 'o' | |||
&& javaClass.getClassName().startsWith("org.aspectj.lang.annotation"); | |||
boolean ignoreThisClass = javaClass.getClassName().charAt(0) == PACKAGE_INITIAL_CHAR | |||
&& javaClass.getClassName().startsWith(ASPECTJ_ANNOTATION_PACKAGE); | |||
if (ignoreThisClass) { | |||
return NO_ATTRIBUTES; | |||
} | |||
@@ -205,7 +207,7 @@ public class AtAjAttributes { | |||
Constant constant = cpool[i]; | |||
if (constant != null && constant.getTag() == Constants.CONSTANT_Utf8) { | |||
String constantValue = ((ConstantUtf8) constant).getValue(); | |||
if (constantValue.length() > 28 && constantValue.charAt(1) == 'o') { | |||
if (constantValue.length() > 28 && constantValue.charAt(1) == PACKAGE_INITIAL_CHAR) { | |||
if (constantValue.startsWith("Lorg/aspectj/lang/annotation")) { | |||
containsAnnotationClassReference = true; | |||
if ("Lorg/aspectj/lang/annotation/DeclareAnnotation;".equals(constantValue)) { |
@@ -51,6 +51,9 @@ import org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.GenericSigna | |||
//public final | |||
class BcelMethod extends ResolvedMemberImpl { | |||
private final static String ASPECTJ_ANNOTATION_PACKAGE = "org.aspectj.lang.annotation"; | |||
private final static char PACKAGE_INITIAL_CHAR = ASPECTJ_ANNOTATION_PACKAGE.charAt(0); | |||
private Method method; | |||
// these fields are not set for many BcelMethods... | |||
@@ -141,7 +144,7 @@ class BcelMethod extends ResolvedMemberImpl { | |||
for (int i = 0; i < axs.length; i++) { | |||
AnnotationAJ annotationX = axs[i]; | |||
String typename = annotationX.getTypeName(); | |||
if (typename.charAt(0) == 'o') { | |||
if (typename.charAt(0) == PACKAGE_INITIAL_CHAR) { | |||
if (typename.equals("org.aspectj.lang.annotation.Pointcut") | |||
|| typename.equals("org.aspectj.lang.annotation.Before") | |||
|| typename.equals("org.aspectj.lang.annotation.Around") |
@@ -2941,7 +2941,7 @@ public class BcelShadow extends Shadow { | |||
closureInstantiation.append(fact.createConstant(Integer.valueOf(bitflags))); | |||
closureInstantiation.append(Utility.createInvoke(getFactory(), getWorld(), | |||
new MemberImpl(Member.METHOD, UnresolvedType.forName("org.aspectj.runtime.internal.AroundClosure"), | |||
Modifier.PUBLIC, "linkClosureAndJoinPoint", "(I)Lorg/aspectj/lang/ProceedingJoinPoint;"))); | |||
Modifier.PUBLIC, "linkClosureAndJoinPoint", String.format("%s%s", "(I)", "Lorg/aspectj/lang/ProceedingJoinPoint;")))); | |||
} | |||
InstructionList advice = new InstructionList(); |
@@ -65,6 +65,8 @@ import org.aspectj.weaver.World; | |||
public class Utility { | |||
private final static char PACKAGE_INITIAL_CHAR = AjAttribute.AttributePrefix.charAt(0); | |||
public static List<AjAttribute> readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w, | |||
AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor) { | |||
List<AjAttribute> attributes = new ArrayList<AjAttribute>(); | |||
@@ -76,7 +78,7 @@ public class Utility { | |||
if (a instanceof Unknown) { | |||
Unknown u = (Unknown) a; | |||
String name = u.getName(); | |||
if (name.charAt(0) == 'o') { // 'o'rg.aspectj | |||
if (name.charAt(0) == PACKAGE_INITIAL_CHAR) { // 'o'rg.aspectj | |||
if (name.startsWith(AjAttribute.AttributePrefix)) { | |||
if (name.endsWith(WeaverVersionInfo.AttributeName)) { | |||
version = (AjAttribute.WeaverVersionInfo) AjAttribute.read(version, name, u.getBytes(), context, w, |
@@ -80,6 +80,9 @@ public class WeavingAdaptor implements IMessageContext { | |||
public static final String SHOW_WEAVE_INFO_PROPERTY = "org.aspectj.weaver.showWeaveInfo"; | |||
public static final String TRACE_MESSAGES_PROPERTY = "org.aspectj.tracing.messages"; | |||
private final static String ASPECTJ_BASE_PACKAGE = "org.aspectj."; | |||
private final static String PACKAGE_INITIAL_CHARS = ASPECTJ_BASE_PACKAGE.charAt(0) + "sj"; | |||
private boolean enabled = false; | |||
protected boolean verbose = getVerbose(); | |||
protected BcelWorld bcelWorld; | |||
@@ -447,7 +450,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
} | |||
private boolean shouldWeaveName(String name) { | |||
if ("osj".indexOf(name.charAt(0)) != -1) { | |||
if (PACKAGE_INITIAL_CHARS.indexOf(name.charAt(0)) != -1) { | |||
if ((weavingSpecialTypes & INITIALIZED) == 0) { | |||
weavingSpecialTypes |= INITIALIZED; | |||
// initialize it | |||
@@ -463,7 +466,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
} | |||
} | |||
} | |||
if (name.startsWith("org.aspectj.")) { | |||
if (name.startsWith(ASPECTJ_BASE_PACKAGE)) { | |||
return false; | |||
} | |||
if (name.startsWith("sun.reflect.")) {// JDK reflect |