Browse Source

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>
tags/V1_9_20_1
Alexander Kriegisch 10 months ago
parent
commit
73e86eb9dc

+ 6
- 1
org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/NotTypePattern.java View File

@@ -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

Loading…
Cancel
Save