aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2018-10-15 09:25:27 -0700
committerAndy Clement <aclement@pivotal.io>2018-10-15 09:25:27 -0700
commita1953b55458304e99b90124925c3b7c4aa88ebe3 (patch)
tree57ee909d7586e962398160c3d25e7cb0ce9de9fc /weaver
parent73fda8dcbf5db6739654848fe4a0ec29ff003f7d (diff)
downloadaspectj-a1953b55458304e99b90124925c3b7c4aa88ebe3.tar.gz
aspectj-a1953b55458304e99b90124925c3b7c4aa88ebe3.zip
Merge changes for 536782
Changes contributed by Manfred under https://github.com/eclipse/org.aspectj/pull/5/commits
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java8
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelMethod.java5
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelShadow.java2
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/Utility.java4
-rw-r--r--weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java7
5 files changed, 18 insertions, 8 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
index dbb81b53e..19170b547 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
+++ b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
@@ -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)) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
index 4d8114eaf..d1e60e1c7 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
@@ -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")
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
index 2e8d3ab6b..c93a0f26e 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
@@ -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();
diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java
index cd1fd4ab8..4acf032fc 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Utility.java
+++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java
@@ -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,
diff --git a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
index c372afc83..a02400fb0 100644
--- a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
+++ b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
@@ -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