Skip to content

Commit

Permalink
improve compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
pvojtechovsky committed Oct 21, 2017
1 parent d14544b commit f992472
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/java/spoon/reflect/visitor/CtScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public void scan(CtRole role, Collection<? extends CtElement> elements) {
}
}

/**
* Generically scans a collection of meta-model elements.
*/
public void scan(Collection<? extends CtElement> elements) {
scan(null, elements);
}
Expand All @@ -151,15 +154,18 @@ public void scan(Collection<? extends CtElement> elements) {
* Generically scans a meta-model element.
*/
public void scan(CtRole role, CtElement element) {
scan(element);
}

public void scan(CtElement element) {
if (element != null) {
element.accept(this);
}
}

/**
* Generically scans a meta-model element.
*/
public void scan(CtElement element) {
scan(null, element);
}

public <A extends Annotation> void visitCtAnnotation(final CtAnnotation<A> annotation) {
enter(annotation);
scan(CtRole.TYPE, annotation.getType());
Expand All @@ -170,6 +176,9 @@ public <A extends Annotation> void visitCtAnnotation(final CtAnnotation<A> annot
exit(annotation);
}

public void scan(Object o) {
scan(null, o);
}
/**
* Generically scans an object that can be an element, a reference, or a
* collection of those.
Expand Down

0 comments on commit f992472

Please sign in to comment.