com.sun.jdi.InterfaceType Java Examples

The following examples show how to use com.sun.jdi.InterfaceType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AWTGrabHandler.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void ungrabWindowFX(ClassType WindowClass, ObjectReference w, ThreadReference tr) throws Exception {
    // javafx.stage.Window w
    // w.focusGrabCounter
    // while (focusGrabCounter-- > 0) {
    //     w.impl_getPeer().ungrabFocus(); OR: w.impl_peer.ungrabFocus();
    // }
    Field focusGrabCounterField = WindowClass.fieldByName("focusGrabCounter");
    if (focusGrabCounterField == null) {
        logger.info("Unable to release FX X grab, no focusGrabCounter field in "+w);
        return ;
    }
    Value focusGrabCounterValue = w.getValue(focusGrabCounterField);
    if (!(focusGrabCounterValue instanceof IntegerValue)) {
        logger.info("Unable to release FX X grab, focusGrabCounter does not have an integer value in "+w);
        return ;
    }
    int focusGrabCounter = ((IntegerValue) focusGrabCounterValue).intValue();
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Focus grab counter of "+w+" is: "+focusGrabCounter);
    }
    while (focusGrabCounter-- > 0) {
        //Method impl_getPeerMethod = WindowClass.concreteMethodByName("impl_getPeer", "");
        Field impl_peerField = WindowClass.fieldByName("impl_peer");
        if (impl_peerField == null) {
            logger.info("Unable to release FX X grab, no impl_peer field in "+w);
            return ;
        }
        ObjectReference impl_peer = (ObjectReference) w.getValue(impl_peerField);
        if (impl_peer == null) {
            continue;
        }
        InterfaceType TKStageClass = (InterfaceType) w.virtualMachine().classesByName("com.sun.javafx.tk.TKStage").get(0);
        Method ungrabFocusMethod = TKStageClass.methodsByName("ungrabFocus", "()V").get(0);
        impl_peer.invokeMethod(tr, ungrabFocusMethod, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("FX Window "+w+" was successfully ungrabbed.");
        }
    }
}
 
Example #2
Source File: InvokableTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #3
Source File: InvokableTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #4
Source File: InvokableTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
    /*
     * Add methods from
     * parent types first, so that the methods in this class will
     * overwrite them in the hash table
     */
    Iterator<InterfaceType> iter = interfaces().iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        if (!seenInterfaces.contains(interfaze)) {
            interfaze.addVisibleMethods(methodMap, seenInterfaces);
            seenInterfaces.add(interfaze);
        }
    }
    ClassTypeImpl clazz = (ClassTypeImpl) superclass();
    if (clazz != null) {
        clazz.addVisibleMethods(methodMap, seenInterfaces);
    }
    addToMethodMap(methodMap, methods());
}
 
Example #5
Source File: InvokableTypeImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #6
Source File: InvokableTypeImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #7
Source File: InvokableTypeImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #8
Source File: InvokableTypeImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
    /*
     * Add methods from
     * parent types first, so that the methods in this class will
     * overwrite them in the hash table
     */
    Iterator<InterfaceType> iter = interfaces().iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        if (!seenInterfaces.contains(interfaze)) {
            interfaze.addVisibleMethods(methodMap, seenInterfaces);
            seenInterfaces.add(interfaze);
        }
    }
    ClassTypeImpl clazz = (ClassTypeImpl) superclass();
    if (clazz != null) {
        clazz.addVisibleMethods(methodMap, seenInterfaces);
    }
    addToMethodMap(methodMap, methods());
}
 
Example #9
Source File: InvokableTypeImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #10
Source File: InvokableTypeImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
    /*
     * Add methods from
     * parent types first, so that the methods in this class will
     * overwrite them in the hash table
     */
    Iterator<InterfaceType> iter = interfaces().iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        if (!seenInterfaces.contains(interfaze)) {
            interfaze.addVisibleMethods(methodMap, seenInterfaces);
            seenInterfaces.add(interfaze);
        }
    }
    ClassTypeImpl clazz = (ClassTypeImpl) superclass();
    if (clazz != null) {
        clazz.addVisibleMethods(methodMap, seenInterfaces);
    }
    addToMethodMap(methodMap, methods());
}
 
Example #11
Source File: InvokableTypeImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #12
Source File: InvokableTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #13
Source File: InvokableTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #14
Source File: InvokableTypeImpl.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #15
Source File: InvokableTypeImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #16
Source File: InvokableTypeImpl.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
    /*
     * Add methods from
     * parent types first, so that the methods in this class will
     * overwrite them in the hash table
     */
    Iterator<InterfaceType> iter = interfaces().iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        if (!seenInterfaces.contains(interfaze)) {
            interfaze.addVisibleMethods(methodMap, seenInterfaces);
            seenInterfaces.add(interfaze);
        }
    }
    ClassTypeImpl clazz = (ClassTypeImpl) superclass();
    if (clazz != null) {
        clazz.addVisibleMethods(methodMap, seenInterfaces);
    }
    addToMethodMap(methodMap, methods());
}
 
Example #17
Source File: InvokableTypeImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
    /*
     * Add methods from
     * parent types first, so that the methods in this class will
     * overwrite them in the hash table
     */
    Iterator<InterfaceType> iter = interfaces().iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        if (!seenInterfaces.contains(interfaze)) {
            interfaze.addVisibleMethods(methodMap, seenInterfaces);
            seenInterfaces.add(interfaze);
        }
    }
    ClassTypeImpl clazz = (ClassTypeImpl) superclass();
    if (clazz != null) {
        clazz.addVisibleMethods(methodMap, seenInterfaces);
    }
    addToMethodMap(methodMap, methods());
}
 
Example #18
Source File: InvokableTypeImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #19
Source File: InvokableTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #20
Source File: InvokableTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
    /*
     * Add methods from
     * parent types first, so that the methods in this class will
     * overwrite them in the hash table
     */
    Iterator<InterfaceType> iter = interfaces().iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        if (!seenInterfaces.contains(interfaze)) {
            interfaze.addVisibleMethods(methodMap, seenInterfaces);
            seenInterfaces.add(interfaze);
        }
    }
    ClassTypeImpl clazz = (ClassTypeImpl) superclass();
    if (clazz != null) {
        clazz.addVisibleMethods(methodMap, seenInterfaces);
    }
    addToMethodMap(methodMap, methods());
}
 
Example #21
Source File: VariableDetailUtils.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
private static boolean containsToStringMethod(ObjectReference obj) {
    ReferenceType refType = obj.referenceType();
    if (refType instanceof ClassType) {
        Method m = ((ClassType) refType).concreteMethodByName(TO_STRING_METHOD, TO_STRING_METHOD_SIGNATURE);
        if (m != null) {
            if (!Objects.equals("Ljava/lang/Object;", m.declaringType().signature())) {
                return true;
            }
        }

        for (InterfaceType iface : ((ClassType) refType).allInterfaces()) {
            List<Method> matches = iface.methodsByName(TO_STRING_METHOD, TO_STRING_METHOD_SIGNATURE);
            for (Method ifaceMethod : matches) {
                if (!ifaceMethod.isAbstract()) {
                    return true;
                }
            }
        }
    }

    return false;
}
 
Example #22
Source File: InvokableTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #23
Source File: JavaLogicalStructure.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns whether to support the logical structure view for the given object instance.
 */
public boolean providesLogicalStructure(ObjectReference obj) {
    Type variableType = obj.type();
    if (!(variableType instanceof ClassType)) {
        return false;
    }

    ClassType classType = (ClassType) variableType;
    while (classType != null) {
        if (Objects.equals(type, classType.name())) {
            return true;
        }

        classType = classType.superclass();
    }

    List<InterfaceType> interfaceTypes = ((ClassType) variableType).allInterfaces();
    for (InterfaceType interfaceType : interfaceTypes) {
        if (Objects.equals(type, interfaceType.name())) {
            return true;
        }
    }

    return false;
}
 
Example #24
Source File: InvokableTypeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #25
Source File: InvokableTypeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
    /*
     * Add methods from
     * parent types first, so that the methods in this class will
     * overwrite them in the hash table
     */
    Iterator<InterfaceType> iter = interfaces().iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        if (!seenInterfaces.contains(interfaze)) {
            interfaze.addVisibleMethods(methodMap, seenInterfaces);
            seenInterfaces.add(interfaze);
        }
    }
    ClassTypeImpl clazz = (ClassTypeImpl) superclass();
    if (clazz != null) {
        clazz.addVisibleMethods(methodMap, seenInterfaces);
    }
    addToMethodMap(methodMap, methods());
}
 
Example #26
Source File: InvokableTypeImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #27
Source File: InvokableTypeImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #28
Source File: InvokableTypeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Shared implementation of {@linkplain ClassType#allMethods()} and
 * {@linkplain InterfaceType#allMethods()}
 * @return A list of all methods (recursively)
 */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
     * Avoid duplicate checking on each method by iterating through
     * duplicate-free allInterfaces() rather than recursing
     */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
 
Example #29
Source File: InvokableTypeImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
boolean isAssignableTo(ReferenceType type) {
    ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
    if (this.equals(type)) {
        return true;
    } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
        return true;
    } else {
        List<InterfaceType> interfaces = interfaces();
        Iterator<InterfaceType> iter = interfaces.iterator();
        while (iter.hasNext()) {
            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
            if (interfaze.isAssignableTo(type)) {
                return true;
            }
        }
        return false;
    }
}
 
Example #30
Source File: InvokableTypeImpl.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
    /*
     * Add methods from
     * parent types first, so that the methods in this class will
     * overwrite them in the hash table
     */
    Iterator<InterfaceType> iter = interfaces().iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        if (!seenInterfaces.contains(interfaze)) {
            interfaze.addVisibleMethods(methodMap, seenInterfaces);
            seenInterfaces.add(interfaze);
        }
    }
    ClassTypeImpl clazz = (ClassTypeImpl) superclass();
    if (clazz != null) {
        clazz.addVisibleMethods(methodMap, seenInterfaces);
    }
    addToMethodMap(methodMap, methods());
}