diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2022-12-04 16:16:37 +0100 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2022-12-21 20:57:39 +0700 |
commit | 65f1ec72c2fc9446a162780dc3f6dee625704c02 (patch) | |
tree | 2ed8eedb386b22f65b29c44ec90c9d33eb8ba64d /org.aspectj.matcher | |
parent | b08d7d2a31f6d6444e4fea980a7d85f2944055b3 (diff) | |
download | aspectj-65f1ec72c2fc9446a162780dc3f6dee625704c02.tar.gz aspectj-65f1ec72c2fc9446a162780dc3f6dee625704c02.zip |
Fix #366085 concerning declared annotations with source retention
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=366085.
See https://stackoverflow.com/q/74618269/1082681.
The issue described in the Bugzilla issue is about 'declare @type', but
similar issues also existed for 'declare @field', 'declare @method',
'declare @constructor'. This fix is rather superficial and leaves
things to be desired, because it is rather hacky and simply ignores
errors source retention annotation declarations during weaving. A better
fix would drop the corresponding declarations while parsing and also
issue compiler warnings in each case.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r-- | org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java index 7a452ef05..00bbf5647 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java @@ -380,6 +380,8 @@ public class DeclareAnnotation extends Declare { int idx = 0; if (annos.length > 0 && annos[0].getType().getSignature().equals("Lorg/aspectj/internal/lang/annotation/ajcDeclareAnnotation;")) { + if (annos.length < 2) + continue; idx = 1; } annotation = annos[idx]; @@ -441,6 +443,8 @@ public class DeclareAnnotation extends Declare { int idx = 0; if (annoTypes[0].getSignature().equals("Lorg/aspectj/internal/lang/annotation/ajcDeclareAnnotation;")) { idx = 1; + if (annoTypes.length < 2) + continue; } annotationType = annoTypes[idx]; break; |