Java 类com.sun.jdi.ClassNotPreparedException 实例源码

项目:openjdk-jdk10    文件:JDWPException.java   
RuntimeException toJDIException() {
    switch (errorCode) {
        case JDWP.Error.INVALID_OBJECT:
            return new ObjectCollectedException();
        case JDWP.Error.INVALID_MODULE:
            return new InvalidModuleException();
        case JDWP.Error.VM_DEAD:
            return new VMDisconnectedException();
        case JDWP.Error.OUT_OF_MEMORY:
            return new VMOutOfMemoryException();
        case JDWP.Error.CLASS_NOT_PREPARED:
            return new ClassNotPreparedException();
        case JDWP.Error.INVALID_FRAMEID:
        case JDWP.Error.NOT_CURRENT_FRAME:
            return new InvalidStackFrameException();
        case JDWP.Error.NOT_IMPLEMENTED:
            return new UnsupportedOperationException();
        case JDWP.Error.INVALID_INDEX:
        case JDWP.Error.INVALID_LENGTH:
            return new IndexOutOfBoundsException();
        case JDWP.Error.TYPE_MISMATCH:
            return new InconsistentDebugInfoException();
        case JDWP.Error.INVALID_THREAD:
            return new IllegalThreadStateException();
        default:
            return new InternalException("Unexpected JDWP Error: " + errorCode, errorCode);
    }
}
项目:openjdk9    文件:ReferenceTypeImpl.java   
public final List visibleMethods() throws ClassNotPreparedException {
    checkPrepared();
    /*
     * Build a collection of all visible methods. The hash
     * map allows us to do this efficiently by keying on the
     * concatenation of name and signature.
     */
    //System.out.println("jj: RTI: Calling addVisibleMethods for:" + this);
    Map<String, Method> map = new HashMap<String, Method>();
    addVisibleMethods(map, new HashSet<InterfaceType>());

    /*
     * ... but the hash map destroys order. Methods should be
     * returned in a sensible order, as they are in allMethods().
     * So, start over with allMethods() and use the hash map
     * to filter that ordered collection.
     */
    //System.out.println("jj: RTI: Calling allMethods for:" + this);

    List<Method> list = new ArrayList<Method>(allMethods());
    //System.out.println("jj: allMethods = " + jjstr(list));
    //System.out.println("jj: map = " + map.toString());
    //System.out.println("jj: map = " + jjstr(map.values()));
    list.retainAll(map.values());
    //System.out.println("jj: map = " + jjstr(list));
    //System.exit(0);
    return list;
}
项目:openjdk9    文件:ReferenceTypeImpl.java   
public final List methodsByName(String name) throws ClassNotPreparedException {
    // visibleMethods calls checkPrepared
    List methods = visibleMethods();
    ArrayList retList = new ArrayList(methods.size());
    Iterator iter = methods.iterator();
    while (iter.hasNext()) {
        Method candidate = (Method)iter.next();
        if (candidate.name().equals(name)) {
            retList.add(candidate);
        }
    }
    retList.trimToSize();
    return retList;
}
项目:openjdk9    文件:ReferenceTypeImpl.java   
public final List methodsByName(String name, String signature) throws ClassNotPreparedException {
    // visibleMethods calls checkPrepared
    List methods = visibleMethods();
    ArrayList retList = new ArrayList(methods.size());
    Iterator iter = methods.iterator();
    while (iter.hasNext()) {
        Method candidate = (Method)iter.next();
        if (candidate.name().equals(name) &&
            candidate.signature().equals(signature)) {
            retList.add(candidate);
        }
    }
    retList.trimToSize();
    return retList;
}
项目:openjdk9    文件:ReferenceTypeImpl.java   
final void checkPrepared() throws ClassNotPreparedException {
    if (! isPrepared()) {
        throw new ClassNotPreparedException();
    }
}
项目:openjdk9    文件:ReferenceTypeImpl.java   
public final List visibleFields() throws ClassNotPreparedException {
    checkPrepared();
    /*
     * Maintain two different collections of visible fields. The
     * list maintains a reasonable order for return. The
     * hash map provides an efficient way to lookup visible fields
     * by name, important for finding hidden or ambiguous fields.
     */
    List visibleList = new ArrayList();
    Map  visibleTable = new HashMap();

    /* Track fields removed from above collection due to ambiguity */
    List ambiguousNames = new ArrayList();

    /* Add inherited, visible fields */
    List types = inheritedTypes();
    Iterator iter = types.iterator();
    while (iter.hasNext()) {
        /*
         * TO DO: Be defensive and check for cyclic interface inheritance
         */
        ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
        type.addVisibleFields(visibleList, visibleTable, ambiguousNames);
    }

    /*
     * Insert fields from this type, removing any inherited fields they
     * hide.
     */
    List retList = new ArrayList(fields());
    iter = retList.iterator();
    while (iter.hasNext()) {
        Field field = (Field)iter.next();
        Field hidden = (Field)visibleTable.get(field.name());
        if (hidden != null) {
            visibleList.remove(hidden);
        }
    }
    retList.addAll(visibleList);
    return retList;
}