author | sla |
Thu, 13 Nov 2014 07:58:28 +0100 | |
changeset 27622 | 38913dc333ed |
parent 26276 | 0dca2378aa34 |
child 27579 | d1a63c99cdd5 |
permissions | -rw-r--r-- |
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
1 |
/* |
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
2 |
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
4 |
* |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
10 |
* |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
15 |
* accompanied this code). |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
16 |
* |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
20 |
* |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
23 |
* questions. |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
24 |
*/ |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
25 |
package com.sun.tools.jdeps; |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
26 |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
27 |
import com.sun.tools.classfile.Annotation; |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
28 |
import com.sun.tools.classfile.ClassFile; |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
29 |
import com.sun.tools.classfile.ConstantPool; |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
30 |
import com.sun.tools.classfile.ConstantPoolException; |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
31 |
import com.sun.tools.classfile.RuntimeAnnotations_attribute; |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
32 |
import com.sun.tools.classfile.Dependencies.ClassFileError; |
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
33 |
import java.io.IOException; |
25874 | 34 |
import java.io.InputStream; |
26276
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
35 |
import java.io.BufferedInputStream; |
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
36 |
import java.nio.file.FileVisitResult; |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
37 |
import java.nio.file.Files; |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
38 |
import java.nio.file.Path; |
21046
ebf16a1a6328
8015912: jdeps support to output in dot file format
mchung
parents:
16560
diff
changeset
|
39 |
import java.nio.file.Paths; |
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
40 |
import java.nio.file.SimpleFileVisitor; |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
41 |
import java.nio.file.attribute.BasicFileAttributes; |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
42 |
import java.util.*; |
25874 | 43 |
import java.util.jar.*; |
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
44 |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
45 |
import static com.sun.tools.classfile.Attribute.*; |
25874 | 46 |
import static com.sun.tools.jdeps.ClassFileReader.*; |
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
47 |
|
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
48 |
/** |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
49 |
* ClassPath for Java SE and JDK |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
50 |
*/ |
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
51 |
class PlatformClassPath { |
25874 | 52 |
private static List<Archive> modules; |
53 |
static synchronized List<Archive> getArchives(Path mpath) throws IOException { |
|
54 |
if (modules == null) { |
|
55 |
initPlatformArchives(mpath); |
|
21046
ebf16a1a6328
8015912: jdeps support to output in dot file format
mchung
parents:
16560
diff
changeset
|
56 |
} |
25874 | 57 |
return modules; |
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
58 |
} |
21046
ebf16a1a6328
8015912: jdeps support to output in dot file format
mchung
parents:
16560
diff
changeset
|
59 |
|
ebf16a1a6328
8015912: jdeps support to output in dot file format
mchung
parents:
16560
diff
changeset
|
60 |
/** |
25874 | 61 |
* Finds the module with the given name. Returns null |
62 |
* if such module doesn't exist. |
|
63 |
* |
|
64 |
* @param mn module name |
|
21046
ebf16a1a6328
8015912: jdeps support to output in dot file format
mchung
parents:
16560
diff
changeset
|
65 |
*/ |
25874 | 66 |
static Module findModule(String mn) { |
67 |
for (Archive a : modules) { |
|
68 |
if (Module.class.isInstance(a)) { |
|
69 |
Module m = (Module)a; |
|
70 |
if (mn.equals(m.name())) { |
|
71 |
return m; |
|
72 |
} |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
73 |
} |
25874 | 74 |
} |
75 |
return null; |
|
76 |
} |
|
77 |
||
78 |
private static List<Archive> initPlatformArchives(Path mpath) throws IOException { |
|
79 |
Path home = Paths.get(System.getProperty("java.home")); |
|
80 |
if (mpath == null && !home.endsWith("jre")) { |
|
81 |
// jdk build |
|
82 |
Path p = home.resolve("modules"); |
|
83 |
if (Files.isDirectory(p)) { |
|
84 |
mpath = p; |
|
85 |
} |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
86 |
} |
25874 | 87 |
modules = mpath != null ? initModules(mpath) : initLegacyImage(home); |
88 |
if (findModule("java.base") != null) { |
|
89 |
Profile.initProfiles(); |
|
90 |
} |
|
91 |
return modules; |
|
92 |
} |
|
93 |
||
94 |
private static List<Archive> initModules(Path mpath) throws IOException { |
|
26276
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
95 |
String fn = System.getProperty("jdeps.modules.xml"); |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
96 |
if (fn!= null) { |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
97 |
Path p = Paths.get(fn); |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
98 |
try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) { |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
99 |
return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in)); |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
100 |
} |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
101 |
} else { |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
102 |
try (InputStream in = PlatformClassPath.class |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
103 |
.getResourceAsStream("resources/jdeps-modules.xml")) { |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
104 |
return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in)); |
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
105 |
} |
25874 | 106 |
} |
107 |
} |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
108 |
|
25874 | 109 |
private static List<Archive> initLegacyImage(Path home) throws IOException { |
110 |
LegacyImageHelper cfr = new LegacyImageHelper(home); |
|
111 |
List<Archive> archives = new ArrayList<>(cfr.nonPlatformArchives); |
|
112 |
try (InputStream in = PlatformClassPath.class |
|
26276
0dca2378aa34
8055856: checkdeps build target doesn't work for cross-compilation builds
mchung
parents:
25874
diff
changeset
|
113 |
.getResourceAsStream("resources/jdeps-modules.xml")) { |
25874 | 114 |
archives.addAll(ModulesXmlReader.loadFromImage(cfr, in)); |
115 |
return archives; |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
116 |
} |
25874 | 117 |
} |
118 |
||
119 |
static class LegacyImageHelper { |
|
120 |
private static final List<String> NON_PLATFORM_JARFILES = |
|
121 |
Arrays.asList("alt-rt.jar", "jfxrt.jar", "ant-javafx.jar", "javafx-mx.jar"); |
|
122 |
final List<Archive> nonPlatformArchives = new ArrayList<>(); |
|
123 |
final List<JarFile> jarfiles = new ArrayList<>(); |
|
124 |
final Path home; |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
125 |
|
25874 | 126 |
LegacyImageHelper(Path home) { |
127 |
this.home = home; |
|
128 |
try { |
|
129 |
if (home.endsWith("jre")) { |
|
130 |
// jar files in <javahome>/jre/lib |
|
131 |
addJarFiles(home.resolve("lib")); |
|
132 |
if (home.getParent() != null) { |
|
133 |
// add tools.jar and other JDK jar files |
|
134 |
Path lib = home.getParent().resolve("lib"); |
|
135 |
if (Files.exists(lib)) { |
|
136 |
addJarFiles(lib); |
|
137 |
} |
|
138 |
} |
|
139 |
} else if (Files.exists(home.resolve("lib"))) { |
|
140 |
// add other JAR files |
|
141 |
addJarFiles(home.resolve("lib")); |
|
142 |
} else { |
|
143 |
throw new RuntimeException("\"" + home + "\" not a JDK home"); |
|
144 |
} |
|
145 |
} catch (IOException e) { |
|
146 |
throw new Error(e); |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
147 |
} |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
148 |
} |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
149 |
|
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
150 |
/** |
25874 | 151 |
* Returns a ClassFileReader that only reads classes for the given modulename. |
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
152 |
*/ |
25874 | 153 |
ClassFileReader getClassReader(String modulename, Set<String> packages) throws IOException { |
154 |
return new ModuleClassReader(modulename, packages); |
|
155 |
} |
|
156 |
||
157 |
private void addJarFiles(final Path root) throws IOException { |
|
158 |
final Path ext = root.resolve("ext"); |
|
159 |
Files.walkFileTree(root, new SimpleFileVisitor<Path>() { |
|
160 |
@Override |
|
161 |
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) |
|
162 |
throws IOException |
|
163 |
{ |
|
164 |
if (dir.equals(root) || dir.equals(ext)) { |
|
165 |
return FileVisitResult.CONTINUE; |
|
166 |
} else { |
|
167 |
// skip other cobundled JAR files |
|
168 |
return FileVisitResult.SKIP_SUBTREE; |
|
169 |
} |
|
170 |
} |
|
171 |
||
172 |
@Override |
|
173 |
public FileVisitResult visitFile(Path p, BasicFileAttributes attrs) |
|
174 |
throws IOException |
|
175 |
{ |
|
176 |
String fn = p.getFileName().toString(); |
|
177 |
if (fn.endsWith(".jar")) { |
|
178 |
// JDK may cobundle with JavaFX that doesn't belong to any profile |
|
179 |
// Treat jfxrt.jar as regular Archive |
|
180 |
if (NON_PLATFORM_JARFILES.contains(fn)) { |
|
181 |
nonPlatformArchives.add(Archive.getInstance(p)); |
|
182 |
} else { |
|
183 |
jarfiles.add(new JarFile(p.toFile())); |
|
184 |
} |
|
185 |
} |
|
186 |
return FileVisitResult.CONTINUE; |
|
187 |
} |
|
188 |
}); |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
189 |
} |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
190 |
|
25874 | 191 |
/** |
192 |
* ModuleClassFile reads classes for the specified module from the legacy image. |
|
193 |
* |
|
194 |
*/ |
|
195 |
class ModuleClassReader extends JarFileReader { |
|
196 |
private JarFile cachedJarFile = getJarFile(0); |
|
197 |
private final Set<String> packages; |
|
198 |
private final String module; |
|
199 |
ModuleClassReader(String module, Set<String> packages) throws IOException { |
|
200 |
super(home, null); |
|
201 |
this.module = module; |
|
202 |
this.packages = packages; |
|
203 |
} |
|
204 |
||
205 |
private boolean includes(String name) { |
|
206 |
String cn = name.replace('/', '.'); |
|
207 |
int i = cn.lastIndexOf('.'); |
|
208 |
String pn = i > 0 ? cn.substring(0, i) : ""; |
|
209 |
return packages.contains(pn); |
|
210 |
} |
|
211 |
||
212 |
private JarEntry findJarEntry(JarFile jarfile, String entryName1, String entryName2) { |
|
213 |
JarEntry e = jarfile.getJarEntry(entryName1); |
|
214 |
if (e == null) { |
|
215 |
e = jarfile.getJarEntry(entryName2); |
|
216 |
} |
|
217 |
return e; |
|
218 |
} |
|
219 |
||
220 |
public String toString() { |
|
221 |
return module + " " + packages.size() + " " + packages; |
|
222 |
} |
|
223 |
||
224 |
@Override |
|
225 |
public ClassFile getClassFile(String name) throws IOException { |
|
226 |
if (jarfiles.isEmpty() || !includes(name)) { |
|
227 |
return null; |
|
228 |
} |
|
229 |
||
230 |
if (name.indexOf('.') > 0) { |
|
231 |
int i = name.lastIndexOf('.'); |
|
232 |
String entryName = name.replace('.', '/') + ".class"; |
|
233 |
String innerClassName = entryName.substring(0, i) + "$" |
|
234 |
+ entryName.substring(i + 1, entryName.length()); |
|
235 |
JarEntry e = findJarEntry(cachedJarFile, entryName, innerClassName); |
|
236 |
if (e != null) { |
|
237 |
return readClassFile(cachedJarFile, e); |
|
238 |
} |
|
239 |
for (JarFile jf : jarfiles) { |
|
240 |
if (jf == cachedJarFile) { |
|
241 |
continue; |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
242 |
} |
25874 | 243 |
System.err.format("find jar entry %s at %s%n", entryName, jf); |
244 |
e = findJarEntry(jf, entryName, innerClassName); |
|
245 |
if (e != null) { |
|
246 |
cachedJarFile = jf; |
|
247 |
return readClassFile(jf, e); |
|
248 |
} |
|
249 |
} |
|
250 |
} else { |
|
251 |
String entryName = name + ".class"; |
|
252 |
JarEntry e = cachedJarFile.getJarEntry(entryName); |
|
253 |
if (e != null) { |
|
254 |
return readClassFile(cachedJarFile, e); |
|
255 |
} |
|
256 |
for (JarFile jf : jarfiles) { |
|
257 |
if (jf == cachedJarFile) { |
|
258 |
continue; |
|
259 |
} |
|
260 |
e = jf.getJarEntry(entryName); |
|
261 |
if (e != null) { |
|
262 |
cachedJarFile = jf; |
|
263 |
return readClassFile(jf, e); |
|
264 |
} |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
265 |
} |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
266 |
} |
25874 | 267 |
return null; |
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
268 |
} |
25874 | 269 |
|
270 |
@Override |
|
271 |
public Iterable<ClassFile> getClassFiles() throws IOException { |
|
272 |
final Iterator<ClassFile> iter = new ModuleClassIterator(this); |
|
273 |
return new Iterable<ClassFile>() { |
|
274 |
public Iterator<ClassFile> iterator() { |
|
275 |
return iter; |
|
276 |
} |
|
277 |
}; |
|
278 |
} |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
279 |
|
25874 | 280 |
private JarFile getJarFile(int index) { |
281 |
return index < jarfiles.size() ? jarfiles.get(index) : null; |
|
282 |
} |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
283 |
|
25874 | 284 |
class ModuleClassIterator extends JarFileIterator { |
285 |
private int index; |
|
286 |
ModuleClassIterator(ModuleClassReader reader) { |
|
287 |
super(reader); |
|
288 |
this.index = 0; |
|
289 |
this.jf = getJarFile(0); |
|
290 |
this.entries = jf != null ? jf.entries() : null; |
|
291 |
this.nextEntry = nextEntry(); |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
292 |
} |
25874 | 293 |
|
294 |
@Override |
|
295 |
protected JarEntry nextEntry() { |
|
296 |
while (jf != null) { |
|
297 |
while (entries.hasMoreElements()) { |
|
298 |
JarEntry e = entries.nextElement(); |
|
299 |
String name = e.getName(); |
|
300 |
if (name.endsWith(".class") && includes(name)) { |
|
301 |
return e; |
|
302 |
} |
|
303 |
} |
|
304 |
jf = getJarFile(++index); |
|
305 |
entries = jf != null ? jf.entries() : null; |
|
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
306 |
} |
25874 | 307 |
return null; |
25442
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
308 |
} |
755ff386d1ac
8029548: (jdeps) use @jdk.Exported to determine supported vs JDK internal API
mchung
parents:
21046
diff
changeset
|
309 |
} |
21046
ebf16a1a6328
8015912: jdeps support to output in dot file format
mchung
parents:
16560
diff
changeset
|
310 |
} |
ebf16a1a6328
8015912: jdeps support to output in dot file format
mchung
parents:
16560
diff
changeset
|
311 |
} |
15030
2d8dec41f029
8003562: Provide a CLI tool to analyze class dependencies
mchung
parents:
diff
changeset
|
312 |
} |