@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final JavaClassNode other = (JavaClassNode) obj; if (this.typeHandle != other.typeHandle && (this.typeHandle == null || !this.typeHandle.equals(other.typeHandle))) { return false; } return true; }
public boolean equalsHandle(Delegate obj) { TreeDelegate other = (TreeDelegate) obj; if (this.correspondingEl != other.correspondingEl && (this.correspondingEl == null || !this.correspondingEl.equals(other.correspondingEl))) { return false; } if (this.enclosingElement != other.enclosingElement && (this.enclosingElement == null || !this.enclosingElement.equals(other.enclosingElement))) { return false; } if (this.position == null && other.position == null) { return true; } // TODO: swap file and position test ? if (this.position.getOffset() != other.position.getOffset()) { return false; } if (this.file != other.file && (this.file == null || !this.file.equals(other.file))) { return false; } return true; }
private static boolean containsAnnotatedJsfResource(CompilationController parameter) { if (jsfResourcesElementHandles == null) { loadJsfResourcesElementsHandles(parameter); } ClassIndex classIndex = parameter.getClasspathInfo().getClassIndex(); for (ElementHandle jsfResourceElementHandle : jsfResourcesElementHandles) { Set<ElementHandle<TypeElement>> elements = classIndex.getElements( jsfResourceElementHandle, EnumSet.of(ClassIndex.SearchKind.TYPE_REFERENCES), EnumSet.of(ClassIndex.SearchScope.SOURCE)); for (ElementHandle<TypeElement> handle : elements) { TypeElement element = handle.resolve(parameter); if (element != null) { List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors(); for (AnnotationMirror annotationMirror : annotationMirrors) { if (ElementHandle.create(annotationMirror.getAnnotationType().asElement()) .equals(jsfResourceElementHandle)) { return true; } } } } } return false; }