feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
340
jdkSrc/jdk8/com/sun/tools/jdeps/Analyzer.java
Normal file
340
jdkSrc/jdk8/com/sun/tools/jdeps/Analyzer.java
Normal file
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package com.sun.tools.jdeps;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.sun.tools.classfile.Dependency.Location;
|
||||
import com.sun.tools.jdeps.PlatformClassPath.JDKArchive;
|
||||
|
||||
/**
|
||||
* Dependency Analyzer.
|
||||
*/
|
||||
public class Analyzer {
|
||||
/**
|
||||
* Type of the dependency analysis. Appropriate level of data
|
||||
* will be stored.
|
||||
*/
|
||||
public enum Type {
|
||||
SUMMARY,
|
||||
PACKAGE,
|
||||
CLASS,
|
||||
VERBOSE
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter to be applied when analyzing the dependencies from the given archives.
|
||||
* Only the accepted dependencies are recorded.
|
||||
*/
|
||||
interface Filter {
|
||||
boolean accepts(Location origin, Archive originArchive, Location target, Archive targetArchive);
|
||||
}
|
||||
|
||||
private final Type type;
|
||||
private final Filter filter;
|
||||
private final Map<Archive, ArchiveDeps> results = new HashMap<>();
|
||||
private final Map<Location, Archive> map = new HashMap<>();
|
||||
private final Archive NOT_FOUND
|
||||
= new Archive(JdepsTask.getMessage("artifact.not.found"));
|
||||
|
||||
/**
|
||||
* Constructs an Analyzer instance.
|
||||
*
|
||||
* @param type Type of the dependency analysis
|
||||
* @param filter
|
||||
*/
|
||||
public Analyzer(Type type, Filter filter) {
|
||||
this.type = type;
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the dependency analysis on the given archives.
|
||||
*/
|
||||
public void run(List<Archive> archives) {
|
||||
// build a map from Location to Archive
|
||||
buildLocationArchiveMap(archives);
|
||||
|
||||
// traverse and analyze all dependencies
|
||||
for (Archive archive : archives) {
|
||||
ArchiveDeps deps = new ArchiveDeps(archive, type);
|
||||
archive.visitDependences(deps);
|
||||
results.put(archive, deps);
|
||||
}
|
||||
}
|
||||
|
||||
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?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasDependences(Archive archive) {
|
||||
if (results.containsKey(archive)) {
|
||||
return results.get(archive).dependencies().size() > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<String> dependences(Archive source) {
|
||||
ArchiveDeps result = results.get(source);
|
||||
return result.targetDependences();
|
||||
}
|
||||
|
||||
public interface Visitor {
|
||||
/**
|
||||
* Visits a recorded dependency from origin to target which can be
|
||||
* a fully-qualified classname, a package name, a module or
|
||||
* archive name depending on the Analyzer's type.
|
||||
*/
|
||||
public void visitDependence(String origin, Archive originArchive,
|
||||
String target, Archive targetArchive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit the dependencies of the given source.
|
||||
* If the requested level is SUMMARY, it will visit the required archives list.
|
||||
*/
|
||||
public void visitDependences(Archive source, Visitor v, Type level) {
|
||||
if (level == Type.SUMMARY) {
|
||||
final ArchiveDeps result = results.get(source);
|
||||
SortedMap<String, Archive> sorted = new TreeMap<>();
|
||||
for (Archive a : result.requires()) {
|
||||
sorted.put(a.getName(), a);
|
||||
}
|
||||
for (Archive archive : sorted.values()) {
|
||||
Profile profile = result.getTargetProfile(archive);
|
||||
v.visitDependence(source.getName(), source,
|
||||
profile != null ? profile.profileName() : archive.getName(), archive);
|
||||
}
|
||||
} else {
|
||||
ArchiveDeps result = results.get(source);
|
||||
if (level != type) {
|
||||
// requesting different level of analysis
|
||||
result = new ArchiveDeps(source, level);
|
||||
source.visitDependences(result);
|
||||
}
|
||||
SortedSet<Dep> sorted = new TreeSet<>(result.dependencies());
|
||||
for (Dep d : sorted) {
|
||||
v.visitDependence(d.origin(), d.originArchive(), d.target(), d.targetArchive());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void visitDependences(Archive source, Visitor v) {
|
||||
visitDependences(source, v, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* ArchiveDeps contains the dependencies for an Archive that can have one or
|
||||
* more classes.
|
||||
*/
|
||||
class ArchiveDeps implements Archive.Visitor {
|
||||
protected final Archive archive;
|
||||
protected final Set<Archive> requires;
|
||||
protected final Set<Dep> deps;
|
||||
protected final Type level;
|
||||
private Profile profile;
|
||||
ArchiveDeps(Archive archive, Type level) {
|
||||
this.archive = archive;
|
||||
this.deps = new HashSet<>();
|
||||
this.requires = new HashSet<>();
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
Set<Dep> dependencies() {
|
||||
return deps;
|
||||
}
|
||||
|
||||
Set<String> targetDependences() {
|
||||
Set<String> targets = new HashSet<>();
|
||||
for (Dep d : deps) {
|
||||
targets.add(d.target());
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
Set<Archive> requires() {
|
||||
return requires;
|
||||
}
|
||||
|
||||
Profile getTargetProfile(Archive target) {
|
||||
return JDKArchive.isProfileArchive(target) ? profile : null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// return classname or package name depedning on the level
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Dep curDep;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class-level or package-level dependency
|
||||
*/
|
||||
class Dep implements Comparable<Dep> {
|
||||
final String origin;
|
||||
final Archive originArchive;
|
||||
final String target;
|
||||
final Archive targetArchive;
|
||||
|
||||
Dep(String origin, Archive originArchive, String target, Archive targetArchive) {
|
||||
this.origin = origin;
|
||||
this.originArchive = originArchive;
|
||||
this.target = target;
|
||||
this.targetArchive = targetArchive;
|
||||
}
|
||||
|
||||
String origin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
Archive originArchive() {
|
||||
return originArchive;
|
||||
}
|
||||
|
||||
String target() {
|
||||
return target;
|
||||
}
|
||||
|
||||
Archive targetArchive() {
|
||||
return targetArchive;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof Dep) {
|
||||
Dep d = (Dep) o;
|
||||
return this.origin.equals(d.origin) &&
|
||||
this.originArchive == d.originArchive &&
|
||||
this.target.equals(d.target) &&
|
||||
this.targetArchive == d.targetArchive;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 67*hash + Objects.hashCode(this.origin)
|
||||
+ Objects.hashCode(this.originArchive)
|
||||
+ Objects.hashCode(this.target)
|
||||
+ Objects.hashCode(this.targetArchive);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Dep o) {
|
||||
if (this.origin.equals(o.origin)) {
|
||||
if (this.target.equals(o.target)) {
|
||||
if (this.originArchive == o.originArchive &&
|
||||
this.targetArchive == o.targetArchive) {
|
||||
return 0;
|
||||
} else if (this.originArchive == o.originArchive) {
|
||||
return this.targetArchive.getPathName().compareTo(o.targetArchive.getPathName());
|
||||
} else {
|
||||
return this.originArchive.getPathName().compareTo(o.originArchive.getPathName());
|
||||
}
|
||||
} else {
|
||||
return this.target.compareTo(o.target);
|
||||
}
|
||||
}
|
||||
return this.origin.compareTo(o.origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
113
jdkSrc/jdk8/com/sun/tools/jdeps/Archive.java
Normal file
113
jdkSrc/jdk8/com/sun/tools/jdeps/Archive.java
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package com.sun.tools.jdeps;
|
||||
|
||||
import com.sun.tools.classfile.Dependency.Location;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Represents the source of the class files.
|
||||
*/
|
||||
public class Archive {
|
||||
public static Archive getInstance(Path p) throws IOException {
|
||||
return new Archive(p, ClassFileReader.newInstance(p));
|
||||
}
|
||||
|
||||
private final Path path;
|
||||
private final String filename;
|
||||
private final ClassFileReader reader;
|
||||
protected Map<Location, Set<Location>> deps = new ConcurrentHashMap<>();
|
||||
|
||||
protected Archive(String name) {
|
||||
this.path = null;
|
||||
this.filename = name;
|
||||
this.reader = null;
|
||||
}
|
||||
|
||||
protected Archive(Path p, ClassFileReader reader) {
|
||||
this.path = p;
|
||||
this.filename = path.getFileName().toString();
|
||||
this.reader = reader;
|
||||
}
|
||||
|
||||
public ClassFileReader reader() {
|
||||
return reader;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void addClass(Location origin) {
|
||||
Set<Location> set = deps.get(origin);
|
||||
if (set == null) {
|
||||
set = new HashSet<>();
|
||||
deps.put(origin, set);
|
||||
}
|
||||
}
|
||||
|
||||
public void addClass(Location origin, Location target) {
|
||||
Set<Location> set = deps.get(origin);
|
||||
if (set == null) {
|
||||
set = new HashSet<>();
|
||||
deps.put(origin, set);
|
||||
}
|
||||
set.add(target);
|
||||
}
|
||||
|
||||
public Set<Location> getClasses() {
|
||||
return deps.keySet();
|
||||
}
|
||||
|
||||
public void visitDependences(Visitor v) {
|
||||
for (Map.Entry<Location,Set<Location>> e: deps.entrySet()) {
|
||||
for (Location target : e.getValue()) {
|
||||
v.visit(e.getKey(), target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return getClasses().isEmpty();
|
||||
}
|
||||
|
||||
public String getPathName() {
|
||||
return path != null ? path.toString() : filename;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
interface Visitor {
|
||||
void visit(Location origin, Location target);
|
||||
}
|
||||
}
|
||||
375
jdkSrc/jdk8/com/sun/tools/jdeps/ClassFileReader.java
Normal file
375
jdkSrc/jdk8/com/sun/tools/jdeps/ClassFileReader.java
Normal file
@@ -0,0 +1,375 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package com.sun.tools.jdeps;
|
||||
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.ConstantPoolException;
|
||||
import com.sun.tools.classfile.Dependencies.ClassFileError;
|
||||
import java.io.*;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.*;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
/**
|
||||
* ClassFileReader reads ClassFile(s) of a given path that can be
|
||||
* a .class file, a directory, or a JAR file.
|
||||
*/
|
||||
public class ClassFileReader {
|
||||
/**
|
||||
* Returns a ClassFileReader instance of a given path.
|
||||
*/
|
||||
public static ClassFileReader newInstance(Path path) throws IOException {
|
||||
if (!Files.exists(path)) {
|
||||
throw new FileNotFoundException(path.toString());
|
||||
}
|
||||
|
||||
if (Files.isDirectory(path)) {
|
||||
return new DirectoryReader(path);
|
||||
} else if (path.getFileName().toString().endsWith(".jar")) {
|
||||
return new JarFileReader(path);
|
||||
} else {
|
||||
return new ClassFileReader(path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a ClassFileReader instance of a given JarFile.
|
||||
*/
|
||||
public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException {
|
||||
return new JarFileReader(path, jf);
|
||||
}
|
||||
|
||||
protected final Path path;
|
||||
protected final String baseFileName;
|
||||
protected final List<String> skippedEntries = new ArrayList<>();
|
||||
protected ClassFileReader(Path path) {
|
||||
this.path = path;
|
||||
this.baseFileName = path.getFileName() != null
|
||||
? path.getFileName().toString()
|
||||
: path.toString();
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return baseFileName;
|
||||
}
|
||||
|
||||
public List<String> skippedEntries() {
|
||||
return skippedEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ClassFile matching the given binary name
|
||||
* or a fully-qualified class name.
|
||||
*/
|
||||
public ClassFile getClassFile(String name) throws IOException {
|
||||
if (name.indexOf('.') > 0) {
|
||||
int i = name.lastIndexOf('.');
|
||||
String pathname = name.replace('.', File.separatorChar) + ".class";
|
||||
if (baseFileName.equals(pathname) ||
|
||||
baseFileName.equals(pathname.substring(0, i) + "$" +
|
||||
pathname.substring(i+1, pathname.length()))) {
|
||||
return readClassFile(path);
|
||||
}
|
||||
} else {
|
||||
if (baseFileName.equals(name.replace('/', File.separatorChar) + ".class")) {
|
||||
return readClassFile(path);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterable<ClassFile> getClassFiles() throws IOException {
|
||||
return new Iterable<ClassFile>() {
|
||||
public Iterator<ClassFile> iterator() {
|
||||
return new FileIterator();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FileIterator implements Iterator<ClassFile> {
|
||||
int count;
|
||||
FileIterator() {
|
||||
this.count = 0;
|
||||
}
|
||||
public boolean hasNext() {
|
||||
return count == 0 && baseFileName.endsWith(".class");
|
||||
}
|
||||
|
||||
public ClassFile next() {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
try {
|
||||
ClassFile cf = readClassFile(path);
|
||||
count++;
|
||||
return cf;
|
||||
} catch (IOException e) {
|
||||
throw new ClassFileError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMultiReleaseJar() throws IOException { return false; }
|
||||
|
||||
public String toString() {
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
private static class DirectoryReader extends ClassFileReader {
|
||||
DirectoryReader(Path path) throws IOException {
|
||||
super(path);
|
||||
}
|
||||
|
||||
public ClassFile getClassFile(String name) throws IOException {
|
||||
if (name.indexOf('.') > 0) {
|
||||
int i = name.lastIndexOf('.');
|
||||
String pathname = name.replace('.', File.separatorChar) + ".class";
|
||||
Path p = path.resolve(pathname);
|
||||
if (!Files.exists(p)) {
|
||||
p = path.resolve(pathname.substring(0, i) + "$" +
|
||||
pathname.substring(i+1, pathname.length()));
|
||||
}
|
||||
if (Files.exists(p)) {
|
||||
return readClassFile(p);
|
||||
}
|
||||
} else {
|
||||
Path p = path.resolve(name + ".class");
|
||||
if (Files.exists(p)) {
|
||||
return readClassFile(p);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterable<ClassFile> getClassFiles() throws IOException {
|
||||
final Iterator<ClassFile> iter = new DirectoryIterator();
|
||||
return new Iterable<ClassFile>() {
|
||||
public Iterator<ClassFile> iterator() {
|
||||
return iter;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private List<Path> walkTree(Path dir) throws IOException {
|
||||
final List<Path> files = new ArrayList<Path>();
|
||||
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
|
||||
throws IOException {
|
||||
if (file.getFileName().toString().endsWith(".class")) {
|
||||
files.add(file);
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
return files;
|
||||
}
|
||||
|
||||
class DirectoryIterator implements Iterator<ClassFile> {
|
||||
private List<Path> entries;
|
||||
private int index = 0;
|
||||
DirectoryIterator() throws IOException {
|
||||
entries = walkTree(path);
|
||||
index = 0;
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return index != entries.size();
|
||||
}
|
||||
|
||||
public ClassFile next() {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
Path path = entries.get(index++);
|
||||
try {
|
||||
return readClassFile(path);
|
||||
} catch (IOException e) {
|
||||
throw new ClassFileError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class JarFileReader extends ClassFileReader {
|
||||
private final JarFile jarfile;
|
||||
JarFileReader(Path path) throws IOException {
|
||||
this(path, new JarFile(path.toFile(), false));
|
||||
}
|
||||
|
||||
JarFileReader(Path path, JarFile jf) throws IOException {
|
||||
super(path);
|
||||
this.jarfile = jf;
|
||||
}
|
||||
|
||||
public ClassFile getClassFile(String name) throws IOException {
|
||||
if (name.indexOf('.') > 0) {
|
||||
int i = name.lastIndexOf('.');
|
||||
String entryName = name.replace('.', '/') + ".class";
|
||||
JarEntry e = jarfile.getJarEntry(entryName);
|
||||
if (e == null) {
|
||||
e = jarfile.getJarEntry(entryName.substring(0, i) + "$"
|
||||
+ entryName.substring(i + 1, entryName.length()));
|
||||
}
|
||||
if (e != null) {
|
||||
return readClassFile(jarfile, e);
|
||||
}
|
||||
} else {
|
||||
JarEntry e = jarfile.getJarEntry(name + ".class");
|
||||
if (e != null) {
|
||||
return readClassFile(jarfile, e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
public Iterable<ClassFile> getClassFiles() throws IOException {
|
||||
final Iterator<ClassFile> iter = new JarFileIterator(this, jarfile);
|
||||
return new Iterable<ClassFile>() {
|
||||
public Iterator<ClassFile> iterator() {
|
||||
return iter;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiReleaseJar() throws IOException {
|
||||
Manifest mf = this.jarfile.getManifest();
|
||||
if (mf != null) {
|
||||
Attributes atts = mf.getMainAttributes();
|
||||
return "true".equalsIgnoreCase(atts.getValue("Multi-Release"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class JarFileIterator implements Iterator<ClassFile> {
|
||||
protected final JarFileReader reader;
|
||||
protected Enumeration<JarEntry> entries;
|
||||
protected JarFile jf;
|
||||
protected JarEntry nextEntry;
|
||||
protected ClassFile cf;
|
||||
JarFileIterator(JarFileReader reader) {
|
||||
this(reader, null);
|
||||
}
|
||||
JarFileIterator(JarFileReader reader, JarFile jarfile) {
|
||||
this.reader = reader;
|
||||
setJarFile(jarfile);
|
||||
}
|
||||
|
||||
void setJarFile(JarFile jarfile) {
|
||||
if (jarfile == null) return;
|
||||
|
||||
this.jf = jarfile;
|
||||
this.entries = jf.entries();
|
||||
this.nextEntry = nextEntry();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public ClassFile next() {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
ClassFile classFile = cf;
|
||||
cf = null;
|
||||
nextEntry = nextEntry();
|
||||
return classFile;
|
||||
}
|
||||
|
||||
protected JarEntry nextEntry() {
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry e = entries.nextElement();
|
||||
String name = e.getName();
|
||||
if (name.endsWith(".class")) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
}
|
||||
1033
jdkSrc/jdk8/com/sun/tools/jdeps/JdepsTask.java
Normal file
1033
jdkSrc/jdk8/com/sun/tools/jdeps/JdepsTask.java
Normal file
File diff suppressed because it is too large
Load Diff
65
jdkSrc/jdk8/com/sun/tools/jdeps/Main.java
Normal file
65
jdkSrc/jdk8/com/sun/tools/jdeps/Main.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.jdeps;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* Usage:
|
||||
* jdeps [options] files ...
|
||||
* where options include:
|
||||
* -p package-name restrict analysis to classes in this package
|
||||
* (may be given multiple times)
|
||||
* -e regex restrict analysis to packages matching pattern
|
||||
* (-p and -e are exclusive)
|
||||
* -v show class-level dependencies
|
||||
* default: package-level dependencies
|
||||
* -r --recursive transitive dependencies analysis
|
||||
* -classpath paths Classpath to locate class files
|
||||
* -all process all class files in the given classpath
|
||||
*/
|
||||
public class Main {
|
||||
public static void main(String... args) throws Exception {
|
||||
JdepsTask t = new JdepsTask();
|
||||
int rc = t.run(args);
|
||||
System.exit(rc);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Entry point that does <i>not</i> call System.exit.
|
||||
*
|
||||
* @param args command line arguments
|
||||
* @param out output stream
|
||||
* @return an exit code. 0 means success, non-zero means an error occurred.
|
||||
*/
|
||||
public static int run(String[] args, PrintWriter out) {
|
||||
JdepsTask t = new JdepsTask();
|
||||
t.setLog(out);
|
||||
return t.run(args);
|
||||
}
|
||||
}
|
||||
225
jdkSrc/jdk8/com/sun/tools/jdeps/PlatformClassPath.java
Normal file
225
jdkSrc/jdk8/com/sun/tools/jdeps/PlatformClassPath.java
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package com.sun.tools.jdeps;
|
||||
|
||||
import com.sun.tools.classfile.Annotation;
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.ConstantPool;
|
||||
import com.sun.tools.classfile.ConstantPoolException;
|
||||
import com.sun.tools.classfile.RuntimeAnnotations_attribute;
|
||||
import com.sun.tools.classfile.Dependencies.ClassFileError;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.*;
|
||||
|
||||
import static com.sun.tools.classfile.Attribute.*;
|
||||
|
||||
/**
|
||||
* ClassPath for Java SE and JDK
|
||||
*/
|
||||
class PlatformClassPath {
|
||||
private static final List<String> NON_PLATFORM_JARFILES =
|
||||
Arrays.asList("alt-rt.jar", "ant-javafx.jar", "javafx-mx.jar");
|
||||
private static final List<Archive> javaHomeArchives = init();
|
||||
|
||||
static List<Archive> getArchives() {
|
||||
return javaHomeArchives;
|
||||
}
|
||||
|
||||
private static List<Archive> init() {
|
||||
List<Archive> result = new ArrayList<>();
|
||||
Path home = Paths.get(System.getProperty("java.home"));
|
||||
try {
|
||||
if (home.endsWith("jre")) {
|
||||
// jar files in <javahome>/jre/lib
|
||||
result.addAll(addJarFiles(home.resolve("lib")));
|
||||
if (home.getParent() != null) {
|
||||
// add tools.jar and other JDK jar files
|
||||
Path lib = home.getParent().resolve("lib");
|
||||
if (Files.exists(lib)) {
|
||||
result.addAll(addJarFiles(lib));
|
||||
}
|
||||
}
|
||||
} else if (Files.exists(home.resolve("lib"))) {
|
||||
// either a JRE or a jdk build image
|
||||
Path classes = home.resolve("classes");
|
||||
if (Files.isDirectory(classes)) {
|
||||
// jdk build outputdir
|
||||
result.add(new JDKArchive(classes));
|
||||
}
|
||||
// add other JAR files
|
||||
result.addAll(addJarFiles(home.resolve("lib")));
|
||||
} else {
|
||||
throw new RuntimeException("\"" + home + "\" not a JDK home");
|
||||
}
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Archive> addJarFiles(final Path root) throws IOException {
|
||||
final List<Archive> result = new ArrayList<>();
|
||||
final Path ext = root.resolve("ext");
|
||||
Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
|
||||
throws IOException
|
||||
{
|
||||
if (dir.equals(root) || dir.equals(ext)) {
|
||||
return FileVisitResult.CONTINUE;
|
||||
} else {
|
||||
// skip other cobundled JAR files
|
||||
return FileVisitResult.SKIP_SUBTREE;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path p, BasicFileAttributes attrs)
|
||||
throws IOException
|
||||
{
|
||||
String fn = p.getFileName().toString();
|
||||
if (fn.endsWith(".jar")) {
|
||||
// JDK may cobundle with JavaFX that doesn't belong to any profile
|
||||
// Treat jfxrt.jar as regular Archive
|
||||
result.add(NON_PLATFORM_JARFILES.contains(fn)
|
||||
? Archive.getInstance(p)
|
||||
: new JDKArchive(p));
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A JDK archive is part of the JDK containing the Java SE API
|
||||
* or implementation classes (i.e. JDK internal API)
|
||||
*/
|
||||
static class JDKArchive extends Archive {
|
||||
private static List<String> PROFILE_JARS = Arrays.asList("rt.jar", "jce.jar");
|
||||
// Workaround: The following packages are not annotated as jdk.Exported
|
||||
private static List<String> EXPORTED_PACKAGES = Arrays.asList(
|
||||
"javax.jnlp",
|
||||
"org.w3c.dom.css",
|
||||
"org.w3c.dom.html",
|
||||
"org.w3c.dom.stylesheets",
|
||||
"org.w3c.dom.xpath"
|
||||
);
|
||||
public static boolean isProfileArchive(Archive archive) {
|
||||
if (archive instanceof JDKArchive) {
|
||||
return PROFILE_JARS.contains(archive.getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final Map<String,Boolean> exportedPackages = new HashMap<>();
|
||||
private final Map<String,Boolean> exportedTypes = new HashMap<>();
|
||||
JDKArchive(Path p) throws IOException {
|
||||
super(p, ClassFileReader.newInstance(p));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if a given fully-qualified name is an exported type.
|
||||
*/
|
||||
public boolean isExported(String cn) {
|
||||
int i = cn.lastIndexOf('.');
|
||||
String pn = i > 0 ? cn.substring(0, i) : "";
|
||||
|
||||
boolean isJdkExported = isExportedPackage(pn);
|
||||
if (exportedTypes.containsKey(cn)) {
|
||||
return exportedTypes.get(cn);
|
||||
}
|
||||
return isJdkExported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if a given package name is exported.
|
||||
*/
|
||||
public boolean isExportedPackage(String pn) {
|
||||
if (Profile.getProfile(pn) != null) {
|
||||
return true;
|
||||
}
|
||||
// special case for JavaFX and APIs that are not annotated with @jdk.Exported)
|
||||
if (EXPORTED_PACKAGES.contains(pn) || pn.startsWith("javafx.")) {
|
||||
return true;
|
||||
}
|
||||
return exportedPackages.containsKey(pn) ? exportedPackages.get(pn) : false;
|
||||
}
|
||||
|
||||
private static final String JDK_EXPORTED_ANNOTATION = "Ljdk/Exported;";
|
||||
private Boolean isJdkExported(ClassFile cf) throws ConstantPoolException {
|
||||
RuntimeAnnotations_attribute attr = (RuntimeAnnotations_attribute)
|
||||
cf.attributes.get(RuntimeVisibleAnnotations);
|
||||
if (attr != null) {
|
||||
for (int i = 0; i < attr.annotations.length; i++) {
|
||||
Annotation ann = attr.annotations[i];
|
||||
String annType = cf.constant_pool.getUTF8Value(ann.type_index);
|
||||
if (JDK_EXPORTED_ANNOTATION.equals(annType)) {
|
||||
boolean isJdkExported = true;
|
||||
for (int j = 0; j < ann.num_element_value_pairs; j++) {
|
||||
Annotation.element_value_pair pair = ann.element_value_pairs[j];
|
||||
Annotation.Primitive_element_value ev = (Annotation.Primitive_element_value) pair.value;
|
||||
ConstantPool.CONSTANT_Integer_info info = (ConstantPool.CONSTANT_Integer_info)
|
||||
cf.constant_pool.get(ev.const_value_index);
|
||||
isJdkExported = info.value != 0;
|
||||
}
|
||||
return Boolean.valueOf(isJdkExported);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void processJdkExported(ClassFile cf) throws IOException {
|
||||
try {
|
||||
String cn = cf.getName();
|
||||
String pn = cn.substring(0, cn.lastIndexOf('/')).replace('/', '.');
|
||||
|
||||
Boolean b = isJdkExported(cf);
|
||||
if (b != null) {
|
||||
exportedTypes.put(cn.replace('/', '.'), b);
|
||||
}
|
||||
if (!exportedPackages.containsKey(pn)) {
|
||||
// check if package-info.class has @jdk.Exported
|
||||
Boolean isJdkExported = null;
|
||||
ClassFile pcf = reader().getClassFile(cn.substring(0, cn.lastIndexOf('/')+1) + "package-info");
|
||||
if (pcf != null) {
|
||||
isJdkExported = isJdkExported(pcf);
|
||||
}
|
||||
if (isJdkExported != null) {
|
||||
exportedPackages.put(pn, isJdkExported);
|
||||
}
|
||||
}
|
||||
} catch (ConstantPoolException e) {
|
||||
throw new ClassFileError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
232
jdkSrc/jdk8/com/sun/tools/jdeps/Profile.java
Normal file
232
jdkSrc/jdk8/com/sun/tools/jdeps/Profile.java
Normal file
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package com.sun.tools.jdeps;
|
||||
|
||||
import com.sun.tools.classfile.Annotation;
|
||||
import com.sun.tools.classfile.Annotation.*;
|
||||
import com.sun.tools.classfile.Attribute;
|
||||
import com.sun.tools.classfile.ClassFile;
|
||||
import com.sun.tools.classfile.ConstantPool.*;
|
||||
import com.sun.tools.classfile.ConstantPoolException;
|
||||
import com.sun.tools.classfile.RuntimeAnnotations_attribute;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
/**
|
||||
* Build the profile information from ct.sym if exists.
|
||||
*/
|
||||
enum Profile {
|
||||
COMPACT1("compact1", 1),
|
||||
COMPACT2("compact2", 2),
|
||||
COMPACT3("compact3", 3),
|
||||
FULL_JRE("Full JRE", 4);
|
||||
|
||||
final String name;
|
||||
final int profile;
|
||||
final Set<String> packages;
|
||||
final Set<String> proprietaryPkgs;
|
||||
|
||||
Profile(String name, int profile) {
|
||||
this.name = name;
|
||||
this.profile = profile;
|
||||
this.packages = new HashSet<>();
|
||||
this.proprietaryPkgs = new HashSet<>();
|
||||
}
|
||||
|
||||
public String profileName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static int getProfileCount() {
|
||||
return PackageToProfile.map.values().size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Profile for the given package name. It returns an empty
|
||||
* string if the given package is not in any profile.
|
||||
*/
|
||||
public static Profile getProfile(String pn) {
|
||||
Profile profile = PackageToProfile.map.get(pn);
|
||||
return (profile != null && profile.packages.contains(pn))
|
||||
? profile : null;
|
||||
}
|
||||
|
||||
static class PackageToProfile {
|
||||
static String[] JAVAX_CRYPTO_PKGS = new String[] {
|
||||
"javax.crypto",
|
||||
"javax.crypto.interfaces",
|
||||
"javax.crypto.spec"
|
||||
};
|
||||
static Map<String, Profile> map = initProfiles();
|
||||
private static Map<String, Profile> initProfiles() {
|
||||
try {
|
||||
String profilesProps = System.getProperty("jdeps.profiles");
|
||||
if (profilesProps != null) {
|
||||
// for testing for JDK development build where ct.sym doesn't exist
|
||||
initProfilesFromProperties(profilesProps);
|
||||
} else {
|
||||
Path home = Paths.get(System.getProperty("java.home"));
|
||||
if (home.endsWith("jre")) {
|
||||
home = home.getParent();
|
||||
}
|
||||
Path ctsym = home.resolve("lib").resolve("ct.sym");
|
||||
if (Files.exists(ctsym)) {
|
||||
// parse ct.sym and load information about profiles
|
||||
try (JarFile jf = new JarFile(ctsym.toFile())) {
|
||||
ClassFileReader reader = ClassFileReader.newInstance(ctsym, jf);
|
||||
for (ClassFile cf : reader.getClassFiles()) {
|
||||
findProfile(cf);
|
||||
}
|
||||
}
|
||||
// special case for javax.crypto.* classes that are not
|
||||
// included in ct.sym since they are in jce.jar
|
||||
Collections.addAll(Profile.COMPACT1.packages, JAVAX_CRYPTO_PKGS);
|
||||
}
|
||||
}
|
||||
} catch (IOException | ConstantPoolException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
HashMap<String,Profile> map = new HashMap<>();
|
||||
for (Profile profile : Profile.values()) {
|
||||
for (String pn : profile.packages) {
|
||||
if (!map.containsKey(pn)) {
|
||||
// split packages in the JRE: use the smaller compact
|
||||
map.put(pn, profile);
|
||||
}
|
||||
}
|
||||
for (String pn : profile.proprietaryPkgs) {
|
||||
if (!map.containsKey(pn)) {
|
||||
map.put(pn, profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
private static final String PROFILE_ANNOTATION = "Ljdk/Profile+Annotation;";
|
||||
private static final String PROPRIETARY_ANNOTATION = "Lsun/Proprietary+Annotation;";
|
||||
private static Profile findProfile(ClassFile cf) throws ConstantPoolException {
|
||||
RuntimeAnnotations_attribute attr = (RuntimeAnnotations_attribute)
|
||||
cf.attributes.get(Attribute.RuntimeInvisibleAnnotations);
|
||||
int index = 0;
|
||||
boolean proprietary = false;
|
||||
if (attr != null) {
|
||||
for (int i = 0; i < attr.annotations.length; i++) {
|
||||
Annotation ann = attr.annotations[i];
|
||||
String annType = cf.constant_pool.getUTF8Value(ann.type_index);
|
||||
if (PROFILE_ANNOTATION.equals(annType)) {
|
||||
for (int j = 0; j < ann.num_element_value_pairs; j++) {
|
||||
Annotation.element_value_pair pair = ann.element_value_pairs[j];
|
||||
Primitive_element_value ev = (Primitive_element_value) pair.value;
|
||||
CONSTANT_Integer_info info = (CONSTANT_Integer_info)
|
||||
cf.constant_pool.get(ev.const_value_index);
|
||||
index = info.value;
|
||||
break;
|
||||
}
|
||||
} else if (PROPRIETARY_ANNOTATION.equals(annType)) {
|
||||
proprietary = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Profile p = null; // default
|
||||
switch (index) {
|
||||
case 1:
|
||||
p = Profile.COMPACT1; break;
|
||||
case 2:
|
||||
p = Profile.COMPACT2; break;
|
||||
case 3:
|
||||
p = Profile.COMPACT3; break;
|
||||
case 4:
|
||||
p = Profile.FULL_JRE; break;
|
||||
default:
|
||||
// skip classes with profile=0
|
||||
// Inner classes are not annotated with the profile annotation
|
||||
return null;
|
||||
}
|
||||
|
||||
String name = cf.getName();
|
||||
int i = name.lastIndexOf('/');
|
||||
name = (i > 0) ? name.substring(0, i).replace('/', '.') : "";
|
||||
if (proprietary) {
|
||||
p.proprietaryPkgs.add(name);
|
||||
} else {
|
||||
p.packages.add(name);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
private static void initProfilesFromProperties(String path) throws IOException {
|
||||
Properties props = new Properties();
|
||||
try (FileReader reader = new FileReader(path)) {
|
||||
props.load(reader);
|
||||
}
|
||||
for (Profile prof : Profile.values()) {
|
||||
int i = prof.profile;
|
||||
String key = props.getProperty("profile." + i + ".name");
|
||||
if (key == null) {
|
||||
throw new RuntimeException(key + " missing in " + path);
|
||||
}
|
||||
String n = props.getProperty("profile." + i + ".packages");
|
||||
String[] pkgs = n.split("\\s+");
|
||||
for (String p : pkgs) {
|
||||
if (p.isEmpty()) continue;
|
||||
prof.packages.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for debugging
|
||||
public static void main(String[] args) {
|
||||
if (args.length == 0) {
|
||||
if (Profile.getProfileCount() == 0) {
|
||||
System.err.println("No profile is present in this JDK");
|
||||
}
|
||||
for (Profile p : Profile.values()) {
|
||||
String profileName = p.name;
|
||||
SortedSet<String> set = new TreeSet<>(p.packages);
|
||||
for (String s : set) {
|
||||
// filter out the inner classes that are not annotated with
|
||||
// the profile annotation
|
||||
if (PackageToProfile.map.get(s) == p) {
|
||||
System.out.format("%2d: %-10s %s%n", p.profile, profileName, s);
|
||||
profileName = "";
|
||||
} else {
|
||||
System.err.format("Split package: %s in %s and %s %n",
|
||||
s, PackageToProfile.map.get(s).name, p.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String pn : args) {
|
||||
System.out.format("%s in %s%n", pn, getProfile(pn));
|
||||
}
|
||||
}
|
||||
}
|
||||
41
jdkSrc/jdk8/com/sun/tools/jdeps/resources/jdeps.java
Normal file
41
jdkSrc/jdk8/com/sun/tools/jdeps/resources/jdeps.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.sun.tools.jdeps.resources;
|
||||
|
||||
public final class jdeps extends java.util.ListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "artifact.not.found", "not found" },
|
||||
{ "err.invalid.arg.for.option", "invalid argument for option: {0}" },
|
||||
{ "err.invalid.path", "invalid path: {0}" },
|
||||
{ "err.missing.arg", "no value given for {0}" },
|
||||
{ "err.option.after.class", "option must be specified before classes: {0}" },
|
||||
{ "err.option.unsupported", "{0} not supported: {1}" },
|
||||
{ "err.profiles.msg", "No profile information" },
|
||||
{ "err.unknown.option", "unknown option: {0}" },
|
||||
{ "error.prefix", "Error:" },
|
||||
{ "jdeps.wiki.url", "https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool" },
|
||||
{ "main.opt.P", " -P -profile Show profile or the file containing a package" },
|
||||
{ "main.opt.R", " -R -recursive Recursively traverse all dependencies.\n The -R option implies -filter:none. If -p, -e, -f\n option is specified, only the matching dependences\n are analyzed." },
|
||||
{ "main.opt.apionly", " -apionly Restrict analysis to APIs i.e. dependences\n from the signature of public and protected\n members of public classes including field\n type, method parameter types, returned type,\n checked exception types etc" },
|
||||
{ "main.opt.cp", " -cp <path> -classpath <path> Specify where to find class files" },
|
||||
{ "main.opt.depth", " -depth=<depth> Specify the depth of the transitive\n dependency analysis" },
|
||||
{ "main.opt.dotoutput", " -dotoutput <dir> Destination directory for DOT file output" },
|
||||
{ "main.opt.e", " -e <regex> -regex <regex> Finds dependences matching the given pattern\n (-p and -e are exclusive)" },
|
||||
{ "main.opt.f", " -f <regex> -filter <regex> Filter dependences matching the given pattern\n If given multiple times, the last one will be used.\n -filter:package Filter dependences within the same package (default)\n -filter:archive Filter dependences within the same archive\n -filter:none No -filter:package and -filter:archive filtering\n Filtering specified via the -filter option still applies." },
|
||||
{ "main.opt.h", " -h -? -help Print this usage message" },
|
||||
{ "main.opt.include", " -include <regex> Restrict analysis to classes matching pattern\n This option filters the list of classes to\n be analyzed. It can be used together with\n -p and -e which apply pattern to the dependences" },
|
||||
{ "main.opt.jdkinternals", " -jdkinternals Finds class-level dependences on JDK internal APIs.\n By default, it analyzes all classes on -classpath\n and input files unless -include option is specified.\n This option cannot be used with -p, -e and -s options.\n WARNING: JDK internal APIs may not be accessible in\n the next release." },
|
||||
{ "main.opt.p", " -p <pkgname> -package <pkgname> Finds dependences matching the given package name\n (may be given multiple times)" },
|
||||
{ "main.opt.s", " -s -summary Print dependency summary only" },
|
||||
{ "main.opt.v", " -v -verbose Print all class level dependencies\n Equivalent to -verbose:class -filter:none.\n -verbose:package Print package-level dependencies excluding\n dependencies within the same package by default\n -verbose:class Print class-level dependencies excluding\n dependencies within the same package by default" },
|
||||
{ "main.opt.version", " -version Version information" },
|
||||
{ "main.usage", "Usage: {0} <options> <classes...>\nwhere <classes> can be a pathname to a .class file, a directory, a JAR file,\nor a fully-qualified class name. Possible options include:" },
|
||||
{ "main.usage.summary", "Usage: {0} <options> <classes...>\nuse -h, -? or -help for a list of possible options" },
|
||||
{ "warn.invalid.arg", "Invalid classname or pathname not exist: {0}" },
|
||||
{ "warn.mrjar.usejdk9", "{0} is a multi-release jar file.\nAll versioned entries are analyzed. To analyze the entries for a specific\nversion, use a newer version of jdeps (JDK 9 or later) \"--multi-release\" option." },
|
||||
{ "warn.prefix", "Warning:" },
|
||||
{ "warn.replace.useJDKInternals", "JDK internal APIs are unsupported and private to JDK implementation that are\nsubject to be removed or changed incompatibly and could break your application.\nPlease modify your code to eliminate dependency on any JDK internal APIs.\nFor the most recent update on JDK internal API replacements, please check:\n{0}" },
|
||||
{ "warn.skipped.entry", "{0}" },
|
||||
{ "warn.split.package", "package {0} defined in {1} {2}" },
|
||||
};
|
||||
}
|
||||
}
|
||||
40
jdkSrc/jdk8/com/sun/tools/jdeps/resources/jdeps_ja.java
Normal file
40
jdkSrc/jdk8/com/sun/tools/jdeps/resources/jdeps_ja.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.sun.tools.jdeps.resources;
|
||||
|
||||
public final class jdeps_ja extends java.util.ListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "artifact.not.found", "\u898B\u3064\u304B\u308A\u307E\u305B\u3093" },
|
||||
{ "err.invalid.arg.for.option", "\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0}" },
|
||||
{ "err.invalid.path", "\u7121\u52B9\u306A\u30D1\u30B9: {0}" },
|
||||
{ "err.missing.arg", "{0}\u306B\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093" },
|
||||
{ "err.option.after.class", "\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u30AF\u30E9\u30B9\u306E\u524D\u306B\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}" },
|
||||
{ "err.option.unsupported", "{0}\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093: {1}" },
|
||||
{ "err.profiles.msg", "\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093" },
|
||||
{ "err.unknown.option", "\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}" },
|
||||
{ "error.prefix", "\u30A8\u30E9\u30FC:" },
|
||||
{ "jdeps.wiki.url", "https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool" },
|
||||
{ "main.opt.P", " -P -profile \u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u3001\u307E\u305F\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u3092\u8868\u793A\u3057\u307E\u3059" },
|
||||
{ "main.opt.R", " -R -recursive \u3059\u3079\u3066\u306E\u4F9D\u5B58\u6027\u3092\u518D\u5E30\u7684\u306B\u30C8\u30E9\u30D0\u30FC\u30B9\u3057\u307E\u3059\u3002\n -R\u30AA\u30D7\u30B7\u30E7\u30F3\u306F-filter:none\u3092\u610F\u5473\u3057\u307E\u3059\u3002-p\u3001-e\u3001-f\n \u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u3001\u4E00\u81F4\u3059\u308B\u4F9D\u5B58\u6027\u306E\u307F\n \u5206\u6790\u3055\u308C\u307E\u3059\u3002" },
|
||||
{ "main.opt.apionly", " -apionly \u5206\u6790\u3092API\u3001\u3064\u307E\u308A\u3001\u30D1\u30D6\u30EA\u30C3\u30AF\u30FB\u30AF\u30E9\u30B9\u306E\n \u30D1\u30D6\u30EA\u30C3\u30AF\u30FB\u30E1\u30F3\u30D0\u30FC\u304A\u3088\u3073\u4FDD\u8B77\u3055\u308C\u305F\u30E1\u30F3\u30D0\u30FC\u306E\n \u7F72\u540D\u306B\u304A\u3051\u308B\u4F9D\u5B58\u6027(\u30D5\u30A3\u30FC\u30EB\u30C9\u30FB\u30BF\u30A4\u30D7\u3001\u30E1\u30BD\u30C3\u30C9\u30FB\n \u30D1\u30E9\u30E1\u30FC\u30BF\u30FB\u30BF\u30A4\u30D7\u3001\u623B\u3055\u308C\u305F\u30BF\u30A4\u30D7\u3001\u30C1\u30A7\u30C3\u30AF\u3055\u308C\u305F\n \u4F8B\u5916\u30BF\u30A4\u30D7\u306A\u3069)\u306B\u5236\u9650\u3057\u307E\u3059" },
|
||||
{ "main.opt.cp", " -cp <path> -classpath <path> \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3057\u307E\u3059" },
|
||||
{ "main.opt.depth", " -depth=<depth> \u63A8\u79FB\u7684\u306A\u4F9D\u5B58\u6027\u5206\u6790\u306E\u6DF1\u3055\u3092\n \u6307\u5B9A\u3057\u307E\u3059" },
|
||||
{ "main.opt.dotoutput", " -dotoutput <dir> DOT\u30D5\u30A1\u30A4\u30EB\u51FA\u529B\u306E\u5B9B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA" },
|
||||
{ "main.opt.e", " -e <regex> -regex <regex> \u6307\u5B9A\u306E\u30D1\u30BF\u30FC\u30F3\u306B\u4E00\u81F4\u3059\u308B\u4F9D\u5B58\u6027\u3092\u691C\u51FA\u3057\u307E\u3059\n (-p\u3068-e\u306F\u6392\u4ED6\u7684)" },
|
||||
{ "main.opt.f", " -f <regex> -filter <regex> \u6307\u5B9A\u306E\u30D1\u30BF\u30FC\u30F3\u306B\u4E00\u81F4\u3059\u308B\u4F9D\u5B58\u6027\u3092\u30D5\u30A3\u30EB\u30BF\u3057\u307E\u3059\n \u8907\u6570\u56DE\u6307\u5B9A\u3055\u308C\u305F\u5834\u5408\u3001\u6700\u5F8C\u306E\u3082\u306E\u304C\u4F7F\u7528\u3055\u308C\u307E\u3059\u3002\n -filter:package \u540C\u3058\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u306E\u4F9D\u5B58\u6027\u3092\u30D5\u30A3\u30EB\u30BF\u3057\u307E\u3059(\u30C7\u30D5\u30A9\u30EB\u30C8)\n -filter:archive \u540C\u3058\u30A2\u30FC\u30AB\u30A4\u30D6\u5185\u306E\u4F9D\u5B58\u6027\u3092\u30D5\u30A3\u30EB\u30BF\u3057\u307E\u3059\n -filter:none -filter:package\u304A\u3088\u3073-filter:archive\u306E\u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0\u306F\u884C\u308F\u308C\u307E\u305B\u3093\n -filter\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u6307\u5B9A\u3057\u305F\u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0\u304C\u5F15\u304D\u7D9A\u304D\u9069\u7528\u3055\u308C\u307E\u3059\u3002" },
|
||||
{ "main.opt.h", " -h -? -help \u3053\u306E\u4F7F\u7528\u65B9\u6CD5\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3057\u307E\u3059" },
|
||||
{ "main.opt.include", " -include <regex> \u30D1\u30BF\u30FC\u30F3\u306B\u4E00\u81F4\u3059\u308B\u30AF\u30E9\u30B9\u306B\u5206\u6790\u3092\u5236\u9650\u3057\u307E\u3059\n \u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3059\u308B\u3068\u3001\u5206\u6790\u5BFE\u8C61\u30AF\u30E9\u30B9\u306E\n \u30EA\u30B9\u30C8\u304C\u30D5\u30A3\u30EB\u30BF\u3055\u308C\u307E\u3059\u3002\u30D1\u30BF\u30FC\u30F3\u3092\u4F9D\u5B58\u6027\u306B\n \u9069\u7528\u3059\u308B-p\u304A\u3088\u3073-e\u3068\u4E00\u7DD2\u306B\u4F7F\u7528\u3067\u304D\u307E\u3059" },
|
||||
{ "main.opt.jdkinternals", " -jdkinternals JDK\u5185\u90E8API\u306E\u30AF\u30E9\u30B9\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u691C\u51FA\u3057\u307E\u3059\u3002\n \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001-include\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3057\u306A\u3044\u3068\u3001\n -classpath\u306E\u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3068\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u5206\u6790\u3057\u307E\u3059\u3002\n \u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F-p\u3001-e\u304A\u3088\u3073-s\u30AA\u30D7\u30B7\u30E7\u30F3\u3068\u4E00\u7DD2\u306B\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\n \u8B66\u544A: JDK\u5185\u90E8API\u306F\u3001\u6B21\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u306A\u304F\u306A\u308B\u53EF\u80FD\u6027\u304C\n \u3042\u308A\u307E\u3059\u3002" },
|
||||
{ "main.opt.p", " -p <pkgname> -package <pkgname> \u6307\u5B9A\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u306B\u4E00\u81F4\u3059\u308B\u4F9D\u5B58\u6027\u3092\u691C\u51FA\u3057\u307E\u3059\n (\u8907\u6570\u56DE\u6307\u5B9A\u53EF\u80FD)" },
|
||||
{ "main.opt.s", " -s -summary \u4F9D\u5B58\u6027\u306E\u30B5\u30DE\u30EA\u30FC\u306E\u307F\u51FA\u529B\u3057\u307E\u3059" },
|
||||
{ "main.opt.v", " -v -verbose \u30AF\u30E9\u30B9\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u3059\u3079\u3066\u51FA\u529B\u3057\u307E\u3059\n -verbose:class -filter:none\u3068\u540C\u7B49\u3067\u3059\u3002\n -verbose:package \u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u51FA\u529B\u3057\u307E\u3059\n (\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u540C\u3058\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u306E\u4F9D\u5B58\u6027\u3092\u9664\u304F)\n -verbose:class \u30AF\u30E9\u30B9\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u51FA\u529B\u3057\u307E\u3059\n (\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u540C\u3058\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u306E\u4F9D\u5B58\u6027\u3092\u9664\u304F)" },
|
||||
{ "main.opt.version", " -version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831" },
|
||||
{ "main.usage", "\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes...>\n<classes>\u306B\u306F\u3001.class\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u540D\u3001\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001JAR\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u5B8C\u5168\u4FEE\u98FE\n\u30AF\u30E9\u30B9\u540D\u3092\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\u4F7F\u7528\u3067\u304D\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:" },
|
||||
{ "main.usage.summary", "\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes...>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001-h\u3001-?\u307E\u305F\u306F-help\u3092\u4F7F\u7528\u3057\u307E\u3059" },
|
||||
{ "warn.invalid.arg", "\u7121\u52B9\u306A\u30AF\u30E9\u30B9\u540D\u307E\u305F\u306F\u30D1\u30B9\u540D\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}" },
|
||||
{ "warn.mrjar.usejdk9", "{0}\u306F\u30DE\u30EB\u30C1\u30EA\u30EA\u30FC\u30B9jar\u30D5\u30A1\u30A4\u30EB\u3067\u3059\u3002\n\u3059\u3079\u3066\u306E\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u6E08\u30A8\u30F3\u30C8\u30EA\u3092\u5206\u6790\u3057\u307E\u3059\u3002\u7279\u5B9A\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306E\u30A8\u30F3\u30C8\u30EA\u3092\u5206\u6790\u3059\u308B\u306B\u306F\u3001\n\u65B0\u3057\u3044\u30D0\u30FC\u30B8\u30E7\u30F3\u306Ejdeps (JDK 9\u4EE5\u964D)\u306E\"--multi-release\"\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002" },
|
||||
{ "warn.prefix", "\u8B66\u544A:" },
|
||||
{ "warn.replace.useJDKInternals", "JDK\u5185\u90E8API\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u304A\u3089\u305A\u3001JDK\u5B9F\u88C5\u5C02\u7528\u3067\u3059\u304C\u3001\u4E92\u63DB\u6027\u306A\u3057\u3067\n\u524A\u9664\u307E\u305F\u306F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u3001\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u3092\u4E2D\u65AD\u3055\u305B\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\nJDK\u5185\u90E8API\u306E\u4F9D\u5B58\u6027\u3092\u524A\u9664\u3059\u308B\u3088\u3046\u30B3\u30FC\u30C9\u3092\u5909\u66F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002\nJDK\u5185\u90E8API\u306E\u7F6E\u63DB\u306B\u95A2\u3059\u308B\u6700\u65B0\u306E\u66F4\u65B0\u306B\u3064\u3044\u3066\u306F\u3001\u6B21\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044:\n{0}" },
|
||||
{ "warn.split.package", "\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306F{1} {2}\u3067\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059" },
|
||||
};
|
||||
}
|
||||
}
|
||||
40
jdkSrc/jdk8/com/sun/tools/jdeps/resources/jdeps_zh_CN.java
Normal file
40
jdkSrc/jdk8/com/sun/tools/jdeps/resources/jdeps_zh_CN.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.sun.tools.jdeps.resources;
|
||||
|
||||
public final class jdeps_zh_CN extends java.util.ListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "artifact.not.found", "\u627E\u4E0D\u5230" },
|
||||
{ "err.invalid.arg.for.option", "\u9009\u9879\u7684\u53C2\u6570\u65E0\u6548: {0}" },
|
||||
{ "err.invalid.path", "\u65E0\u6548\u8DEF\u5F84: {0}" },
|
||||
{ "err.missing.arg", "\u6CA1\u6709\u4E3A{0}\u6307\u5B9A\u503C" },
|
||||
{ "err.option.after.class", "\u5FC5\u987B\u5728\u7C7B\u4E4B\u524D\u6307\u5B9A\u9009\u9879: {0}" },
|
||||
{ "err.option.unsupported", "\u4E0D\u652F\u6301{0}: {1}" },
|
||||
{ "err.profiles.msg", "\u6CA1\u6709\u914D\u7F6E\u6587\u4EF6\u4FE1\u606F" },
|
||||
{ "err.unknown.option", "\u672A\u77E5\u9009\u9879: {0}" },
|
||||
{ "error.prefix", "\u9519\u8BEF:" },
|
||||
{ "jdeps.wiki.url", "https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool" },
|
||||
{ "main.opt.P", " -P -profile \u663E\u793A\u914D\u7F6E\u6587\u4EF6\u6216\u5305\u542B\u7A0B\u5E8F\u5305\u7684\u6587\u4EF6" },
|
||||
{ "main.opt.R", " -R -recursive \u9012\u5F52\u904D\u5386\u6240\u6709\u88AB\u4F9D\u8D56\u5BF9\u8C61\u3002\n -R \u9009\u9879\u8868\u793A -filter:none\u3002\u5982\u679C\u6307\u5B9A\u4E86 -p, -e, -f\n \u9009\u9879, \u5219\u53EA\u5206\u6790\u5339\u914D\u7684\n \u88AB\u4F9D\u8D56\u5BF9\u8C61\u3002" },
|
||||
{ "main.opt.apionly", " -apionly \u901A\u8FC7\u516C\u5171\u7C7B (\u5305\u62EC\u5B57\u6BB5\u7C7B\u578B, \u65B9\u6CD5\u53C2\u6570\n \u7C7B\u578B, \u8FD4\u56DE\u7C7B\u578B, \u53D7\u63A7\u5F02\u5E38\u9519\u8BEF\u7C7B\u578B\n \u7B49) \u7684\u516C\u5171\u548C\u53D7\u4FDD\u62A4\u6210\u5458\u7684\u7B7E\u540D\n \u9650\u5236\u5BF9 API (\u5373\u88AB\u4F9D\u8D56\u5BF9\u8C61)\n \u8FDB\u884C\u5206\u6790" },
|
||||
{ "main.opt.cp", " -cp <path> -classpath <path> \u6307\u5B9A\u67E5\u627E\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E" },
|
||||
{ "main.opt.depth", " -depth=<depth> \u6307\u5B9A\u8FC7\u6E21\u88AB\u4F9D\u8D56\u5BF9\u8C61\u5206\u6790\n \u7684\u6DF1\u5EA6" },
|
||||
{ "main.opt.dotoutput", " -dotoutput <dir> DOT \u6587\u4EF6\u8F93\u51FA\u7684\u76EE\u6807\u76EE\u5F55" },
|
||||
{ "main.opt.e", " -e <regex> -regex <regex> \u67E5\u627E\u4E0E\u6307\u5B9A\u6A21\u5F0F\u5339\u914D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n (-p \u548C -e \u4E92\u76F8\u6392\u65A5)" },
|
||||
{ "main.opt.f", " -f <regex> -filter <regex> \u7B5B\u9009\u4E0E\u6307\u5B9A\u6A21\u5F0F\u5339\u914D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n \u5982\u679C\u591A\u6B21\u6307\u5B9A, \u5219\u5C06\u4F7F\u7528\u6700\u540E\u4E00\u4E2A\u88AB\u4F9D\u8D56\u5BF9\u8C61\u3002\n -filter:package \u7B5B\u9009\u4F4D\u4E8E\u540C\u4E00\u7A0B\u5E8F\u5305\u5185\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61 (\u9ED8\u8BA4)\n -filter:archive \u7B5B\u9009\u4F4D\u4E8E\u540C\u4E00\u6863\u6848\u5185\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n -filter:none \u4E0D\u4F7F\u7528 -filter:package \u548C -filter:archive \u7B5B\u9009\n \u901A\u8FC7 -filter \u9009\u9879\u6307\u5B9A\u7684\u7B5B\u9009\u4ECD\u65E7\u9002\u7528\u3002" },
|
||||
{ "main.opt.h", " -h -? -help \u8F93\u51FA\u6B64\u7528\u6CD5\u6D88\u606F" },
|
||||
{ "main.opt.include", " -include <regex> \u5C06\u5206\u6790\u9650\u5236\u4E3A\u4E0E\u6A21\u5F0F\u5339\u914D\u7684\u7C7B\n \u6B64\u9009\u9879\u7B5B\u9009\u8981\u5206\u6790\u7684\u7C7B\u7684\u5217\u8868\u3002\n \u5B83\u53EF\u4EE5\u4E0E\u5411\u88AB\u4F9D\u8D56\u5BF9\u8C61\u5E94\u7528\u6A21\u5F0F\u7684\n -p \u548C -e \u7ED3\u5408\u4F7F\u7528" },
|
||||
{ "main.opt.jdkinternals", " -jdkinternals \u5728 JDK \u5185\u90E8 API \u4E0A\u67E5\u627E\u7C7B\u7EA7\u522B\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\u3002\n \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5B83\u5206\u6790 -classpath \u4E0A\u7684\u6240\u6709\u7C7B\n \u548C\u8F93\u5165\u6587\u4EF6, \u9664\u975E\u6307\u5B9A\u4E86 -include \u9009\u9879\u3002\n \u6B64\u9009\u9879\u4E0D\u80FD\u4E0E -p, -e \u548C -s \u9009\u9879\u4E00\u8D77\u4F7F\u7528\u3002\n \u8B66\u544A: \u5728\u4E0B\u4E00\u4E2A\u53D1\u884C\u7248\u4E2D\u53EF\u80FD\u65E0\u6CD5\u8BBF\u95EE\n JDK \u5185\u90E8 API\u3002" },
|
||||
{ "main.opt.p", " -p <pkgname> -package <pkgname> \u67E5\u627E\u4E0E\u7ED9\u5B9A\u7A0B\u5E8F\u5305\u540D\u79F0\u5339\u914D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n (\u53EF\u591A\u6B21\u6307\u5B9A)" },
|
||||
{ "main.opt.s", " -s -summary \u4EC5\u8F93\u51FA\u88AB\u4F9D\u8D56\u5BF9\u8C61\u6982\u8981" },
|
||||
{ "main.opt.v", " -v -verbose \u8F93\u51FA\u6240\u6709\u7C7B\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61\n \u7B49\u540C\u4E8E -verbose:class -filter:none\u3002\n -verbose:package \u9ED8\u8BA4\u60C5\u51B5\u4E0B\u8F93\u51FA\u7A0B\u5E8F\u5305\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61, \n \u4E0D\u5305\u62EC\u540C\u4E00\u7A0B\u5E8F\u5305\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n -verbose:class \u9ED8\u8BA4\u60C5\u51B5\u4E0B\u8F93\u51FA\u7C7B\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61, \n \u4E0D\u5305\u62EC\u540C\u4E00\u7A0B\u5E8F\u5305\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61" },
|
||||
{ "main.opt.version", " -version \u7248\u672C\u4FE1\u606F" },
|
||||
{ "main.usage", "\u7528\u6CD5: {0} <options> <classes...>\n\u5176\u4E2D <classes> \u53EF\u4EE5\u662F .class \u6587\u4EF6, \u76EE\u5F55, JAR \u6587\u4EF6\u7684\u8DEF\u5F84\u540D,\n\u4E5F\u53EF\u4EE5\u662F\u5168\u9650\u5B9A\u7C7B\u540D\u3002\u53EF\u80FD\u7684\u9009\u9879\u5305\u62EC:" },
|
||||
{ "main.usage.summary", "\u7528\u6CD5: {0} <options> <classes...>\n\u4F7F\u7528 -h, -? \u6216 -help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879" },
|
||||
{ "warn.invalid.arg", "\u7C7B\u540D\u65E0\u6548\u6216\u8DEF\u5F84\u540D\u4E0D\u5B58\u5728: {0}" },
|
||||
{ "warn.mrjar.usejdk9", "{0} \u662F\u591A\u53D1\u884C\u7248 jar \u6587\u4EF6\u3002\n\u5DF2\u5206\u6790\u6240\u6709\u7248\u672C\u5316\u6761\u76EE\u3002\u8981\u5206\u6790\u67D0\u4E2A\u7279\u5B9A\u7248\u672C\u7684\u6761\u76EE,\n\u8BF7\u4F7F\u7528\u66F4\u65B0\u7248\u672C\u7684 jdeps (JDK 9 \u6216\u66F4\u9AD8\u7248\u672C) \"--multi-release\" \u9009\u9879\u3002" },
|
||||
{ "warn.prefix", "\u8B66\u544A:" },
|
||||
{ "warn.replace.useJDKInternals", "\u4E0D\u652F\u6301 JDK \u5185\u90E8 API, \u5B83\u4EEC\u4E13\u7528\u4E8E\u901A\u8FC7\u4E0D\u517C\u5BB9\u65B9\u5F0F\u6765\u5220\u9664\n\u6216\u66F4\u6539\u7684 JDK \u5B9E\u73B0, \u53EF\u80FD\u4F1A\u635F\u574F\u60A8\u7684\u5E94\u7528\u7A0B\u5E8F\u3002\n\u8BF7\u4FEE\u6539\u60A8\u7684\u4EE3\u7801, \u6D88\u9664\u4E0E\u4EFB\u4F55 JDK \u5185\u90E8 API \u7684\u76F8\u5173\u6027\u3002\n\u6709\u5173 JDK \u5185\u90E8 API \u66FF\u6362\u7684\u6700\u65B0\u66F4\u65B0, \u8BF7\u67E5\u770B:\n{0}" },
|
||||
{ "warn.split.package", "\u5DF2\u5728{1} {2}\u4E2D\u5B9A\u4E49\u7A0B\u5E8F\u5305{0}" },
|
||||
};
|
||||
}
|
||||
}
|
||||
49
jdkSrc/jdk8/com/sun/tools/jdeps/resources/jdkinternals.java
Normal file
49
jdkSrc/jdk8/com/sun/tools/jdeps/resources/jdkinternals.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.sun.tools.jdeps.resources;
|
||||
|
||||
public final class jdkinternals extends java.util.ListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "//", "No translation needed" },
|
||||
{ "com.apple.concurrent", "Removed in JDK 9. See https://bugs.openjdk.java.net/browse/JDK-8148187" },
|
||||
{ "com.apple.eawt", "Use java.awt.Desktop @since 9. See http://openjdk.java.net/jeps/272" },
|
||||
{ "com.sun.crypto.provider.SunJCE", "Use java.security.Security.getProvider(provider-name) @since 1.3" },
|
||||
{ "com.sun.image.codec.jpeg", "Use javax.imageio @since 1.4" },
|
||||
{ "com.sun.net.ssl", "Use javax.net.ssl @since 1.4" },
|
||||
{ "com.sun.net.ssl.internal.ssl.Provider", "Use java.security.Security.getProvider(provider-name) @since 1.3" },
|
||||
{ "com.sun.org.apache.xml.internal.resolver", "Use javax.xml.catalog @since 9" },
|
||||
{ "com.sun.org.apache.xml.internal.security", "Use java.xml.crypto @since 1.6" },
|
||||
{ "com.sun.org.apache.xml.internal.security.utils.Base64", "Use java.util.Base64 @since 1.8" },
|
||||
{ "com.sun.rowset", "Use javax.sql.rowset.RowSetProvider @since 1.7" },
|
||||
{ "com.sun.tools.doclets.standard", "Use jdk.javadoc.doclets.StandardDoclet @since 9." },
|
||||
{ "com.sun.tools.javac", "Use javax.tools and javax.lang.model @since 1.6" },
|
||||
{ "com.sun.tools.javac.tree", "Use com.sun.source @since 1.6" },
|
||||
{ "java.awt.dnd.peer", "Should not use. See https://bugs.openjdk.java.net/browse/JDK-8037739" },
|
||||
{ "java.awt.peer", "Should not use. See https://bugs.openjdk.java.net/browse/JDK-8037739" },
|
||||
{ "jdk.internal.ref.Cleaner", "Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9" },
|
||||
{ "sun.awt.CausedFocusEvent", "Use java.awt.event.FocusEvent::getCause @since 9" },
|
||||
{ "sun.awt.image.codec", "Use javax.imageio @since 1.4" },
|
||||
{ "sun.font.FontUtilities", "See java.awt.Font.textRequiresLayout @since 9" },
|
||||
{ "sun.misc", "Removed in JDK 9. See http://openjdk.java.net/jeps/260" },
|
||||
{ "sun.misc.BASE64Decoder", "Use java.util.Base64 @since 1.8" },
|
||||
{ "sun.misc.BASE64Encoder", "Use java.util.Base64 @since 1.8" },
|
||||
{ "sun.misc.ClassLoaderUtil", "Use java.net.URLClassLoader.close() @since 1.7" },
|
||||
{ "sun.misc.Cleaner", "Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9.\nSee http://openjdk.java.net/jeps/260." },
|
||||
{ "sun.misc.Service", "Use java.util.ServiceLoader @since 1.6" },
|
||||
{ "sun.misc.Signal", "See http://openjdk.java.net/jeps/260" },
|
||||
{ "sun.misc.SignalHandler", "See http://openjdk.java.net/jeps/260" },
|
||||
{ "sun.misc.Unsafe", "See http://openjdk.java.net/jeps/260" },
|
||||
{ "sun.reflect", "Removed in JDK 9. See http://openjdk.java.net/jeps/260" },
|
||||
{ "sun.reflect.Reflection", "See http://openjdk.java.net/jeps/260" },
|
||||
{ "sun.reflect.ReflectionFactory", "See http://openjdk.java.net/jeps/260" },
|
||||
{ "sun.security.action", "Use java.security.PrivilegedAction @since 1.1" },
|
||||
{ "sun.security.krb5", "Use com.sun.security.jgss" },
|
||||
{ "sun.security.provider.PolicyFile", "Use java.security.Policy.getInstance(\"JavaPolicy\", new URIParameter(uri)) @since 1.6" },
|
||||
{ "sun.security.provider.Sun", "Use java.security.Security.getProvider(provider-name) @since 1.3" },
|
||||
{ "sun.security.util.HostnameChecker", "Use javax.net.ssl.SSLParameters.setEndpointIdentificationAlgorithm(\"HTTPS\") @since 1.7\nor javax.net.ssl.HttpsURLConnection.setHostnameVerifier() @since 1.4" },
|
||||
{ "sun.security.util.SecurityConstants", "Use appropriate java.security.Permission subclass @since 1.1" },
|
||||
{ "sun.security.x509.X500Name", "Use javax.security.auth.x500.X500Principal @since 1.4" },
|
||||
{ "sun.tools.jar", "Use java.util.jar @since 1.2" },
|
||||
{ "sun.tools.jar.Main", "Use java.util.spi.ToolProvider @since 9" },
|
||||
};
|
||||
}
|
||||
}
|
||||
11
jdkSrc/jdk8/com/sun/tools/jdeps/resources/version.java
Normal file
11
jdkSrc/jdk8/com/sun/tools/jdeps/resources/version.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.sun.tools.jdeps.resources;
|
||||
|
||||
public final class version extends java.util.ListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "full", "1.8.0_462-b08" },
|
||||
{ "jdk", "1.8.0_462" },
|
||||
{ "release", "1.8.0_462" },
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user