8193471: Startup regression due to JDK-8185582
authorredestad
Wed, 13 Dec 2017 21:25:49 +0100
changeset 48294 2608240fc957
parent 48293 2fa0077c4fec
child 48295 c79d31ba84b9
8193471: Startup regression due to JDK-8185582 Reviewed-by: rriggs, psandoz
src/java.base/share/classes/java/util/zip/Inflater.java
src/java.base/share/classes/java/util/zip/ZipFile.java
--- a/src/java.base/share/classes/java/util/zip/Inflater.java	Wed Dec 13 11:43:57 2017 -0800
+++ b/src/java.base/share/classes/java/util/zip/Inflater.java	Wed Dec 13 21:25:49 2017 +0100
@@ -25,6 +25,9 @@
 
 package java.util.zip;
 
+import java.util.function.LongConsumer;
+import java.util.function.LongSupplier;
+
 /**
  * This class provides support for general purpose decompression using the
  * popular ZLIB compression library. The ZLIB compression library was
@@ -115,7 +118,20 @@
      * @param nowrap if true then support GZIP compatible compression
      */
     public Inflater(boolean nowrap) {
-        this.zsRef = ZStreamRef.get(this, () -> init(nowrap), Inflater::end);
+        this.zsRef = ZStreamRef.get(this,
+                // Desugared for startup purposes.
+                new LongSupplier() {
+                    @Override
+                    public long getAsLong() {
+                        return init(nowrap);
+                    }
+                },
+                new LongConsumer() {
+                    @Override
+                    public void accept(long value) {
+                        end();
+                    }
+                });
     }
 
     /**
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java	Wed Dec 13 11:43:57 2017 -0800
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java	Wed Dec 13 21:25:49 2017 +0100
@@ -427,7 +427,12 @@
                                            Inflater inf, int size) {
             super(zfin, inf, size);
             this.cleanable = CleanerFactory.cleaner().register(this,
-                    () -> res.releaseInflater(inf));
+                    new Runnable() {
+                        @Override
+                        public void run() {
+                            res.releaseInflater(inf);
+                        }
+                    });
        }
 
         public void close() throws IOException {