Java 类com.sun.tools.classfile.Dependencies.ClassFileError 实例源码

项目:openjdk-jdk10    文件:ClassFileReader.java   
public boolean hasNext() {
    if (nextEntry != null && cf != null) {
        return true;
    }
    while (nextEntry != null) {
        try {
            cf = reader.readClassFile(jf, nextEntry);
            return true;
        } catch (ClassFileError | IOException ex) {
            skippedEntries.add(String.format("%s: %s (%s)",
                                             ex.getMessage(),
                                             nextEntry.getName(),
                                             jf.getName()));
        }
        nextEntry = nextEntry();
    }
    return false;
}
项目:OLD-OpenJDK8    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }

    ClassFile cf;
    try {
        cf = readClassFile(nextEntry);
    } catch (IOException ex) {
        throw new ClassFileError(ex);
    }
    JarEntry entry = nextEntry;
    nextEntry = null;
    while (entries.hasMoreElements()) {
        JarEntry e = entries.nextElement();
        String name = e.getName();
        if (name.endsWith(".class")) {
            nextEntry = e;
            break;
        }
    }
    return cf;
}
项目:OpenJSharp    文件:ClassFileReader.java   
protected ClassFile readClassFile(Path p) throws IOException {
    InputStream is = null;
    try {
        is = Files.newInputStream(p);
        return ClassFile.read(is);
    } catch (ConstantPoolException e) {
        throw new ClassFileError(e);
    } finally {
        if (is != null) {
            is.close();
        }
    }
}
项目:OpenJSharp    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    try {
        ClassFile cf = readClassFile(path);
        count++;
        return cf;
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:OpenJSharp    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    Path path = entries.get(index++);
    try {
        return readClassFile(path);
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:OpenJSharp    文件:ClassFileReader.java   
protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
    InputStream is = null;
    try {
        is = jarfile.getInputStream(e);
        return ClassFile.read(is);
    } catch (ConstantPoolException ex) {
        throw new ClassFileError(ex);
    } finally {
        if (is != null)
            is.close();
    }
}
项目:OpenJSharp    文件:ClassFileReader.java   
public boolean hasNext() {
    if (nextEntry != null && cf != null) {
        return true;
    }
    while (nextEntry != null) {
        try {
            cf = reader.readClassFile(jf, nextEntry);
            return true;
        } catch (ClassFileError | IOException ex) {
            skippedEntries.add(nextEntry.getName());
        }
        nextEntry = nextEntry();
    }
    return false;
}
项目:openjdk-jdk10    文件:ClassFileReader.java   
protected ClassFile readClassFile(Path p) throws IOException {
    InputStream is = null;
    try {
        is = Files.newInputStream(p);
        return ClassFile.read(is);
    } catch (ConstantPoolException e) {
        throw new ClassFileError(e);
    } finally {
        if (is != null) {
            is.close();
        }
    }
}
项目:openjdk-jdk10    文件:ClassFileReader.java   
protected Set<String> scan() {
    try {
        ClassFile cf = ClassFile.read(path);
        String name = cf.access_flags.is(AccessFlags.ACC_MODULE)
            ? "module-info" : cf.getName();
        return Collections.singleton(name);
    } catch (ConstantPoolException|IOException e) {
        throw new ClassFileError(e);
    }
}
项目:openjdk-jdk10    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    try {
        ClassFile cf = readClassFile(path);
        count++;
        return cf;
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:openjdk-jdk10    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    Path path = entries.get(index++);
    try {
        return readClassFile(path);
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:openjdk-jdk10    文件:ClassFileReader.java   
protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
    try (InputStream is = jarfile.getInputStream(e)) {
        ClassFile cf = ClassFile.read(is);
        if (jarfile.isMultiRelease()) {
            VersionHelper.add(jarfile, e, cf);
        }
        return cf;
    } catch (ConstantPoolException ex) {
        throw new ClassFileError(ex);
    }
}
项目:openjdk-jdk10    文件:DependencyFinder.java   
private Set<Location> parse(Archive archive, Finder finder, String name)
    throws IOException
{
    ClassFile cf = archive.reader().getClassFile(name);
    if (cf == null) {
        throw new IllegalArgumentException(archive.getName() +
            " does not contain " + name);
    }

    if (cf.access_flags.is(AccessFlags.ACC_MODULE))
        return Collections.emptySet();

    Set<Location> targets = new HashSet<>();
    String cn;
    try {
        cn =  cf.getName().replace('/', '.');
    } catch (ConstantPoolException e) {
        throw new Dependencies.ClassFileError(e);
    }

    if (!finder.accept(archive, cn, cf.access_flags))
        return targets;

    // tests if this class matches the -include
    if (!filter.matches(cn))
        return targets;

    // skip checking filter.matches
    for (Dependency d : finder.findDependencies(cf)) {
        if (filter.accepts(d)) {
            targets.add(d.getTarget());
            archive.addClass(d.getOrigin(), d.getTarget());
        } else {
            // ensure that the parsed class is added the archive
            archive.addClass(d.getOrigin());
        }
        parsedClasses.putIfAbsent(d.getOrigin(), archive);
    }
    return targets;
}
项目:openjdk9    文件:ClassFileReader.java   
protected ClassFile readClassFile(Path p) throws IOException {
    InputStream is = null;
    try {
        is = Files.newInputStream(p);
        return ClassFile.read(is);
    } catch (ConstantPoolException e) {
        throw new ClassFileError(e);
    } finally {
        if (is != null) {
            is.close();
        }
    }
}
项目:openjdk9    文件:ClassFileReader.java   
protected Set<String> scan() {
    try {
        ClassFile cf = ClassFile.read(path);
        return Collections.singleton(cf.getName());
    } catch (ConstantPoolException|IOException e) {
        throw new ClassFileError(e);
    }
}
项目:openjdk9    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    try {
        ClassFile cf = readClassFile(path);
        count++;
        return cf;
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:openjdk9    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    Path path = entries.get(index++);
    try {
        return readClassFile(path);
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:openjdk9    文件:ClassFileReader.java   
protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
    InputStream is = null;
    try {
        is = jarfile.getInputStream(e);
        return ClassFile.read(is);
    } catch (ConstantPoolException ex) {
        throw new ClassFileError(ex);
    } finally {
        if (is != null)
            is.close();
    }
}
项目:openjdk9    文件:ClassFileReader.java   
public boolean hasNext() {
    if (nextEntry != null && cf != null) {
        return true;
    }
    while (nextEntry != null) {
        try {
            cf = reader.readClassFile(jf, nextEntry);
            return true;
        } catch (ClassFileError | IOException ex) {
            skippedEntries.add(nextEntry.getName());
        }
        nextEntry = nextEntry();
    }
    return false;
}
项目:lookaside_java-1.8.0-openjdk    文件:ClassFileReader.java   
protected ClassFile readClassFile(Path p) throws IOException {
    InputStream is = null;
    try {
        is = Files.newInputStream(p);
        return ClassFile.read(is);
    } catch (ConstantPoolException e) {
        throw new ClassFileError(e);
    } finally {
        if (is != null) {
            is.close();
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    try {
        ClassFile cf = readClassFile(path);
        count++;
        return cf;
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    Path path = entries.get(index++);
    try {
        return readClassFile(path);
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ClassFileReader.java   
protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
    InputStream is = null;
    try {
        is = jarfile.getInputStream(e);
        return ClassFile.read(is);
    } catch (ConstantPoolException ex) {
        throw new ClassFileError(ex);
    } finally {
        if (is != null)
            is.close();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ClassFileReader.java   
public boolean hasNext() {
    if (nextEntry != null && cf != null) {
        return true;
    }
    while (nextEntry != null) {
        try {
            cf = reader.readClassFile(jf, nextEntry);
            return true;
        } catch (ClassFileError | IOException ex) {
            skippedEntries.add(nextEntry.getName());
        }
        nextEntry = nextEntry();
    }
    return false;
}
项目:jsr308-langtools    文件:ClassFileReader.java   
protected ClassFile readClassFile(Path p) throws IOException {
    InputStream is = null;
    try {
        is = Files.newInputStream(p);
        return ClassFile.read(is);
    } catch (ConstantPoolException e) {
        throw new ClassFileError(e);
    } finally {
        if (is != null) {
            is.close();
        }
    }
}
项目:jsr308-langtools    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    try {
        ClassFile cf = readClassFile(path);
        count++;
        return cf;
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:jsr308-langtools    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    Path path = entries.get(index++);
    try {
        return readClassFile(path);
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:jsr308-langtools    文件:ClassFileReader.java   
protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
    InputStream is = null;
    try {
        is = jarfile.getInputStream(e);
        return ClassFile.read(is);
    } catch (ConstantPoolException ex) {
        throw new ClassFileError(ex);
    } finally {
        if (is != null)
            is.close();
    }
}
项目:jsr308-langtools    文件:ClassFileReader.java   
public boolean hasNext() {
    if (nextEntry != null && cf != null) {
        return true;
    }
    while (nextEntry != null) {
        try {
            cf = reader.readClassFile(jf, nextEntry);
            return true;
        } catch (ClassFileError | IOException ex) {
            skippedEntries.add(nextEntry.getName());
        }
        nextEntry = nextEntry();
    }
    return false;
}
项目:infobip-open-jdk-8    文件:ClassFileReader.java   
protected ClassFile readClassFile(Path p) throws IOException {
    InputStream is = null;
    try {
        is = Files.newInputStream(p);
        return ClassFile.read(is);
    } catch (ConstantPoolException e) {
        throw new ClassFileError(e);
    } finally {
        if (is != null) {
            is.close();
        }
    }
}
项目:infobip-open-jdk-8    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    try {
        ClassFile cf = readClassFile(path);
        count++;
        return cf;
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:infobip-open-jdk-8    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    Path path = entries.get(index++);
    try {
        return readClassFile(path);
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:infobip-open-jdk-8    文件:ClassFileReader.java   
protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
    InputStream is = null;
    try {
        is = jarfile.getInputStream(e);
        return ClassFile.read(is);
    } catch (ConstantPoolException ex) {
        throw new ClassFileError(ex);
    } finally {
        if (is != null)
            is.close();
    }
}
项目:infobip-open-jdk-8    文件:ClassFileReader.java   
public boolean hasNext() {
    if (nextEntry != null && cf != null) {
        return true;
    }
    while (nextEntry != null) {
        try {
            cf = reader.readClassFile(jf, nextEntry);
            return true;
        } catch (ClassFileError | IOException ex) {
            skippedEntries.add(nextEntry.getName());
        }
        nextEntry = nextEntry();
    }
    return false;
}
项目:OLD-OpenJDK8    文件:ClassFileReader.java   
protected ClassFile readClassFile(Path p) throws IOException {
    InputStream is = null;
    try {
        is = Files.newInputStream(p);
        return ClassFile.read(is);
    } catch (ConstantPoolException e) {
        throw new ClassFileError(e);
    } finally {
        if (is != null) {
            is.close();
        }
    }
}
项目:OLD-OpenJDK8    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    try {
        ClassFile cf = readClassFile(path);
        count++;
        return cf;
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:OLD-OpenJDK8    文件:ClassFileReader.java   
public ClassFile next() {
    if (!hasNext()) {
        throw new NoSuchElementException();
    }
    Path path = entries.get(index++);
    try {
        return readClassFile(path);
    } catch (IOException e) {
        throw new ClassFileError(e);
    }
}
项目:OLD-OpenJDK8    文件:ClassFileReader.java   
private ClassFile readClassFile(JarEntry e) throws IOException {
    InputStream is = null;
    try {
        is = jarfile.getInputStream(e);
        return ClassFile.read(is);
    } catch (ConstantPoolException ex) {
        throw new ClassFileError(ex);
    } finally {
        if (is != null)
            is.close();
    }
}
项目:openjdk-jdk10    文件:DependencyFinder.java   
private Optional<FutureTask<Set<Location>>> parse(Archive archive, Finder finder) {
    if (parsedArchives.get(finder).contains(archive))
        return Optional.empty();

    parsedArchives.get(finder).add(archive);

    trace("parsing %s %s%n", archive.getName(), archive.path());
    FutureTask<Set<Location>> task = new FutureTask<>(() -> {
        Set<Location> targets = new HashSet<>();
        for (ClassFile cf : archive.reader().getClassFiles()) {
            if (cf.access_flags.is(AccessFlags.ACC_MODULE))
                continue;

            String classFileName;
            try {
                classFileName = cf.getName();
            } catch (ConstantPoolException e) {
                throw new ClassFileError(e);
            }

            // filter source class/archive
            String cn = classFileName.replace('/', '.');
            if (!finder.accept(archive, cn, cf.access_flags))
                continue;

            // tests if this class matches the -include
            if (!filter.matches(cn))
                continue;

            for (Dependency d : finder.findDependencies(cf)) {
                if (filter.accepts(d)) {
                    archive.addClass(d.getOrigin(), d.getTarget());
                    targets.add(d.getTarget());
                } else {
                    // ensure that the parsed class is added the archive
                    archive.addClass(d.getOrigin());
                }
                parsedClasses.putIfAbsent(d.getOrigin(), archive);
            }
        }

        return targets;
    });
    tasks.add(task);
    pool.submit(task);
    return Optional.of(task);
}