aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2023-02-25 23:11:05 +0100
committerAlexander Kriegisch <Alexander@Kriegisch.name>2023-02-26 10:36:43 +0100
commit9e0d2bc02474a9549093d57fa4a0d321c2739198 (patch)
treeaf60346d71d4e56dc377ecc9e3b95f3c0eacf6a9 /asm
parent53bb964c3021b18dc94c4dfb66b212bd0060449c (diff)
downloadaspectj-9e0d2bc02474a9549093d57fa4a0d321c2739198.tar.gz
aspectj-9e0d2bc02474a9549093d57fa4a0d321c2739198.zip
Sync HandleProviderDelimiter with JDT Core & AJDT
New constants: JEM_MODULAR_CLASSFILE - '\'' (single quote) ANNOTATION - '}' LAMBDA_EXPRESSION - ')' LAMBDA_METHOD - '&' STRING - '"' MODULE - '`' DELIMITER_ESCAPE - '=' Updated AspectJ constants due to JDT Core using constants previously used by AspectJ: ADVICE - '&' to '§' ASPECT_TYPE - '\'' to '>' ITD_METHOD - ')' to '°' DECLARE - '`' to '´' POINTCUT - '"' to '©' Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'asm')
-rw-r--r--asm/src/main/java/org/aspectj/asm/internal/HandleProviderDelimiter.java39
-rw-r--r--asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java12
2 files changed, 35 insertions, 16 deletions
diff --git a/asm/src/main/java/org/aspectj/asm/internal/HandleProviderDelimiter.java b/asm/src/main/java/org/aspectj/asm/internal/HandleProviderDelimiter.java
index 2732d109f..f8f601bb4 100644
--- a/asm/src/main/java/org/aspectj/asm/internal/HandleProviderDelimiter.java
+++ b/asm/src/main/java/org/aspectj/asm/internal/HandleProviderDelimiter.java
@@ -17,35 +17,52 @@ import org.aspectj.asm.IProgramElement;
*/
public class HandleProviderDelimiter {
- // taken from JavaElement
+ // TODO:
+ // Keep constants in sync between
+ // - org.eclipse.jdt.internal.core.JavaElement (JDT Core),
+ // - org.eclipse.ajdt.core.javaelements.AspectElement (AJDT Core),
+ // - org.aspectj.asm.internal.HandleProviderDelimiter (AspectJ).
+ // The reason is that JDT Core introduces new delimiters for new Java language constructs once in a while.
+ // This led to clashes with existing AJDT symbols in the past already, which consequently had to be changed
+ // to use other characters. Therefore, manual synchronisation with JDT Core is necessary.
+
+ // Taken from org.eclipse.jdt.internal.core.JavaElement (JDT Core)
+ public static final HandleProviderDelimiter ESCAPE = new HandleProviderDelimiter('\\');
public static final HandleProviderDelimiter JAVAPROJECT = new HandleProviderDelimiter('=');
+ public static final HandleProviderDelimiter PACKAGEFRAGMENTROOT = new HandleProviderDelimiter('/');
public static final HandleProviderDelimiter PACKAGEFRAGMENT = new HandleProviderDelimiter('<');
public static final HandleProviderDelimiter FIELD = new HandleProviderDelimiter('^');
public static final HandleProviderDelimiter METHOD = new HandleProviderDelimiter('~');
public static final HandleProviderDelimiter INITIALIZER = new HandleProviderDelimiter('|');
public static final HandleProviderDelimiter COMPILATIONUNIT = new HandleProviderDelimiter('{');
public static final HandleProviderDelimiter CLASSFILE = new HandleProviderDelimiter('(');
+ public static final HandleProviderDelimiter JEM_MODULAR_CLASSFILE = new HandleProviderDelimiter('\'');
public static final HandleProviderDelimiter TYPE = new HandleProviderDelimiter('[');
+ public static final HandleProviderDelimiter PACKAGEDECLARATION = new HandleProviderDelimiter('%');
public static final HandleProviderDelimiter IMPORTDECLARATION = new HandleProviderDelimiter('#');
public static final HandleProviderDelimiter COUNT = new HandleProviderDelimiter('!');
- public static final HandleProviderDelimiter ESCAPE = new HandleProviderDelimiter('\\');
- public static final HandleProviderDelimiter PACKAGEDECLARATION = new HandleProviderDelimiter('%');
- public static final HandleProviderDelimiter PACKAGEFRAGMENTROOT = new HandleProviderDelimiter('/');
// these below are not currently used because no iprogramelement.kind
// equivalent
public static final HandleProviderDelimiter LOCALVARIABLE = new HandleProviderDelimiter('@');
public static final HandleProviderDelimiter TYPE_PARAMETER = new HandleProviderDelimiter(']');
+ public static final HandleProviderDelimiter ANNOTATION = new HandleProviderDelimiter('}');
+ public static final HandleProviderDelimiter LAMBDA_EXPRESSION = new HandleProviderDelimiter(')');
+ public static final HandleProviderDelimiter LAMBDA_METHOD = new HandleProviderDelimiter('&');
+ public static final HandleProviderDelimiter STRING = new HandleProviderDelimiter('"');
+ public static final HandleProviderDelimiter MODULE = new HandleProviderDelimiter('`');
+ public static final HandleProviderDelimiter DELIMITER_ESCAPE = new HandleProviderDelimiter('=');
- // AspectJ specific ones
+ // Taken from org.aspectj.asm.internal.HandleProviderDelimiter (AspectJ)
public static final HandleProviderDelimiter ASPECT_CU = new HandleProviderDelimiter('*');
- public static final HandleProviderDelimiter ADVICE = new HandleProviderDelimiter('&');
- public static final HandleProviderDelimiter ASPECT_TYPE = new HandleProviderDelimiter('\'');
+ public static final HandleProviderDelimiter ADVICE = new HandleProviderDelimiter('§');
+ public static final HandleProviderDelimiter ASPECT_TYPE = new HandleProviderDelimiter('>');
public static final HandleProviderDelimiter CODEELEMENT = new HandleProviderDelimiter('?');
public static final HandleProviderDelimiter ITD_FIELD = new HandleProviderDelimiter(',');
- public static final HandleProviderDelimiter ITD = new HandleProviderDelimiter(')');
- public static final HandleProviderDelimiter DECLARE = new HandleProviderDelimiter('`');
- public static final HandleProviderDelimiter POINTCUT = new HandleProviderDelimiter('"');
+ public static final HandleProviderDelimiter ITD_METHOD = new HandleProviderDelimiter('°');
+ public static final HandleProviderDelimiter DECLARE = new HandleProviderDelimiter('´');
+ public static final HandleProviderDelimiter POINTCUT = new HandleProviderDelimiter('©');
+ // Special delimiter for phantom handles
public static final HandleProviderDelimiter PHANTOM = new HandleProviderDelimiter(';');
private static char empty = ' ';
@@ -99,7 +116,7 @@ public class HandleProviderDelimiter {
return ITD_FIELD.getDelimiter();
} else if (kind.equals(IProgramElement.Kind.INTER_TYPE_METHOD) || kind.equals(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR)
|| kind.equals(IProgramElement.Kind.INTER_TYPE_PARENT)) {
- return ITD.getDelimiter();
+ return ITD_METHOD.getDelimiter();
} else if (kind.equals(IProgramElement.Kind.CONSTRUCTOR) || kind.equals(IProgramElement.Kind.METHOD)) {
return METHOD.getDelimiter();
} else if (kind.equals(IProgramElement.Kind.FIELD) || kind.equals(IProgramElement.Kind.ENUM_VALUE)) {
diff --git a/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java b/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java
index 8ae6feeff..19ecb85ec 100644
--- a/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java
+++ b/asm/src/main/java/org/aspectj/asm/internal/JDTLikeHandleProvider.java
@@ -20,11 +20,13 @@ import org.aspectj.bridge.ISourceLocation;
/**
* Creates JDT-like handles, for example
- *
- * method with string argument: &lt;tjp{Demo.java[Demo~main~\[QString; method with generic argument:
- * &lt;pkg{MyClass.java[MyClass~myMethod~QList\&lt;QString;&gt;; an aspect: &lt;pkg*A1.aj}A1 advice with Integer arg:
- * &lt;pkg*A8.aj}A8&amp;afterReturning&amp;QInteger; method call: &lt;pkg*A10.aj[C~m1?method-call(void pkg.C.m2())
- *
+ * <ul>
+ * <li>method with string argument: {@code <tjp}<code>{</code>{@code Demo.java[Demo~main~\[QString;}</li>
+ * <li>method with generic argument: {@code <pkg}<code>{</code>{@code MyClass.java[MyClass~myMethod~QList\<QString;>;}</li>
+ * <li>aspect: {@code <pkg*A1.aj}<code>}</code>{@code A1}</li>
+ * <li>advice with Integer arg: {@code <pkg*A8.aj}<code>}</code>{@code A8&afterReturning&QInteger;}</li>
+ * <li>method call: {@code <pkg*A10.aj[C~m1?method-call(void pkg.C.m2())}</li>
+ * </ul>
*/
public class JDTLikeHandleProvider implements IElementHandleProvider {