Skip to content

Commit

Permalink
Merge c1accbd into e21a338
Browse files Browse the repository at this point in the history
  • Loading branch information
monperrus committed May 15, 2017
2 parents e21a338 + c1accbd commit c0f808a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 166 deletions.
12 changes: 6 additions & 6 deletions src/main/java/spoon/reflect/visitor/Query.java
Expand Up @@ -20,6 +20,7 @@
import spoon.reflect.factory.Factory;
import spoon.reflect.reference.CtReference;
import spoon.reflect.visitor.chain.CtFunction;
import spoon.reflect.visitor.filter.TypeFilter;

import java.util.List;

Expand Down Expand Up @@ -77,12 +78,13 @@ public static <E extends CtElement> List<E> getElements(
* @param filter
* the filter which defines the matching criteria
*
* @deprecated use {@link #getElements(CtElement, Filter)} instead.
*/
@Deprecated
public static <T extends CtReference> List<T> getReferences(
CtElement rootElement, Filter<T> filter) {
return getElements(rootElement, filter);
// note that the new TypeFilter<>(CtReference.class) should not be necessary
// thanks to using <T extends CtReference>
// however, playing safe to satisfy contract in case of type erasure
return rootElement.filterChildren(new TypeFilter<>(CtReference.class)).filterChildren(filter).list();
}

/**
Expand All @@ -96,12 +98,10 @@ public static <T extends CtReference> List<T> getReferences(
* search on
* @param filter
* the filter which defines the matching criteria
* @deprecated use {@link #getElements(CtElement, Filter)} instead.
*/
@Deprecated
public static <R extends CtReference> List<R> getReferences(
Factory factory, Filter<R> filter) {
return getElements(factory, filter);
return getReferences(factory.Package().getRootPackage(), filter);
}

}
84 changes: 0 additions & 84 deletions src/main/java/spoon/reflect/visitor/QueryVisitor.java

This file was deleted.

32 changes: 0 additions & 32 deletions src/main/java/spoon/reflect/visitor/ReferenceFilter.java

This file was deleted.

36 changes: 0 additions & 36 deletions src/main/java/spoon/reflect/visitor/ReferenceQueryVisitor.java

This file was deleted.

Expand Up @@ -17,20 +17,16 @@
package spoon.reflect.visitor.filter;

import spoon.reflect.reference.CtReference;
import spoon.reflect.visitor.ReferenceFilter;
import spoon.reflect.visitor.Filter;

/**
* This class defines an abstract reference filter that needs to be subclassed
* in order to define the matching criteria.
*
* @param <T>
* the type of the reference to be matched
* @see spoon.reflect.visitor.Filter
*
* @deprecated use {@link AbstractFilter} instead.
*/
@Deprecated
public abstract class AbstractReferenceFilter<T extends CtReference> extends AbstractFilter<T> implements ReferenceFilter<T> {
public abstract class AbstractReferenceFilter<T extends CtReference> extends AbstractFilter<T> implements Filter<T> {

/**
* Creates a reference filter with the type of the potentially matching
Expand Down
Expand Up @@ -24,9 +24,7 @@
* @param <T>
* the type of the reference to be matched
*
* @deprecated use {@link TypeFilter} instead.
*/
@Deprecated
public class ReferenceTypeFilter<T extends CtReference> extends TypeFilter<T> {

/**
Expand Down

0 comments on commit c0f808a

Please sign in to comment.