8193064: JarFile::getEntry0 method reference use cause for startup regression
authorredestad
Tue, 05 Dec 2017 22:26:17 +0100
changeset 48067 6c4bdbf90897
parent 48066 df95bd1fd4b1
child 48068 7c08e9f96916
8193064: JarFile::getEntry0 method reference use cause for startup regression Reviewed-by: sherman, mchung
src/java.base/share/classes/java/util/jar/JarFile.java
--- a/src/java.base/share/classes/java/util/jar/JarFile.java	Tue Dec 05 09:44:32 2017 -0800
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java	Tue Dec 05 22:26:17 2017 +0100
@@ -43,17 +43,12 @@
 import java.security.cert.Certificate;
 import java.util.ArrayList;
 import java.util.Enumeration;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Objects;
-import java.util.Spliterator;
-import java.util.Spliterators;
-import java.util.stream.Collector;
+import java.util.function.Function;
 import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
@@ -566,7 +561,14 @@
      * given entry name or {@code null} if not found.
      */
     private JarFileEntry getEntry0(String name) {
-        return (JarFileEntry)JUZFA.getEntry(this, name, JarFileEntry::new);
+        // Not using a lambda/method reference here to optimize startup time
+        Function<String, JarEntry> newJarFileEntryFn = new Function<>() {
+            @Override
+            public JarEntry apply(String name) {
+                return new JarFileEntry(name);
+            }
+        };
+        return (JarFileEntry)JUZFA.getEntry(this, name, newJarFileEntryFn);
     }
 
     private String getBasename(String name) {