Java Code Examples for javax.lang.model.util.Elements.hides()

The following are Jave code examples for showing how to use hides() of the javax.lang.model.util.Elements class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: ElementUtilities.java   View Source Code Vote up 6 votes
private boolean isHidden(Element member, List<? extends Element> members, Elements elements, Types types) {
    for (ListIterator<? extends Element> it = members.listIterator(); it.hasNext();) {
        Element hider = it.next();
        if (hider == member)
            return true;
        if (hider.getSimpleName().contentEquals(member.getSimpleName())) {
            if (elements.hides(member, hider)) {
                it.remove();
            } else {
                if (member instanceof VariableElement && hider instanceof VariableElement
                        && (!member.getKind().isField() || hider.getKind().isField()))
                    return true;
                TypeMirror memberType = member.asType();
                TypeMirror hiderType = hider.asType();
                if (memberType.getKind() == TypeKind.EXECUTABLE && hiderType.getKind() == TypeKind.EXECUTABLE) {
                    if (types.isSubsignature((ExecutableType)hiderType, (ExecutableType)memberType))
                        return true;
                } else {
                    return false;
                }
            }
        }
    }
    return false;
}
 
Example 2
Project: incubator-netbeans   File: VarUsageVisitor.java   View Source Code Vote up 6 votes
private boolean isMethodAvailable(TypeElement subTypeElement, 
        ExecutableElement execElem, TypeElement superTypeElement) {
    Elements elements = workingCopy.getElements();
    List<? extends Element> memberElements = elements.getAllMembers(superTypeElement);
    for (Element elem : memberElements) {
        if(ElementKind.METHOD.equals(elem.getKind())){
            if(execElem.getModifiers().contains(Modifier.STATIC) && elements.hides(execElem, elem)){
                return true;
            }else{
                if(execElem.equals(elem) || elements.overrides(execElem, (ExecutableElement)elem, 
                        subTypeElement)){
                    return true;
                }
            }
        }
    }

    return false;
}
 
Example 3
Project: incubator-netbeans   File: UseSuperTypeRefactoringPlugin.java   View Source Code Vote up 5 votes
private boolean hidesSupTypeMember(Element methElement, TypeElement superTypeElement) {
    Elements elements = workingCopy.getElements();
    List<? extends Element> containedElements = elements.getAllMembers(superTypeElement);
    for (Element elem : containedElements) {
        boolean isPresentInSuperType = methElement.equals(elem) || 
                elements.hides(methElement, elem);
        if ((elem != null) && isStatic(elem) && isPresentInSuperType) {
            return true;
        }
    }
    return false;
}
 
Example 4
Project: incubator-netbeans   File: VarUsageVisitor.java   View Source Code Vote up 5 votes
private boolean isHidingMember(TypeElement subTypeElement, Element variableElement, 
        TypeElement superTypeElement) {
    //TODO: We do not handle nested types yet (includes enums)
    Elements elements = workingCopy.getElements();
    List<? extends Element> memberElements = elements.getAllMembers(superTypeElement);
    for (Element elem : memberElements) {
        if(variableElement.equals(elem) || elements.hides(variableElement, elem)){
            return true;
        }
    }
    return false;
}