public void visitAnnotation(Element enclosingElement, AnnotationMirror e) { visitTypeReference(enclosingElement, e.getAnnotationType()); if (!e.getElementValues().isEmpty()) { Map<? extends ExecutableElement, ? extends AnnotationValue> values = e.getElementValues(); Set<? extends ExecutableElement> methodsSet = values.keySet(); List<ExecutableElement> methodsList = new ArrayList<>(); for (ExecutableElement method : methodsSet) { if (values.get(method) == null) { continue; } methodsList.add(method); } for (int i = 0; i < methodsList.size(); i++) { AnnotationValue value = values.get(methodsList.get(i)); visitAnnotationValue(enclosingElement, value); } } }
@Override public Void visitVariable(VariableElement f, Void p) { visitAnnotations(f, f.getAnnotationMirrors()); visitTypeReference(f, f.asType()); return super.visitVariable(f, p); }
public void visitAnnotation(Element enclosingElement, AnnotationMirror e) { visitTypeReference(enclosingElement, e.getAnnotationType()); if (!e.getElementValues().isEmpty()) { Map<? extends ExecutableElement, ? extends AnnotationValue> values = e.getElementValues(); Set<? extends ExecutableElement> methodsSet = values.keySet(); List<ExecutableElement> methodsList = new ArrayList<>(); for (ExecutableElement method : methodsSet) { if (values.get(method) == null) { continue; } methodsList.add(method); } for (int i = 0; i < methodsList.size(); i++) { AnnotationValue value = values.get(methodsList.get(i)); visitAnnotationValue(enclosingElement, value); } } }
@Override public Void visitEnumConstant(VariableElement c, Void p) { visitTypeReference(enclosingElement, c.asType()); return null; }
private void visitAnnotations(Element enclosingElement, List<? extends AnnotationMirror> mirrors) { for (AnnotationMirror mirror : mirrors) { visitAnnotation(enclosingElement, mirror); } }
@Override public Void visitExecutable(CodeExecutableElement e, Void p) { visitAnnotations(e, e.getAnnotationMirrors()); if (e.getReturnType() != null) { visitTypeReference(e, e.getReturnType()); } for (TypeMirror type : e.getThrownTypes()) { visitTypeReference(e, type); } return super.visitExecutable(e, p); }
@Override public Void visitAnnotation(AnnotationMirror a, Void p) { TypeReferenceVisitor.this.visitAnnotation(enclosingElement, a); return null; }
private void visitAnnotations(Element enclosingElement, List<? extends AnnotationMirror> mirrors) { for (AnnotationMirror mirror : mirrors) { visitAnnotation(enclosingElement, mirror); } }
@Override public Void visitAnnotation(AnnotationMirror a, Void p) { TypeReferenceVisitor.this.visitAnnotation(enclosingElement, a); return null; }
@Override public Void visitType(CodeTypeElement e, Void p) { visitAnnotations(e, e.getAnnotationMirrors()); visitTypeReference(e, e.getSuperclass()); for (TypeMirror type : e.getImplements()) { visitTypeReference(e, type); } return super.visitType(e, p); }
@Override public Void visitEnumConstant(VariableElement c, Void p) { visitTypeReference(enclosingElement, c.asType()); return null; }
@Override public Void visitType(TypeMirror t, Void p) { visitTypeReference(enclosingElement, t); return null; }
@Override public Void visitArray(List<? extends AnnotationValue> vals, Void p) { for (int i = 0; i < vals.size(); i++) { TypeReferenceVisitor.this.visitAnnotationValue(enclosingElement, vals.get(i)); } return null; } }
@Override public Void visitArray(List<? extends AnnotationValue> vals, Void p) { for (int i = 0; i < vals.size(); i++) { TypeReferenceVisitor.this.visitAnnotationValue(enclosingElement, vals.get(i)); } return null; } }
@Override public Void visitVariable(VariableElement f, Void p) { visitAnnotations(f, f.getAnnotationMirrors()); visitTypeReference(f, f.asType()); return super.visitVariable(f, p); }
@Override public Void visitExecutable(CodeExecutableElement e, Void p) { visitAnnotations(e, e.getAnnotationMirrors()); if (e.getReturnType() != null) { visitTypeReference(e, e.getReturnType()); } for (TypeMirror type : e.getThrownTypes()) { visitTypeReference(e, type); } return super.visitExecutable(e, p); }
@Override public void visitTree(CodeTree e, Void p, Element enclosing) { if (e.getCodeKind() == CodeTreeKind.STATIC_FIELD_REFERENCE) { visitStaticFieldReference(enclosing, e.getType(), e.getString()); } else if (e.getCodeKind() == CodeTreeKind.STATIC_METHOD_REFERENCE) { visitStaticMethodReference(enclosing, e.getType(), e.getString()); } else if (e.getType() != null) { visitTypeReference(enclosing, e.getType()); } super.visitTree(e, p, enclosing); }
@Override public void visitTree(CodeTree e, Void p, Element enclosing) { if (e.getCodeKind() == CodeTreeKind.STATIC_FIELD_REFERENCE) { visitStaticFieldReference(enclosing, e.getType(), e.getString()); } else if (e.getCodeKind() == CodeTreeKind.STATIC_METHOD_REFERENCE) { visitStaticMethodReference(enclosing, e.getType(), e.getString()); } else if (e.getType() != null) { visitTypeReference(enclosing, e.getType()); } super.visitTree(e, p, enclosing); }
@Override public Void visitType(TypeMirror t, Void p) { visitTypeReference(enclosingElement, t); return null; }
@Override public Void visitType(CodeTypeElement e, Void p) { visitAnnotations(e, e.getAnnotationMirrors()); visitTypeReference(e, e.getSuperclass()); for (TypeMirror type : e.getImplements()) { visitTypeReference(e, type); } return super.visitType(e, p); }