Search in sources :

Example 1 with SuperInheritanceHierarchyFunction

use of spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction in project spoon by INRIA.

the class CtCatchVariableImpl method getType.

@SuppressWarnings("unchecked")
@Override
@DerivedProperty
public CtTypeReference<T> getType() {
    if (types.isEmpty()) {
        return null;
    } else if (types.size() == 1) {
        return (CtTypeReference<T>) types.get(0);
    }
    // compute common super type of exceptions
    List<CtTypeReference<?>> superTypesOfFirst = types.get(0).map(new SuperInheritanceHierarchyFunction().includingInterfaces(false).includingSelf(true).returnTypeReferences(true)).list();
    if (superTypesOfFirst.isEmpty()) {
        return null;
    }
    int commonSuperTypeIdx = 0;
    // index of Throwable. Last is Object
    int throwableIdx = superTypesOfFirst.size() - 2;
    for (int i = 1; i < types.size() && commonSuperTypeIdx != throwableIdx; i++) {
        CtTypeReference<?> nextException = types.get(i);
        while (commonSuperTypeIdx < throwableIdx) {
            if (nextException.isSubtypeOf(superTypesOfFirst.get(commonSuperTypeIdx))) {
                // nextException is sub type of actually selected commonSuperType
                break;
            }
            // try next super type
            commonSuperTypeIdx++;
        }
    }
    return (CtTypeReference<T>) superTypesOfFirst.get(commonSuperTypeIdx);
}
Also used : SuperInheritanceHierarchyFunction(spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction) CtTypeReference(spoon.reflect.reference.CtTypeReference) DerivedProperty(spoon.support.DerivedProperty)

Example 2 with SuperInheritanceHierarchyFunction

use of spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction in project spoon by INRIA.

the class SubInheritanceHierarchyResolver method forEachSubTypeInPackage.

/**
 * Calls `outputConsumer.apply(subType)` for each sub type of the targetSuperTypes that are found in `inputPackage`.
 * Each sub type is returned only once.
 * It makes sense to call this method again for example after new super types are added
 * by {@link #addSuperType(CtTypeInformation)}.
 *
 * 	If this method is called again with same input and configuration, nothing in sent to outputConsumer
 * @param outputConsumer the consumer for found sub types
 */
public <T extends CtType<?>> void forEachSubTypeInPackage(final CtConsumer<T> outputConsumer) {
    /*
		 * Set of qualified names of all visited types, independent on whether they are sub types or not.
		 */
    final Set<String> allVisitedTypeNames = new HashSet<>();
    /*
		 * the queue of types whose super inheritance hierarchy we are just visiting.
		 * They are potential sub types of an `targetSuperTypes`
		 */
    final Deque<CtTypeReference<?>> currentSubTypes = new ArrayDeque<>();
    // algorithm
    // 1) query step: scan input package for sub classes and sub interfaces
    final CtQuery q = inputPackage.map(new CtScannerFunction());
    // 2) query step: visit only required CtTypes
    if (includingInterfaces) {
        // the client is interested in sub inheritance hierarchy of interfaces too. Check interfaces, classes, enums, Annotations, but not CtTypeParameters.
        q.select(typeFilter);
    } else {
        // the client is not interested in sub inheritance hierarchy of interfaces. Check only classes and enums.
        q.select(classFilter);
    }
    /*
		 * 3) query step: for each found CtType, visit it's super inheritance hierarchy and search there for a type which is equal to one of targetSuperTypes.
		 * If found then all sub types in hierarchy (variable `currentSubTypes`) are sub types of targetSuperTypes. So return them
		 */
    q.map(new SuperInheritanceHierarchyFunction().includingInterfaces(hasSuperInterface).failOnClassNotFound(failOnClassNotFound).setListener(new CtScannerListener() {

        @Override
        public ScanningMode enter(CtElement element) {
            final CtTypeReference<?> typeRef = (CtTypeReference<?>) element;
            String qName = typeRef.getQualifiedName();
            if (targetSuperTypes.contains(qName)) {
                /*
						 * FOUND! we are in super inheritance hierarchy, which extends from an searched super type(s).
						 * All `currentSubTypes` are sub types of searched super type
						 */
                while (currentSubTypes.size() > 0) {
                    final CtTypeReference<?> currentTypeRef = currentSubTypes.pop();
                    String currentQName = currentTypeRef.getQualifiedName();
                    /*
							 * Send them to outputConsumer and add then as targetSuperTypes too, to perform faster with detection of next sub types.
							 */
                    if (!targetSuperTypes.contains(currentQName)) {
                        targetSuperTypes.add(currentQName);
                        outputConsumer.accept((T) currentTypeRef.getTypeDeclaration());
                    }
                }
                // but continue visiting of siblings (do not terminate query)
                return SKIP_ALL;
            }
            if (allVisitedTypeNames.add(qName) == false) {
                /*
						 * this type was already visited, by another way. So it is not sub type of `targetSuperTypes`.
						 * Stop visiting it's inheritance hierarchy.
						 */
                return SKIP_ALL;
            }
            /*
					 * This type was not visited yet.
					 * We still do not know whether this type is a sub type of any target super type(s)
					 * continue searching in super inheritance hierarchy
					 */
            currentSubTypes.push(typeRef);
            return NORMAL;
        }

        @Override
        public void exit(CtElement element) {
            CtTypeInformation type = (CtTypeInformation) element;
            if (currentSubTypes.isEmpty() == false) {
                // remove current type, which is not a sub type of targetSuperTypes from the currentSubTypes
                CtTypeInformation stackType = currentSubTypes.pop();
                if (stackType != type) {
                    // the enter/exit was not called consistently. There is a bug in SuperInheritanceHierarchyFunction
                    throw new SpoonException("CtScannerListener#exit was not called after enter.");
                }
            }
        }
    })).forEach(new CtConsumer<CtType<?>>() {

        @Override
        public void accept(CtType<?> type) {
        // we do not care about types visited by query `q`.
        // the result of whole mapping function was already produced by `sendResult` call
        // but we have to consume all these results to let query running
        }
    });
}
Also used : SuperInheritanceHierarchyFunction(spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction) SpoonException(spoon.SpoonException) CtElement(spoon.reflect.declaration.CtElement) CtQuery(spoon.reflect.visitor.chain.CtQuery) CtTypeInformation(spoon.reflect.declaration.CtTypeInformation) ArrayDeque(java.util.ArrayDeque) ScanningMode(spoon.reflect.visitor.chain.ScanningMode) CtType(spoon.reflect.declaration.CtType) CtTypeReference(spoon.reflect.reference.CtTypeReference) CtScannerFunction(spoon.reflect.visitor.filter.CtScannerFunction) CtScannerListener(spoon.reflect.visitor.chain.CtScannerListener) HashSet(java.util.HashSet)

Example 3 with SuperInheritanceHierarchyFunction

use of spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction in project spoon by INRIA.

the class MetamodelTest method testRoleOnField.

@Test
public void testRoleOnField() {
    // contract: all non-final fields must be annotated with {@link spoon.reflect.annotations.MetamodelPropertyField}
    SpoonAPI implementations = new Launcher();
    implementations.addInputResource("src/main/java/spoon/support/reflect");
    implementations.buildModel();
    Factory factory = implementations.getFactory();
    CtTypeReference metamodelPropertyField = factory.Type().get(MetamodelPropertyField.class).getReference();
    final List<String> result = new ArrayList();
    List<CtField> fieldWithoutAnnotation = (List<CtField>) implementations.getModel().getElements(new TypeFilter<CtField>(CtField.class) {

        @Override
        public boolean matches(CtField candidate) {
            if (candidate.hasModifier(ModifierKind.FINAL) || candidate.hasModifier(ModifierKind.STATIC) || candidate.hasModifier(ModifierKind.TRANSIENT)) {
                return false;
            }
            if (// not a role
            "parent".equals(candidate.getSimpleName()) || "metadata".equals(candidate.getSimpleName()) || // cache field
            "valueOfMethod".equals(candidate.getSimpleName())) {
                return false;
            }
            CtClass parent = candidate.getParent(CtClass.class);
            return parent != null && (parent.isSubtypeOf(candidate.getFactory().createCtTypeReference(CtReference.class)) || parent.isSubtypeOf(candidate.getFactory().createCtTypeReference(CtElement.class)));
        }
    }).stream().map(x -> {
        result.add(x.toString());
        return x;
    }).filter(f -> f.getAnnotation(metamodelPropertyField) == null).collect(Collectors.toList());
    assertTrue(result.contains("@spoon.reflect.annotations.MetamodelPropertyField(role = spoon.reflect.path.CtRole.IS_SHADOW)\nboolean isShadow;"));
    assertTrue(result.contains("@spoon.reflect.annotations.MetamodelPropertyField(role = spoon.reflect.path.CtRole.TYPE)\nspoon.reflect.reference.CtTypeReference<T> type;"));
    assertTrue(result.size() > 100);
    Assert.assertEquals(Collections.emptyList(), fieldWithoutAnnotation);
    final CtTypeReference propertySetter = factory.Type().get(PropertySetter.class).getReference();
    final CtTypeReference propertyGetter = factory.Type().get(PropertyGetter.class).getReference();
    List<CtField> fields = factory.getModel().getElements(new AnnotationFilter<CtField>(MetamodelPropertyField.class));
    for (CtField field : fields) {
        CtClass parent = field.getParent(CtClass.class);
        CtExpression roleExpression = field.getAnnotation(metamodelPropertyField).getValue("role");
        List<String> roles = new ArrayList<>();
        if (roleExpression instanceof CtFieldRead) {
            roles.add(((CtFieldRead) roleExpression).getVariable().getSimpleName());
        } else if (roleExpression instanceof CtNewArray) {
            List<CtFieldRead> elements = ((CtNewArray) roleExpression).getElements();
            for (int i = 0; i < elements.size(); i++) {
                CtFieldRead ctFieldRead = elements.get(i);
                roles.add(ctFieldRead.getVariable().getSimpleName());
            }
        }
        CtQuery superQuery = parent.map(new SuperInheritanceHierarchyFunction());
        List<CtMethod> methods = superQuery.map((CtType type) -> type.getMethodsAnnotatedWith(propertyGetter, propertySetter)).list();
        boolean setterFound = false;
        boolean getterFound = false;
        for (CtMethod method : methods) {
            CtAnnotation getterAnnotation = method.getAnnotation(propertyGetter);
            CtAnnotation setterAnnotation = method.getAnnotation(propertySetter);
            if (getterAnnotation != null) {
                getterFound |= roles.contains(((CtFieldRead) getterAnnotation.getValue("role")).getVariable().getSimpleName());
            }
            if (setterAnnotation != null) {
                setterFound |= roles.contains(((CtFieldRead) setterAnnotation.getValue("role")).getVariable().getSimpleName());
            }
        }
        assertTrue(roles + " must have a getter in " + parent.getQualifiedName(), getterFound);
        assertTrue(roles + " must have a setter in " + parent.getQualifiedName(), setterFound);
    }
}
Also used : Arrays(java.util.Arrays) Launcher(spoon.Launcher) IsEqual.equalTo(org.hamcrest.core.IsEqual.equalTo) CtRole(spoon.reflect.path.CtRole) ArrayList(java.util.ArrayList) CtType(spoon.reflect.declaration.CtType) CtElement(spoon.reflect.declaration.CtElement) SpoonAPI(spoon.SpoonAPI) CtExpression(spoon.reflect.code.CtExpression) CtNewArray(spoon.reflect.code.CtNewArray) Metamodel(spoon.Metamodel) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) CtQuery(spoon.reflect.visitor.chain.CtQuery) TypeFilter(spoon.reflect.visitor.filter.TypeFilter) CtField(spoon.reflect.declaration.CtField) CtReference(spoon.reflect.reference.CtReference) MetamodelPropertyField(spoon.reflect.annotations.MetamodelPropertyField) SuperInheritanceHierarchyFunction(spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Factory(spoon.reflect.factory.Factory) PropertySetter(spoon.reflect.annotations.PropertySetter) Collectors(java.util.stream.Collectors) CtTypeReference(spoon.reflect.reference.CtTypeReference) List(java.util.List) CtAnnotation(spoon.reflect.declaration.CtAnnotation) AnnotationFilter(spoon.reflect.visitor.filter.AnnotationFilter) CtClass(spoon.reflect.declaration.CtClass) ModifierKind(spoon.reflect.declaration.ModifierKind) CtFieldRead(spoon.reflect.code.CtFieldRead) Assert(org.junit.Assert) Collections(java.util.Collections) PropertyGetter(spoon.reflect.annotations.PropertyGetter) CtMethod(spoon.reflect.declaration.CtMethod) ArrayList(java.util.ArrayList) Factory(spoon.reflect.factory.Factory) TypeFilter(spoon.reflect.visitor.filter.TypeFilter) CtNewArray(spoon.reflect.code.CtNewArray) CtTypeReference(spoon.reflect.reference.CtTypeReference) CtField(spoon.reflect.declaration.CtField) PropertyGetter(spoon.reflect.annotations.PropertyGetter) ArrayList(java.util.ArrayList) List(java.util.List) SpoonAPI(spoon.SpoonAPI) SuperInheritanceHierarchyFunction(spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction) CtAnnotation(spoon.reflect.declaration.CtAnnotation) CtFieldRead(spoon.reflect.code.CtFieldRead) CtExpression(spoon.reflect.code.CtExpression) PropertySetter(spoon.reflect.annotations.PropertySetter) CtQuery(spoon.reflect.visitor.chain.CtQuery) MetamodelPropertyField(spoon.reflect.annotations.MetamodelPropertyField) CtClass(spoon.reflect.declaration.CtClass) CtType(spoon.reflect.declaration.CtType) Launcher(spoon.Launcher) CtMethod(spoon.reflect.declaration.CtMethod) Test(org.junit.Test)

Example 4 with SuperInheritanceHierarchyFunction

use of spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction in project spoon by INRIA.

the class ClassTypingContext method resolveActualTypeArgumentsOf.

/**
 * resolve actual type argument values of the provided type reference
 * @param typeRef the reference to the type
 * 	whose actual type argument values has to be resolved in scope of `scope` type
 * @return actual type arguments of `typeRef` in scope of `scope` element or null if typeRef is not a super type of `scope`
 */
public List<CtTypeReference<?>> resolveActualTypeArgumentsOf(CtTypeReference<?> typeRef) {
    final String typeQualifiedName = typeRef.getQualifiedName();
    List<CtTypeReference<?>> args = typeToArguments.get(typeQualifiedName);
    if (args != null) {
        // the actual type arguments of `type` are already resolved
        return args;
    }
    // resolve hierarchy of enclosing class first.
    CtTypeReference<?> enclosingTypeRef = getEnclosingType(typeRef);
    if (enclosingTypeRef != null) {
        if (enclosingClassTypingContext == null) {
            return null;
        }
        // `type` is inner class. Resolve it's enclosing class arguments first
        if (enclosingClassTypingContext.resolveActualTypeArgumentsOf(enclosingTypeRef) == null) {
            return null;
        }
    }
    /*
		 * detect where to start/continue with resolving of super classes and super interfaces
		 * to found actual type arguments of input `type`
		 */
    if (lastResolvedSuperclass == null) {
        /*
			 * whole super inheritance hierarchy was already resolved for this level.
			 * It means that `type` is not a super type of `scope` on the level `level`
			 */
        return null;
    }
    final HierarchyListener listener = new HierarchyListener(getVisitedSet());
    /*
		 * remove last resolved class from the list of visited,
		 * because it would avoid visiting it's super hierarchy
		 */
    getVisitedSet().remove(lastResolvedSuperclass.getQualifiedName());
    /*
		 * visit super inheritance class hierarchy of lastResolve type of level of `type` to found it's actual type arguments.
		 */
    ((CtElement) lastResolvedSuperclass).map(new SuperInheritanceHierarchyFunction().includingSelf(false).returnTypeReferences(true).setListener(listener)).forEach(new CtConsumer<CtTypeReference<?>>() {

        @Override
        public void accept(CtTypeReference<?> typeRef) {
            /*
				 * typeRef is a reference from sub type to super type.
				 * It contains actual type arguments in scope of sub type,
				 * which are going to be substituted as arguments to formal type parameters of super type
				 */
            String superTypeQualifiedName = typeRef.getQualifiedName();
            List<CtTypeReference<?>> actualTypeArguments = typeRef.getActualTypeArguments();
            if (actualTypeArguments.isEmpty()) {
                // may be they are not set - check whether type declares some generic parameters
                List<CtTypeParameter> typeParams;
                try {
                    CtType<?> type = typeRef.getTypeDeclaration();
                    typeParams = type.getFormalCtTypeParameters();
                } catch (final SpoonClassNotFoundException e) {
                    if (typeRef.getFactory().getEnvironment().getNoClasspath()) {
                        typeParams = Collections.emptyList();
                    } else {
                        throw e;
                    }
                }
                if (typeParams.size() > 0) {
                    // yes, there are generic type parameters. Reference should use actualTypeArguments computed from their bounds
                    actualTypeArguments = new ArrayList<>(typeParams.size());
                    for (CtTypeParameter typeParam : typeParams) {
                        actualTypeArguments.add(typeParam.getTypeErasure());
                    }
                }
            }
            List<CtTypeReference<?>> superTypeActualTypeArgumentsResolvedFromSubType = resolveTypeParameters(actualTypeArguments);
            // Remember actual type arguments of `type`
            typeToArguments.put(superTypeQualifiedName, superTypeActualTypeArgumentsResolvedFromSubType);
            if (typeQualifiedName.equals(superTypeQualifiedName)) {
                /*
					 * we have found actual type arguments of input `type`
					 * We can finish. But only after all interfaces of last visited class are processed too
					 */
                listener.foundArguments = superTypeActualTypeArgumentsResolvedFromSubType;
            }
        }
    });
    if (listener.foundArguments == null) {
        /*
			 * superclass was not found. We have scanned whole hierarchy
			 */
        lastResolvedSuperclass = null;
    }
    return listener.foundArguments;
}
Also used : SuperInheritanceHierarchyFunction(spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction) CtTypeParameter(spoon.reflect.declaration.CtTypeParameter) ArrayList(java.util.ArrayList) CtType(spoon.reflect.declaration.CtType) CtTypeReference(spoon.reflect.reference.CtTypeReference) SpoonClassNotFoundException(spoon.support.SpoonClassNotFoundException) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with SuperInheritanceHierarchyFunction

use of spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction in project spoon by INRIA.

the class ImportTest method testSuperInheritanceHierarchyFunctionListener.

@Test
public void testSuperInheritanceHierarchyFunctionListener() throws Exception {
    CtType<?> clientClass = (CtClass<?>) ModelUtils.buildClass(ClientClass.class);
    CtTypeReference<?> childClass = clientClass.getSuperclass();
    CtTypeReference<?> superClass = childClass.getSuperclass();
    // contract: the enter and exit are always called with CtTypeReference instance
    List<String> result = clientClass.map(new SuperInheritanceHierarchyFunction().includingSelf(true).setListener(new CtScannerListener() {

        @Override
        public ScanningMode enter(CtElement element) {
            assertTrue(element instanceof CtTypeReference);
            return ScanningMode.NORMAL;
        }

        @Override
        public void exit(CtElement element) {
            assertTrue(element instanceof CtTypeReference);
        }
    })).map(e -> {
        assertTrue(e instanceof CtType);
        return ((CtType) e).getQualifiedName();
    }).list();
    assertTrue(result.contains(clientClass.getQualifiedName()));
    assertTrue(result.contains(childClass.getQualifiedName()));
    assertTrue(result.contains(superClass.getQualifiedName()));
    assertTrue(result.contains(Object.class.getName()));
    // contract: if listener skips ALL, then skipped element and all super classes are not returned
    result = clientClass.map(new SuperInheritanceHierarchyFunction().includingSelf(true).setListener(new CtScannerListener() {

        @Override
        public ScanningMode enter(CtElement element) {
            assertTrue(element instanceof CtTypeReference);
            if (superClass.getQualifiedName().equals(((CtTypeReference<?>) element).getQualifiedName())) {
                return ScanningMode.SKIP_ALL;
            }
            return ScanningMode.NORMAL;
        }

        @Override
        public void exit(CtElement element) {
            assertTrue(element instanceof CtTypeReference);
        }
    })).map(e -> {
        assertTrue(e instanceof CtType);
        return ((CtType) e).getQualifiedName();
    }).list();
    assertTrue(result.contains(clientClass.getQualifiedName()));
    assertTrue(result.contains(childClass.getQualifiedName()));
    assertFalse(result.contains(superClass.getQualifiedName()));
    assertFalse(result.contains(Object.class.getName()));
    // contract: if listener skips CHIDLREN, then skipped element is returned but all super classes are not returned
    result = clientClass.map(new SuperInheritanceHierarchyFunction().includingSelf(true).setListener(new CtScannerListener() {

        @Override
        public ScanningMode enter(CtElement element) {
            assertTrue(element instanceof CtTypeReference);
            if (superClass.getQualifiedName().equals(((CtTypeReference<?>) element).getQualifiedName())) {
                return ScanningMode.SKIP_CHILDREN;
            }
            return ScanningMode.NORMAL;
        }

        @Override
        public void exit(CtElement element) {
            assertTrue(element instanceof CtTypeReference);
        }
    })).map(e -> {
        assertTrue(e instanceof CtType);
        return ((CtType) e).getQualifiedName();
    }).list();
    assertTrue(result.contains(clientClass.getQualifiedName()));
    assertTrue(result.contains(childClass.getQualifiedName()));
    assertTrue(result.contains(superClass.getQualifiedName()));
    assertFalse(result.contains(Object.class.getName()));
}
Also used : Arrays(java.util.Arrays) Launcher(spoon.Launcher) SortedList(spoon.support.util.SortedList) Assert.assertThat(org.junit.Assert.assertThat) CtType(spoon.reflect.declaration.CtType) CtElement(spoon.reflect.declaration.CtElement) Reflection(spoon.test.imports.testclasses.Reflection) CtTypeAccess(spoon.reflect.code.CtTypeAccess) Assert.fail(org.junit.Assert.fail) Query(spoon.reflect.visitor.Query) ClientClass(spoon.test.imports.testclasses.ClientClass) CtThisAccess(spoon.reflect.code.CtThisAccess) CtImport(spoon.reflect.declaration.CtImport) TypeFilter(spoon.reflect.visitor.filter.TypeFilter) CtField(spoon.reflect.declaration.CtField) CtReference(spoon.reflect.reference.CtReference) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) SpoonResourceHelper(spoon.compiler.SpoonResourceHelper) SpoonException(spoon.SpoonException) Collection(java.util.Collection) ImportScannerImpl(spoon.reflect.visitor.ImportScannerImpl) Set(java.util.Set) ModelUtils(spoon.testing.utils.ModelUtils) Collectors(java.util.stream.Collectors) NamedElementFilter(spoon.reflect.visitor.filter.NamedElementFilter) IOUtils(org.apache.commons.io.IOUtils) NotImportExecutableType(spoon.test.imports.testclasses.NotImportExecutableType) List(java.util.List) Assert.assertFalse(org.junit.Assert.assertFalse) CtParameter(spoon.reflect.declaration.CtParameter) CtMethod(spoon.reflect.declaration.CtMethod) CtLocalVariable(spoon.reflect.code.CtLocalVariable) CompilationUnit(spoon.reflect.cu.CompilationUnit) CtStatement(spoon.reflect.code.CtStatement) ArrayList(java.util.ArrayList) SpoonModelBuilder(spoon.SpoonModelBuilder) ClassWithInvocation(spoon.test.imports.testclasses.ClassWithInvocation) HashSet(java.util.HashSet) Assert.assertSame(org.junit.Assert.assertSame) CtExecutableReference(spoon.reflect.reference.CtExecutableReference) ChildClass(spoon.test.imports.testclasses.internal.ChildClass) ModelUtils.canBeBuilt(spoon.testing.utils.ModelUtils.canBeBuilt) StringTokenizer(java.util.StringTokenizer) SpoonResource(spoon.compiler.SpoonResource) ScanningMode(spoon.reflect.visitor.chain.ScanningMode) CtLineElementComparator(spoon.support.comparator.CtLineElementComparator) CtScannerListener(spoon.reflect.visitor.chain.CtScannerListener) PrettyPrinter(spoon.reflect.visitor.PrettyPrinter) A(spoon.test.imports.testclasses.A) ImportScanner(spoon.reflect.visitor.ImportScanner) CtInvocation(spoon.reflect.code.CtInvocation) CtImportKind(spoon.reflect.declaration.CtImportKind) Assert.assertNotNull(org.junit.Assert.assertNotNull) SuperInheritanceHierarchyFunction(spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) Factory(spoon.reflect.factory.Factory) Mole(spoon.test.imports.testclasses.Mole) Tacos(spoon.test.imports.testclasses.Tacos) File(java.io.File) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) Pozole(spoon.test.imports.testclasses.Pozole) CtTypeReference(spoon.reflect.reference.CtTypeReference) StaticNoOrdered(spoon.test.imports.testclasses.StaticNoOrdered) Assert.assertNull(org.junit.Assert.assertNull) SubClass(spoon.test.imports.testclasses.SubClass) CtConstructorCall(spoon.reflect.code.CtConstructorCall) CtModel(spoon.reflect.CtModel) CtClass(spoon.reflect.declaration.CtClass) ModifierKind(spoon.reflect.declaration.ModifierKind) DefaultJavaPrettyPrinter(spoon.reflect.visitor.DefaultJavaPrettyPrinter) FileReader(java.io.FileReader) Assert.assertEquals(org.junit.Assert.assertEquals) SuperInheritanceHierarchyFunction(spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction) CtElement(spoon.reflect.declaration.CtElement) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ClientClass(spoon.test.imports.testclasses.ClientClass) ScanningMode(spoon.reflect.visitor.chain.ScanningMode) CtClass(spoon.reflect.declaration.CtClass) CtType(spoon.reflect.declaration.CtType) CtTypeReference(spoon.reflect.reference.CtTypeReference) CtScannerListener(spoon.reflect.visitor.chain.CtScannerListener) Test(org.junit.Test)

Aggregations

CtTypeReference (spoon.reflect.reference.CtTypeReference)7 SuperInheritanceHierarchyFunction (spoon.reflect.visitor.filter.SuperInheritanceHierarchyFunction)7 CtType (spoon.reflect.declaration.CtType)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Test (org.junit.Test)4 Launcher (spoon.Launcher)4 CtElement (spoon.reflect.declaration.CtElement)4 Arrays (java.util.Arrays)3 HashSet (java.util.HashSet)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 SpoonException (spoon.SpoonException)3 CtModel (spoon.reflect.CtModel)3 CtClass (spoon.reflect.declaration.CtClass)3 CtField (spoon.reflect.declaration.CtField)3 CtMethod (spoon.reflect.declaration.CtMethod)3 ModifierKind (spoon.reflect.declaration.ModifierKind)3 Factory (spoon.reflect.factory.Factory)3