com.sun.tools.classfile.Dependencies Java Examples

The following examples show how to use com.sun.tools.classfile.Dependencies. 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: JdepsTask.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #2
Source File: JdepsTask.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: JdepsTask.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: JdepsTask.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: DependencyFinder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #6
Source File: DependencyFinder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
Finder(boolean apiOnly) {
    this.apiOnly = apiOnly;
    this.finder = apiOnly
        ? Dependencies.getAPIFinder(AccessFlags.ACC_PROTECTED)
        : Dependencies.getClassDependencyFinder();

}
 
Example #7
Source File: JdepsFilter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example #8
Source File: JdepsTask.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #9
Source File: JdepsTask.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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());
            }
        };
    }
}
 
Example #10
Source File: JdepsTask.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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());
            }
        };
    }
}