本文整理汇总了Java中com.sun.tools.jdeps.PlatformClassPath.JDKArchive类的典型用法代码示例。如果您正苦于以下问题:Java JDKArchive类的具体用法?Java JDKArchive怎么用?Java JDKArchive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JDKArchive类属于com.sun.tools.jdeps.PlatformClassPath包,在下文中一共展示了JDKArchive类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toTag
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
/**
* If the given archive is JDK archive, this method returns the profile name
* only if -profile option is specified; it accesses a private JDK API and
* the returned value will have "JDK internal API" prefix
*
* For non-JDK archives, this method returns the file name of the archive.
*/
private String toTag(String name, Archive source, Analyzer.Type type) {
if (!isJDKArchive(source)) {
return source.getName();
}
JDKArchive jdk = (JDKArchive)source;
boolean isExported = false;
if (type == CLASS || type == VERBOSE) {
isExported = jdk.isExported(name);
} else {
isExported = jdk.isExportedPackage(name);
}
Profile p = getProfile(name, type);
if (isExported) {
// exported API
return options.showProfile && p != null ? p.profileName() : "";
} else {
return "JDK internal API (" + source.getName() + ")";
}
}
示例2: visit
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
@Override
public void visit(Location o, Location t) {
Archive targetArchive = findArchive(t);
if (filter.accepts(o, archive, t, targetArchive)) {
addDep(o, t);
if (!requires.contains(targetArchive)) {
requires.add(targetArchive);
}
}
if (targetArchive instanceof JDKArchive) {
Profile p = Profile.getProfile(t.getPackageName());
if (profile == null || (p != null && p.compareTo(profile) > 0)) {
profile = p;
}
}
}
示例3: visit
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
@Override
public void visit(Location o, Location t) {
Archive targetArchive = findArchive(t);
if (filter.accepts(o, archive, t, targetArchive)) {
addDep(o, t);
if (archive != targetArchive && !requires.contains(targetArchive)) {
requires.add(targetArchive);
}
}
if (targetArchive instanceof JDKArchive) {
Profile p = Profile.getProfile(t.getPackageName());
if (profile == null || (p != null && p.compareTo(profile) > 0)) {
profile = p;
}
}
}
示例4: visitDependence
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
@Override
public void visitDependence(String origin, Archive source,
String target, Archive archive, Profile profile) {
if (options.findJDKInternals &&
!(archive instanceof JDKArchive && profile == null)) {
// filter dependences other than JDK internal APIs
return;
}
if (options.verbose == Analyzer.Type.VERBOSE) {
writer.format(" %-50s -> %-50s %s%n",
origin, target, getProfileArchiveInfo(archive, profile));
} else {
if (!origin.equals(pkg)) {
pkg = origin;
writer.format(" %s (%s)%n", origin, source.getFileName());
}
writer.format(" -> %-50s %s%n",
target, getProfileArchiveInfo(archive, profile));
}
}
示例5: run
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
private boolean run() throws IOException {
// parse classfiles and find all dependencies
findDependencies();
Analyzer analyzer = new Analyzer(options.verbose, new Analyzer.Filter() {
@Override
public boolean accepts(Location origin, Archive originArchive,
Location target, Archive targetArchive)
{
if (options.findJDKInternals) {
// accepts target that is JDK class but not exported
return isJDKArchive(targetArchive) &&
!((JDKArchive) targetArchive).isExported(target.getClassName());
} else if (options.filterSameArchive) {
// accepts origin and target that from different archive
return originArchive != targetArchive;
}
return true;
}
});
// analyze the dependencies
analyzer.run(sourceLocations);
// output result
if (options.dotOutputDir != null) {
Path dir = Paths.get(options.dotOutputDir);
Files.createDirectories(dir);
generateDotFiles(dir, analyzer);
} else {
printRawOutput(log, analyzer);
}
if (options.findJDKInternals && !options.nowarning) {
showReplacements(analyzer);
}
return true;
}
示例6: visitDependence
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
@Override
public void visitDependence(String origin, Archive originArchive,
String target, Archive targetArchive) {
writer.format("%s -> %s", originArchive.getName(), targetArchive.getPathName());
if (options.showProfile && JDKArchive.isProfileArchive(targetArchive)) {
writer.format(" (%s)", target);
}
writer.format("%n");
}
示例7: getProfileArchiveInfo
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
/**
* If the given archive is JDK archive and non-null Profile,
* this method returns the profile name only if -profile option is specified;
* a null profile indicates it accesses a private JDK API and this method
* will return "JDK internal API".
*
* For non-JDK archives, this method returns the file name of the archive.
*/
private String getProfileArchiveInfo(Archive source, Profile profile) {
if (options.showProfile && profile != null)
return profile.toString();
if (source instanceof JDKArchive) {
return profile == null ? "JDK internal API (" + source.getFileName() + ")" : "";
}
return source.getFileName();
}
示例8: profileName
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
/**
* Returns the profile name or "JDK internal API" for JDK archive;
* otherwise empty string.
*/
private String profileName(Archive archive, Profile profile) {
if (archive instanceof JDKArchive) {
return Objects.toString(profile, "JDK internal API");
} else {
return "";
}
}
示例9: visitArchiveDependence
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
@Override
public void visitArchiveDependence(Archive origin, Archive target, Profile profile) {
// add an edge with the archive's name with no tag
// so that there is only one node for each JDK archive
// while there may be edges to different profiles
Edge e = addEdge(origin, target, "");
if (target instanceof JDKArchive) {
// add a label to print the profile
if (profile == null) {
e.addLabel("JDK internal API");
} else if (options.showProfile && !options.showLabel) {
e.addLabel(profile.toString());
}
}
}
示例10: add
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
void add(String origin, String target, Archive targetArchive, String pkgName) {
SortedSet<Dep> set = deps.get(origin);
if (set == null) {
deps.put(origin, set = new TreeSet<>());
}
Profile p = targetArchive instanceof JDKArchive
? Profile.getProfile(pkgName) : null;
set.add(new Dep(target, targetArchive, p));
}
示例11: isJDKArchive
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
/**
* Test if the given archive is part of the JDK
*/
private boolean isJDKArchive(Archive archive) {
return JDKArchive.class.isInstance(archive);
}
示例12: getTargetProfile
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; //导入依赖的package包/类
Profile getTargetProfile(Archive target) {
return JDKArchive.isProfileArchive(target) ? profile : null;
}