|
|
@ -98,18 +98,22 @@ public class PackageInternalsFinder {
|
|
|
|
|
|
|
|
|
|
|
|
JarURLConnection jarConn = (JarURLConnection) packageFolderURL.openConnection();
|
|
|
|
JarURLConnection jarConn = (JarURLConnection) packageFolderURL.openConnection();
|
|
|
|
String rootEntryName = jarConn.getEntryName();
|
|
|
|
String rootEntryName = jarConn.getEntryName();
|
|
|
|
int rootEnd = rootEntryName.length() + 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enumeration<JarEntry> entryEnum = jarConn.getJarFile().entries();
|
|
|
|
if (rootEntryName != null) {
|
|
|
|
while (entryEnum.hasMoreElements()) {
|
|
|
|
//可能为 null(自己没有类文件时)
|
|
|
|
JarEntry jarEntry = entryEnum.nextElement();
|
|
|
|
int rootEnd = rootEntryName.length() + 1;
|
|
|
|
String name = jarEntry.getName();
|
|
|
|
|
|
|
|
if (name.startsWith(rootEntryName) && name.indexOf('/', rootEnd) == -1 && name.endsWith(CLASS_FILE_EXTENSION)) {
|
|
|
|
|
|
|
|
URI uri = URI.create(jarUri + "!/" + name);
|
|
|
|
|
|
|
|
String binaryName = name.replaceAll("/", ".");
|
|
|
|
|
|
|
|
binaryName = binaryName.replaceAll(CLASS_FILE_EXTENSION + "$", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.add(new CustomJavaFileObject(binaryName, uri));
|
|
|
|
Enumeration<JarEntry> entryEnum = jarConn.getJarFile().entries();
|
|
|
|
|
|
|
|
while (entryEnum.hasMoreElements()) {
|
|
|
|
|
|
|
|
JarEntry jarEntry = entryEnum.nextElement();
|
|
|
|
|
|
|
|
String name = jarEntry.getName();
|
|
|
|
|
|
|
|
if (name.startsWith(rootEntryName) && name.indexOf('/', rootEnd) == -1 && name.endsWith(CLASS_FILE_EXTENSION)) {
|
|
|
|
|
|
|
|
URI uri = URI.create(jarUri + "!/" + name);
|
|
|
|
|
|
|
|
String binaryName = name.replaceAll("/", ".");
|
|
|
|
|
|
|
|
binaryName = binaryName.replaceAll(CLASS_FILE_EXTENSION + "$", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.add(new CustomJavaFileObject(binaryName, uri));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|