14
14
15
15
import java .io .IOException ;
16
16
import java .util .ArrayList ;
17
+ import java .util .Arrays ;
17
18
import java .util .List ;
18
19
import java .util .Map ;
19
20
import java .util .StringTokenizer ;
25
26
import org .aspectj .util .FileUtil ;
26
27
import org .aspectj .util .FuzzyBoolean ;
27
28
import org .aspectj .weaver .AjAttribute ;
29
+ import org .aspectj .weaver .ArrayReferenceType ;
28
30
import org .aspectj .weaver .BCException ;
29
31
import org .aspectj .weaver .BoundedReferenceType ;
30
32
import org .aspectj .weaver .CompressingDataOutputStream ;
39
41
import org .aspectj .weaver .UnresolvedTypeVariableReferenceType ;
40
42
import org .aspectj .weaver .VersionedDataInputStream ;
41
43
import org .aspectj .weaver .WeaverMessages ;
44
+ import org .aspectj .weaver .WildcardedUnresolvedType ;
42
45
import org .aspectj .weaver .World ;
43
46
44
47
/**
@@ -233,7 +236,8 @@ protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType)
233
236
// Ensure the annotation pattern is resolved
234
237
annotationPattern .resolve (type .getWorld ());
235
238
236
- return matchesExactlyByName (targetTypeName .replaceFirst ("(\\ [\\ ])+$" , "" ), type .isAnonymous (), type .isNested ()) && matchesParameters (type , STATIC )
239
+ return matchesExactlyByName (targetTypeName .replaceFirst ("(\\ [\\ ])+$" , "" ), type .isAnonymous (), type .isNested ())
240
+ && matchesParameters (type , STATIC )
237
241
&& matchesArray (type )
238
242
&& matchesBounds (type , STATIC )
239
243
&& annotationPattern .matches (annotatedType , type .temporaryAnnotationTypes ).alwaysTrue ();
@@ -242,6 +246,9 @@ && matchesBounds(type, STATIC)
242
246
// we've matched against the base (or raw) type, but if this type pattern specifies parameters or
243
247
// type variables we need to make sure we match against them too
244
248
private boolean matchesParameters (ResolvedType aType , MatchKind staticOrDynamic ) {
249
+ // For array reference types, match type parameters on component type, not on array type itself
250
+ if (aType instanceof ArrayReferenceType )
251
+ aType = aType .getResolvedComponentType ();
245
252
if (!isGeneric && typeParameters .size () > 0 ) {
246
253
if (!aType .isParameterizedType ()) {
247
254
return false ;
0 commit comments