Relates to #215. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>tags/V1_9_20
@@ -116,6 +116,15 @@ public class DeclareAnnotation extends Declare { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.signaturePattern != null && this.signaturePattern instanceof SignaturePattern) | |||
((SignaturePattern) this.signaturePattern).traverse(visitor, ret); | |||
if (this.typePattern != null) | |||
this.typePattern.traverse(visitor, ret); | |||
return ret; | |||
} | |||
@Override | |||
public void resolve(IScope scope) { | |||
if (!scope.getWorld().isInJava5Mode()) { |
@@ -70,6 +70,13 @@ public class DeclareErrorOrWarning extends Declare { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.pointcut != null) | |||
this.pointcut.traverse(visitor, ret); | |||
return ret; | |||
} | |||
public void write(CompressingDataOutputStream s) throws IOException { | |||
s.writeByte(Declare.ERROR_OR_WARNING); | |||
s.writeBoolean(isError); |
@@ -66,6 +66,15 @@ public class DeclareParents extends Declare { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.child != null) | |||
this.child.traverse(visitor, ret); | |||
if (this.parents != null) | |||
this.parents.traverse(visitor, ret); | |||
return ret; | |||
} | |||
@Override | |||
public Declare parameterizeWith(Map<String,UnresolvedType> typeVariableBindingMap, World w) { | |||
DeclareParents ret = new DeclareParents(child.parameterizeWith(typeVariableBindingMap, w), parents.parameterizeWith( |
@@ -40,6 +40,13 @@ public class DeclarePrecedence extends Declare { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.patterns != null) | |||
this.patterns.traverse(visitor, ret); | |||
return ret; | |||
} | |||
public Declare parameterizeWith(Map typeVariableBindingMap, World w) { | |||
DeclarePrecedence ret = new DeclarePrecedence(this.patterns.parameterizeWith(typeVariableBindingMap, w)); | |||
ret.copyLocationFrom(this); |
@@ -39,6 +39,15 @@ public class DeclareSoft extends Declare { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.exception != null) | |||
this.exception.traverse(visitor, ret); | |||
if (this.pointcut != null) | |||
this.pointcut.traverse(visitor, ret); | |||
return ret; | |||
} | |||
@Override | |||
public Declare parameterizeWith(Map typeVariableBindingMap, World w) { | |||
DeclareSoft ret = new DeclareSoft(exception.parameterizeWith(typeVariableBindingMap, w), pointcut.parameterizeWith( |
@@ -75,6 +75,13 @@ public class DeclareTypeErrorOrWarning extends Declare { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.typePattern != null) | |||
this.typePattern.traverse(visitor, ret); | |||
return ret; | |||
} | |||
public void write(CompressingDataOutputStream s) throws IOException { | |||
s.writeByte(Declare.TYPE_ERROR_OR_WARNING); | |||
s.writeBoolean(isError); |
@@ -198,4 +198,10 @@ public class HasMemberTypePattern extends TypePattern { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.signaturePattern != null) | |||
this.signaturePattern.traverse(visitor, ret); | |||
return ret; | |||
} | |||
} |
@@ -980,6 +980,23 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.annotationPattern != null) | |||
this.annotationPattern.traverse(visitor, ret); | |||
if (this.returnType != null) | |||
this.returnType.traverse(visitor, ret); | |||
if (this.declaringType != null) | |||
this.declaringType.traverse(visitor, ret); | |||
if (this.name != null) | |||
this.name.traverse(visitor, ret); | |||
if (this.parameterTypes != null) | |||
this.parameterTypes.traverse(visitor, ret); | |||
if (this.throwsPattern != null) | |||
this.throwsPattern.traverse(visitor, ret); | |||
return ret; | |||
} | |||
public boolean isExactDeclaringTypePattern() { | |||
return isExactDeclaringTypePattern; | |||
} |
@@ -549,8 +549,10 @@ public class TypePatternList extends PatternNode { | |||
@Override | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
for (TypePattern typePattern : typePatterns) { | |||
typePattern.traverse(visitor, ret); | |||
if (typePatterns != null) { | |||
for (TypePattern typePattern : typePatterns) { | |||
typePattern.traverse(visitor, ret); | |||
} | |||
} | |||
return ret; | |||
} |
@@ -75,8 +75,10 @@ public class TypeVariablePatternList extends PatternNode { | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
for (TypeVariablePattern pattern : patterns) { | |||
pattern.traverse(visitor, ret); | |||
if (patterns != null) { | |||
for (TypeVariablePattern pattern : patterns) { | |||
pattern.traverse(visitor, ret); | |||
} | |||
} | |||
return ret; | |||
} |
@@ -428,4 +428,11 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern { | |||
public Object accept(PatternNodeVisitor visitor, Object data) { | |||
return visitor.visit(this, data); | |||
} | |||
public Object traverse(PatternNodeVisitor visitor, Object data) { | |||
Object ret = accept(visitor, data); | |||
if (this.typePattern != null) | |||
this.typePattern.traverse(visitor, ret); | |||
return ret; | |||
} | |||
} |