diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-08-23 09:33:21 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-08-23 10:39:24 +0700 |
commit | 73e86eb9dc6825e8d8bade57a04e0e5289d78f8a (patch) | |
tree | 22855ec034129f49cb32e368bb304a4a3ae25ef8 /org.aspectj.matcher/src | |
parent | c708962d7e0341133790bf7315257db7aa5acc86 (diff) | |
download | aspectj-73e86eb9dc6825e8d8bade57a04e0e5289d78f8a.tar.gz aspectj-73e86eb9dc6825e8d8bade57a04e0e5289d78f8a.zip |
NotTypePattern: Fix matching problem for negated type patterns
The implementation for boolean matchesArray(UnresolvedType type) was
buggy.
'!String' should match anything but String, no matter if it is
an array or not, e.g. int, void, int[], String[], String[][].
'!String[]' should match anything but String[], no matter if it is
an array or not, e.g. int, void, int[], String, String[][].
Fixes #257.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'org.aspectj.matcher/src')
-rw-r--r-- | org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java index d8c4f3bd4..6360c7a72 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java @@ -70,7 +70,12 @@ public class NotTypePattern extends TypePattern { @Override protected boolean matchesArray(UnresolvedType type) { - return !negatedPattern.matchesArray(type); + // '!String' should match anything but String, no matter if it is an array or not, + // e.g. int, void, int[], String[], String[][]. + // + // '!String[]' should match anything but String[], no matter if it is an array or not, + // e.g. int, void, int[], String, String[][]. + return true; } @Override |