changeset 48273:6c4bdbf90897

8193064: JarFile::getEntry0 method reference use cause for startup regression Reviewed-by: sherman, mchung
author redestad
date Tue, 05 Dec 2017 22:26:17 +0100
parents df95bd1fd4b1
children 3ce28a37652d 268fd44ea299 cda699d0e6fa 2d6e9344cc97 4b3760787150 f12a3b2f331e 1bf9afefd598 7c08e9f96916
files src/java.base/share/classes/java/util/jar/JarFile.java
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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) {