StringBuilder buf = new StringBuilder();
if (annotationPattern != AnnotationTypePattern.ANY) {
buf.append('(');
- buf.append(annotationPattern.toString());
+ buf.append(annotationPattern);
buf.append(' ');
}
for (int i = 0, len = namePatterns.length; i < len; i++) {
if (i > 0) {
buf.append(".");
}
- buf.append(name.toString());
+ buf.append(name);
}
}
if (upperBound != null) {
buf.append(" extends ");
- buf.append(upperBound.toString());
+ buf.append(upperBound);
}
if (lowerBound != null) {
buf.append(" super ");
- buf.append(lowerBound.toString());
+ buf.append(lowerBound);
}
if (typeParameters != null && typeParameters.size() != 0) {
buf.append("<");
if (includeSubtypes) {
buf.append('+');
}
+ for (int i = 0; i < getDimensions(); i++) {
+ buf.append("[]");
+ }
if (isVarArgs) {
buf.append("...");
}
for (NamePattern namePattern : namePatterns) {
result = 37 * result + namePattern.hashCode();
}
+ result = 37 * result + (includeSubtypes ? 1 : 0);
+ result = 37 * result + dim;
+ result = 37 * result + (isVarArgs ? 1 : 0);
result = 37 * result + annotationPattern.hashCode();
+ result = 37 * result + typeParameters.hashCode();
if (upperBound != null) {
result = 37 * result + upperBound.hashCode();
}
public aspect FuzzilyMatchingAspect {
- after() : execution(public MaybeMissing* MaybeMissing*.*()) {
+
+ pointcut returnRefTypeSimpleOrArray() : execution(public MaybeMissing* MaybeMissing*.*());
+ pointcut return1DimRefTypeArray() : execution(public MaybeMissing*[] MaybeMissing*.*());
+ pointcut return2DimRefTypeArray() : execution(public MaybeMissing*[][] MaybeMissing*.*());
+
+ // Return type 'MaybeMissing*' also matches array types due to the '*' at the end.
+ // Therefore, explicitly exclude array pointcuts in order to only match the method returning the simple type.
+ after() : returnRefTypeSimpleOrArray() && !return1DimRefTypeArray() && !return2DimRefTypeArray() {
System.out.println(thisJoinPoint);
}
- after() : execution(public MaybeMissing*[] MaybeMissing*.*()) {
+ after() : return1DimRefTypeArray() {
System.out.println(thisJoinPoint);
}
- after() : execution(public MaybeMissing*[][] MaybeMissing*.*()) {
+ after() : return2DimRefTypeArray() {
System.out.println(thisJoinPoint);
}
- after() : execution(public in* MaybeMissing*.*()) {
+ pointcut returnPrimitiveTypeSimpleOrArray() : execution(public in* MaybeMissing*.*());
+ pointcut return1DimPrimitiveTypeArray() : execution(public in*[] MaybeMissing*.*());
+ pointcut return2DimPrimitiveTypeArray() : execution(public in*[][] MaybeMissing*.*());
+
+ // Return type 'in*' also matches array types due to the '*' at the end.
+ // Therefore, explicitly exclude array pointcuts in order to only match the method returning the simple type.
+ after() : returnPrimitiveTypeSimpleOrArray() && !return1DimPrimitiveTypeArray() && !return2DimPrimitiveTypeArray() {
System.out.println(thisJoinPoint);
}
- after() : execution(public in*[] MaybeMissing*.*()) {
+ after() : return1DimPrimitiveTypeArray() {
System.out.println(thisJoinPoint);
}
- after() : execution(public in*[][] MaybeMissing*.*()) {
+ after() : return2DimPrimitiveTypeArray() {
System.out.println(thisJoinPoint);
}
+
}