Speed optimization in ReflectiveEnvironment#isPackage()
Try to short-circuit by looking for .class file, assuming passed packagePath is
catually a class name (which seem to be true in most casess)
--- a/tools/java/src/stx/libjava/tools/environment/ReflectiveEnvironment.java Thu Jul 24 21:18:20 2014 +0100
+++ b/tools/java/src/stx/libjava/tools/environment/ReflectiveEnvironment.java Fri Jul 25 00:08:36 2014 +0100
@@ -248,7 +248,14 @@
zip = new ZipFile(file);
if (DEBUG_isPackage) {
System.err.println("checking jar: " + file.getName());
- }
+ }
+ /* try to short-circuit: look for .class file assuming
+ * packageName is actually class name. If found, return
+ * false (it is a class, not a package)
+ */
+ if (zip.getEntry(packagePathSlashed + ".class") != null) {
+ return true;
+ }
Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements()) {
String entryName = entries.nextElement().getName();