本文整理汇总了Java中com.sun.tools.classfile.Dependency.Location类的典型用法代码示例。如果您正苦于以下问题:Java Location类的具体用法?Java Location怎么用?Java Location使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Location类属于com.sun.tools.classfile.Dependency包,在下文中一共展示了Location类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visit
import com.sun.tools.classfile.Dependency.Location; //导入依赖的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;
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:Analyzer.java
示例2: addDep
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
protected Dep addDep(Location o, Location t) {
String origin = getLocationName(o);
String target = getLocationName(t);
Archive targetArchive = findArchive(t);
if (curDep != null &&
curDep.origin().equals(origin) &&
curDep.originArchive() == archive &&
curDep.target().equals(target) &&
curDep.targetArchive() == targetArchive) {
return curDep;
}
Dep e = new Dep(origin, archive, target, targetArchive);
if (deps.contains(e)) {
for (Dep e1 : deps) {
if (e.equals(e1)) {
curDep = e1;
}
}
} else {
deps.add(e);
curDep = e;
}
return curDep;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:Analyzer.java
示例3: transitiveArchiveDeps
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
private void transitiveArchiveDeps(int depth) throws IOException {
Stream<Location> deps = archives.stream()
.flatMap(Archive::getDependencies);
// start with the unresolved archives
Set<Archive> unresolved = unresolvedArchives(deps);
do {
// parse all unresolved archives
Set<Location> targets = apiOnly
? finder.parseExportedAPIs(unresolved.stream())
: finder.parse(unresolved.stream());
archives.addAll(unresolved);
// Add dependencies to the next batch for analysis
unresolved = unresolvedArchives(targets.stream());
} while (!unresolved.isEmpty() && depth-- > 0);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:DepsAnalyzer.java
示例4: findArchive
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
Archive findArchive(Location t) {
// local in this archive
if (archive.getClasses().contains(t))
return archive;
Archive target;
if (locationToArchive.containsKey(t)) {
target = locationToArchive.get(t);
} else {
// special case JDK removed API
target = configuration.findClass(t)
.orElseGet(() -> REMOVED_JDK_INTERNALS.contains(t)
? REMOVED_JDK_INTERNALS
: NOT_FOUND);
}
return locationToArchive.computeIfAbsent(t, _k -> target);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Analyzer.java
示例5: visit
import com.sun.tools.classfile.Dependency.Location; //导入依赖的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.getModule().isNamed()) {
Profile p = Profile.getProfile(t.getPackageName());
if (profile == null || (p != null && p.compareTo(profile) > 0)) {
profile = p;
}
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Analyzer.java
示例6: waitForTasksCompleted
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
private Set<Location> waitForTasksCompleted() {
try {
Set<Location> targets = new HashSet<>();
FutureTask<Set<Location>> task;
while ((task = tasks.poll()) != null) {
// wait for completion
if (!task.isDone())
targets.addAll(task.get());
}
return targets;
} catch (InterruptedException|ExecutionException e) {
throw new Error(e);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:DependencyFinder.java
示例7: visit
import com.sun.tools.classfile.Dependency.Location; //导入依赖的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;
}
}
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:17,代码来源:Analyzer.java
示例8: addClass
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
public void addClass(Location origin) {
Set<Location> set = deps.get(origin);
if (set == null) {
set = new HashSet<>();
deps.put(origin, set);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:Archive.java
示例9: visitDependences
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
public void visitDependences(Visitor v) {
for (Map.Entry<Location,Set<Location>> e: deps.entrySet()) {
for (Location target : e.getValue()) {
v.visit(e.getKey(), target);
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:Archive.java
示例10: run
import com.sun.tools.classfile.Dependency.Location; //导入依赖的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;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:JdepsTask.java
示例11: buildLocationArchiveMap
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
private void buildLocationArchiveMap(List<Archive> archives) {
// build a map from Location to Archive
for (Archive archive: archives) {
for (Location l: archive.getClasses()) {
if (!map.containsKey(l)) {
map.put(l, archive);
} else {
// duplicated class warning?
}
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:Analyzer.java
示例12: findArchive
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
Archive findArchive(Location t) {
Archive target = archive.getClasses().contains(t) ? archive : map.get(t);
if (target == null) {
map.put(t, target = NOT_FOUND);
}
return target;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:Analyzer.java
示例13: getLocationName
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
private String getLocationName(Location o) {
if (level == Type.CLASS || level == Type.VERBOSE) {
return o.getClassName();
} else {
String pkg = o.getPackageName();
return pkg.isEmpty() ? "<unnamed>" : pkg;
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Analyzer.java
示例14: unresolvedArchives
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
/**
* Returns the archives that contains the given locations and
* not parsed and analyzed.
*/
private Set<Archive> unresolvedArchives(Stream<Location> locations) {
return locations.filter(l -> !finder.isParsed(l))
.distinct()
.map(configuration::findClass)
.flatMap(Optional::stream)
.collect(toSet());
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:DepsAnalyzer.java
示例15: transitiveDeps
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
private void transitiveDeps(int depth) throws IOException {
Stream<Location> deps = archives.stream()
.flatMap(Archive::getDependencies);
Deque<Location> unresolved = deps.collect(Collectors.toCollection(LinkedList::new));
ConcurrentLinkedDeque<Location> deque = new ConcurrentLinkedDeque<>();
do {
Location target;
while ((target = unresolved.poll()) != null) {
if (finder.isParsed(target))
continue;
Archive archive = configuration.findClass(target).orElse(null);
if (archive != null) {
archives.add(archive);
String name = target.getName();
Set<Location> targets = apiOnly
? finder.parseExportedAPIs(archive, name)
: finder.parse(archive, name);
// build unresolved dependencies
targets.stream()
.filter(t -> !finder.isParsed(t))
.forEach(deque::add);
}
}
unresolved = deque;
deque = new ConcurrentLinkedDeque<>();
} while (!unresolved.isEmpty() && depth-- > 0);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:DepsAnalyzer.java
示例16: run
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
/**
* Performs the dependency analysis on the given archives.
*/
boolean run(Iterable<? extends Archive> archives,
Map<Location, Archive> locationMap)
{
this.locationToArchive.putAll(locationMap);
// traverse and analyze all dependencies
for (Archive archive : archives) {
Dependences deps = new Dependences(archive, type);
archive.visitDependences(deps);
results.put(archive, deps);
}
return true;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Analyzer.java
示例17: getLocationName
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
private String getLocationName(Location o) {
if (level == Type.CLASS || level == Type.VERBOSE) {
return VersionHelper.get(o.getClassName());
} else {
String pkg = o.getPackageName();
return pkg.isEmpty() ? "<unnamed>" : pkg;
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:Analyzer.java
示例18: contains
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
public boolean contains(Location location) {
String cn = location.getClassName();
int i = cn.lastIndexOf('.');
String pn = i > 0 ? cn.substring(0, i) : "";
return jdk8Internals.contains(pn);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Analyzer.java
示例19: parse
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
/**
* Parses the named class from the given archive and
* returns all target locations the named class references.
*/
public Set<Location> parse(Archive archive, String name) {
try {
return parse(archive, CLASS_FINDER, name);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:DependencyFinder.java
示例20: parseExportedAPIs
import com.sun.tools.classfile.Dependency.Location; //导入依赖的package包/类
/**
* Parses the exported API of the named class from the given archive and
* returns all target locations the named class references.
*/
public Set<Location> parseExportedAPIs(Archive archive, String name)
{
try {
return parse(archive, API_FINDER, name);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:DependencyFinder.java
注:本文中的com.sun.tools.classfile.Dependency.Location类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论