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

项目:openjdk9    文件:JdepsFilter.java   
public JdepsFilter build() {
    Dependency.Filter filter = null;
    if (regex != null)
        filter = Dependencies.getRegexFilter(regex);
    else if (!targetPackages.isEmpty()) {
        filter = Dependencies.getPackageFilter(targetPackages, false);
    }
    return new JdepsFilter(filter,
                           filterPattern,
                           filterSamePackage,
                           filterSameArchive,
                           findJDKInterals,
                           includePattern,
                           includeSystemModules,
                           requires);
}
项目:OpenJSharp    文件:JdepsTask.java   
DependencyFilter() {
    if (options.regex != null) {
        this.filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
    } else if (options.packageNames.size() > 0) {
        this.filter = Dependencies.getPackageFilter(options.packageNames, false);
    } else {
        this.filter = null;
    }

    this.filterPattern =
        options.filterRegex != null ? Pattern.compile(options.filterRegex) : null;
}
项目: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;
}
项目:openjdk-jdk10    文件:DependencyFinder.java   
Finder(boolean apiOnly) {
    this.apiOnly = apiOnly;
    this.finder = apiOnly
        ? Dependencies.getAPIFinder(AccessFlags.ACC_PROTECTED)
        : Dependencies.getClassDependencyFinder();

}
项目:openjdk-jdk10    文件:JdepsFilter.java   
public JdepsFilter build() {
    Dependency.Filter filter = null;
    if (regex != null)
        filter = Dependencies.getRegexFilter(regex);
    else if (!targetPackages.isEmpty()) {
        filter = Dependencies.getPackageFilter(targetPackages, false);
    }
    return new JdepsFilter(filter,
                           filterPattern,
                           filterSamePackage,
                           filterSameArchive,
                           findJDKInterals,
                           includePattern,
                           requires);
}
项目:openjdk9    文件: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);
    }

    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    文件:DependencyFinder.java   
Finder(boolean apiOnly) {
    this.apiOnly = apiOnly;
    this.finder = apiOnly
        ? Dependencies.getAPIFinder(AccessFlags.ACC_PROTECTED)
        : Dependencies.getClassDependencyFinder();

}
项目:lookaside_java-1.8.0-openjdk    文件:JdepsTask.java   
DependencyFilter() {
    if (options.regex != null) {
        this.filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
    } else if (options.packageNames.size() > 0) {
        this.filter = Dependencies.getPackageFilter(options.packageNames, false);
    } else {
        this.filter = null;
    }

    this.filterPattern =
        options.filterRegex != null ? Pattern.compile(options.filterRegex) : null;
}
项目:jsr308-langtools    文件:JdepsTask.java   
DependencyFilter() {
    if (options.regex != null) {
        this.filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
    } else if (options.packageNames.size() > 0) {
        this.filter = Dependencies.getPackageFilter(options.packageNames, false);
    } else {
        this.filter = null;
    }

    this.filterPattern =
        options.filterRegex != null ? Pattern.compile(options.filterRegex) : null;
}
项目:infobip-open-jdk-8    文件:JdepsTask.java   
DependencyFilter() {
    if (options.regex != null) {
        this.filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
    } else if (options.packageNames.size() > 0) {
        this.filter = Dependencies.getPackageFilter(options.packageNames, false);
    } else {
        this.filter = null;
    }

    this.filterPattern =
        options.filterRegex != null ? Pattern.compile(options.filterRegex) : null;
}
项目:OLD-OpenJDK8    文件:JdepsTask.java   
private Dependency.Filter getDependencyFilter() {
     if (options.regex != null) {
        return Dependencies.getRegexFilter(Pattern.compile(options.regex));
    } else if (options.packageNames.size() > 0) {
        return Dependencies.getPackageFilter(options.packageNames, false);
    } else {
        return new Dependency.Filter() {
            @Override
            public boolean accepts(Dependency dependency) {
                return !dependency.getOrigin().equals(dependency.getTarget());
            }
        };
    }
}
项目:openjdk9    文件: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<>(new Callable<>() {
        public Set<Location> call() throws Exception {
            Set<Location> targets = new HashSet<>();
            for (ClassFile cf : archive.reader().getClassFiles()) {
                String classFileName;
                try {
                    classFileName = cf.getName();
                } catch (ConstantPoolException e) {
                    throw new Dependencies.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);
}