8193490: java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java, FinalizeZipFile.java, TestCleaner.java, Collectible.java failed because cleaner can't finish
authorsherman
Wed, 13 Dec 2017 21:41:50 -0800
changeset 48330 e8230b52a8f4
parent 48329 984c4b99afc9
child 48331 a8e39cc7b88f
8193490: java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java, FinalizeZipFile.java, TestCleaner.java, Collectible.java failed because cleaner can't finish Reviewed-by: darcy
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 19:48:03 2017 -0800
+++ b/src/java.base/share/classes/java/util/zip/Inflater.java	Wed Dec 13 21:41:50 2017 -0800
@@ -25,9 +25,6 @@
 
 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
@@ -118,20 +115,7 @@
      * @param nowrap if true then support GZIP compatible compression
      */
     public Inflater(boolean nowrap) {
-        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();
-                    }
-                });
+        this.zsRef = ZStreamRef.get(this, () -> init(nowrap), Inflater::end);
     }
 
     /**
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java	Wed Dec 13 19:48:03 2017 -0800
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java	Wed Dec 13 21:41:50 2017 -0800
@@ -427,12 +427,7 @@
                                            Inflater inf, int size) {
             super(zfin, inf, size);
             this.cleanable = CleanerFactory.cleaner().register(this,
-                    new Runnable() {
-                        @Override
-                        public void run() {
-                            res.releaseInflater(inf);
-                        }
-                    });
+                    () -> res.releaseInflater(inf));
        }
 
         public void close() throws IOException {