Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package net.sf.alchim.codeplus.spoonchecker;
 
 import java.util.Set;
 
public class TypeReferenceAnalyzer extends AbstractAnalyzer<CtType<?>> {
    @Override
    public void analyze(CtType<?> type) {
        Set<CtTypeReference<?>> typeRefs = type.getUsedTypes(true);
/*		for (CtTypeReference<?> typeRef : Query
                .getReferences(type, new ReferenceTypeFilter<CtTypeReference>(
                        Ct
                        TypeReference.class))) {
            if (!(typeRef.isPrimitive()
                    || (typeRef instanceof CtArrayTypeReference)
                    || typeRef.toString().equals(CtTypeReference.NULL_TYPE_NAME) || (typeRef
                    .getPackage() != null && "java.lang".equals(typeRef
                    .getPackage().toString())))
                    && !typeRef.getPackage().equals(
                            type.getPackage().getReference())) {
                typeRefs.add(typeRef);
            }
        }
*/		if (typeRefs.size() > 0) {
        report(type"type " + type.getReference() + " uses " + typeRefs);
    }
    @SuppressWarnings("unchecked")
    public static Set<CtTypeReference<?>> getTypeReferences(CtType<?> type) {
        ..print(type.getReference() + " => ");
        Set<CtTypeReference<?>> typeRefs = new HashSet<CtTypeReference<?>>();
        for (CtTypeReference<?> typeRef : Query
                .getReferences(typenew ReferenceTypeFilter<CtTypeReference>(
                        CtTypeReference.class))) {
            if (!(typeRef.isPrimitive()
                    || (typeRef instanceof CtArrayTypeReference)
                    || typeRef.toString().equals(.) || ((typeRef
                    .getPackage() != null) && "java.lang".equals(typeRef
                    .getPackage().toString())))
                    && !typeRef.getPackage().equals(
                            type.getPackage().getReference())) {
                typeRefs.add(typeRef);
            }
        }
        ..println(typeRefs);
        return typeRefs;
    }
New to GrepCode? Check out our FAQ X