Class HasMemberTypePatternForPerThisMatching
- All Implemented Interfaces:
IHasPosition
,IHasSourceLocation
aspect X perthis(transactional()) {
pointcut transactional: execution(@Foo * *(..));
When this occurs we obviously only want an aspect instance when there is a method annotated with @Foo. For a regular execution pointcut we couldn't really do this due to the multiple joinpoint signatures for each joinpoint (and so lots of types get the ajcMightHaveAspect interface). However, for an execution pointcut involving an annotation we can do something clever. Annotations must match against the first primary joinpoint signature - so when computing the type pattern to use for matching when processing the perthis() clause above, we can use the HasMemberTypePattern - because that effectively does what we want. We want an aspect instance if the type hasmethod(...) with the appropriate annotation. This would be great... but breaks in the face of ITDs. If the method that hasmethod() would match is introduced via an ITD we come unstuck, the code in HasMemberTypePattern.hasMethod() does look at ITDs but it won't see annotations, they aren't visible (at least through EclipseResolvedMember objects). And so this subclass is created to say 'if the supertype thinks it is a match, great, but if it doesnt then if there are ITDs on the target, they might match so just say 'true''. Note that returning true is just confirming whether the 'mightHaveAspect' interface (and friends) are getting added.
- Author:
- Andy Clement
-
Nested Class Summary
Nested classes/interfaces inherited from class org.aspectj.weaver.patterns.TypePattern
TypePattern.MatchKind
-
Field Summary
Fields inherited from class org.aspectj.weaver.patterns.TypePattern
AND, annotationPattern, ANY, ANY_KEY, ANY_WITH_ANNO, BINDING, DYNAMIC, ELLIPSIS, ELLIPSIS_KEY, EXACT, HAS_MEMBER, includeSubtypes, isVarArgs, NO, NO_KEY, NOT, OR, STATIC, TYPE_CATEGORY, typeParameters, WILD
Fields inherited from class org.aspectj.weaver.patterns.PatternNode
end, sourceContext, start
-
Constructor Summary
-
Method Summary
Methods inherited from class org.aspectj.weaver.patterns.HasMemberTypePattern
accept, equals, getSignaturePattern, hashCode, matchesArray, matchesExactly, matchesExactly, matchesInstanceof, parameterizeWith, read, resolveBindings, toString, traverse
Methods inherited from class org.aspectj.weaver.patterns.TypePattern
couldEverMatchSameTypesAs, getAnnotationPattern, getDimensions, getExactType, getTypeParameters, hasFailedResolution, isArray, isBangVoid, isEllipsis, isIncludeSubtypes, isStar, isStarAnnotation, isVarArgs, isVoid, matches, matchesStatically, matchesSubtypes, matchesSubtypes, notExactType, postRead, remapAdviceFormals, resolve, resolveExactType, setAnnotationTypePattern, setIsVarArgs, setTypeParameters
Methods inherited from class org.aspectj.weaver.patterns.PatternNode
copyLocationFrom, getEnd, getFileName, getSourceContext, getSourceLocation, getStart, readLocation, setLocation, writeLocation
-
Constructor Details
-
HasMemberTypePatternForPerThisMatching
-
-
Method Details
-
hasMethod
- Overrides:
hasMethod
in classHasMemberTypePattern
-
write
- Overrides:
write
in classHasMemberTypePattern
- Throws:
IOException
-