360
class EllipsisTypePattern extends TypePattern {
363
* Constructor for EllipsisTypePattern.
365
* @param includeSubtypes
367
public EllipsisTypePattern() {
368
super(false, false, new TypePatternList());
374
* @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
377
protected boolean couldEverMatchSameTypesAs(TypePattern other) {
382
* @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType)
385
protected boolean matchesExactly(ResolvedType type) {
390
protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
395
* @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType)
398
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
399
return FuzzyBoolean.NO;
403
public void write(CompressingDataOutputStream s) throws IOException {
404
s.writeByte(ELLIPSIS_KEY);
408
public boolean isEllipsis() {
413
public String toString() {
420
* @see java.lang.Object#equals(java.lang.Object)
423
public boolean equals(Object obj) {
424
return (obj instanceof EllipsisTypePattern);
430
* @see java.lang.Object#hashCode()
433
public int hashCode() {
438
public Object accept(PatternNodeVisitor visitor, Object data) {
439
return visitor.visit(this, data);
443
public TypePattern parameterizeWith(Map typeVariableMap, World w) {
449
class AnyTypePattern extends TypePattern {
452
* Constructor for EllipsisTypePattern.
454
* @param includeSubtypes
456
public AnyTypePattern() {
457
super(false, false, new TypePatternList());
463
* @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
466
protected boolean couldEverMatchSameTypesAs(TypePattern other) {
471
* @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType)
474
protected boolean matchesExactly(ResolvedType type) {
479
protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
484
* @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType)
487
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
488
return FuzzyBoolean.YES;
492
public void write(CompressingDataOutputStream s) throws IOException {
493
s.writeByte(ANY_KEY);
497
* @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind)
499
// public FuzzyBoolean matches(IType type, MatchKind kind) {
500
// return FuzzyBoolean.YES;
503
* @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(IType)
506
protected boolean matchesSubtypes(ResolvedType type) {
511
public boolean isStar() {
516
public String toString() {
521
public boolean equals(Object obj) {
522
return (obj instanceof AnyTypePattern);
526
public int hashCode() {
531
public Object accept(PatternNodeVisitor visitor, Object data) {
532
return visitor.visit(this, data);
536
public TypePattern parameterizeWith(Map arg0, World w) {
542
* This type represents a type pattern of '*' but with an annotation specified, e.g. '@Color *'
544
class AnyWithAnnotationTypePattern extends TypePattern {
546
public AnyWithAnnotationTypePattern(AnnotationTypePattern atp) {
548
annotationPattern = atp;
552
public Object accept(PatternNodeVisitor visitor, Object data) {
553
return visitor.visit(this, data);
557
protected boolean couldEverMatchSameTypesAs(TypePattern other) {
562
protected boolean matchesExactly(ResolvedType type) {
563
annotationPattern.resolve(type.getWorld());
565
if (type.temporaryAnnotationTypes != null) {
566
b = annotationPattern.matches(type, type.temporaryAnnotationTypes).alwaysTrue();
568
b = annotationPattern.matches(type).alwaysTrue();
574
public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) {
575
if (requireExactType) {
576
scope.getWorld().getMessageHandler().handleMessage(
577
MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED), getSourceLocation()));
580
return super.resolveBindings(scope, bindings, allowBinding, requireExactType);
584
protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
585
annotationPattern.resolve(type.getWorld());
586
return annotationPattern.matches(annotatedType).alwaysTrue();
590
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
591
if (Modifier.isFinal(type.getModifiers())) {
592
return FuzzyBoolean.fromBoolean(matchesExactly(type));
594
return FuzzyBoolean.MAYBE;
598
public TypePattern parameterizeWith(Map typeVariableMap, World w) {
599
AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith(
600
typeVariableMap, w));
601
ret.copyLocationFrom(this);
606
public void write(CompressingDataOutputStream s) throws IOException {
607
s.writeByte(TypePattern.ANY_WITH_ANNO);
608
annotationPattern.write(s);
612
public static TypePattern read(VersionedDataInputStream s, ISourceContext c) throws IOException {
613
AnnotationTypePattern annPatt = AnnotationTypePattern.read(s, c);
614
AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(annPatt);
615
ret.readLocation(c, s);
619
// public FuzzyBoolean matches(IType type, MatchKind kind) {
620
// return FuzzyBoolean.YES;
624
protected boolean matchesSubtypes(ResolvedType type) {
629
public boolean isStar() {
634
public String toString() {
635
return "(" + annotationPattern + " *)";
639
public boolean equals(Object obj) {
640
if (!(obj instanceof AnyWithAnnotationTypePattern)) {
643
AnyWithAnnotationTypePattern awatp = (AnyWithAnnotationTypePattern) obj;
644
return (annotationPattern.equals(awatp.annotationPattern));
648
public int hashCode() {
649
return annotationPattern.hashCode();
653
class NoTypePattern extends TypePattern {
655
public NoTypePattern() {
656
super(false, false, new TypePatternList());
662
* @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
665
protected boolean couldEverMatchSameTypesAs(TypePattern other) {
670
* @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType)
673
protected boolean matchesExactly(ResolvedType type) {
678
protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
683
* @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType)
686
public FuzzyBoolean matchesInstanceof(ResolvedType type) {
687
return FuzzyBoolean.NO;
691
public void write(CompressingDataOutputStream s) throws IOException {
696
* @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind)
698
// public FuzzyBoolean matches(IType type, MatchKind kind) {
699
// return FuzzyBoolean.YES;
702
* @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(IType)
705
protected boolean matchesSubtypes(ResolvedType type) {
710
public boolean isStar() {
715
public String toString() {
717
}// FIXME AV - bad! toString() cannot be parsed back (not idempotent)
722
* @see java.lang.Object#equals(java.lang.Object)
725
public boolean equals(Object obj) {
726
return (obj instanceof NoTypePattern);
732
* @see java.lang.Object#hashCode()
735
public int hashCode() {
740
public Object accept(PatternNodeVisitor visitor, Object data) {
741
return visitor.visit(this, data);
745
public TypePattern parameterizeWith(Map arg0, World w) {