langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java
changeset 38530 8e89d567748c
parent 38529 58cf7e51c16d
child 41164 69167c89e68f
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Thu May 19 17:34:05 2016 -0700
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Fri May 20 09:47:00 2016 -0700
@@ -29,6 +29,7 @@
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.Dependencies.ClassFileError;
 
+import java.io.Closeable;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -54,7 +55,7 @@
  * ClassFileReader reads ClassFile(s) of a given path that can be
  * a .class file, a directory, or a JAR file.
  */
-public class ClassFileReader {
+public class ClassFileReader implements Closeable {
     /**
      * Returns a ClassFileReader instance of a given path.
      */
@@ -177,6 +178,10 @@
         return fn.endsWith(".class");
     }
 
+    @Override
+    public void close() throws IOException {
+    }
+
     class FileIterator implements Iterator<ClassFile> {
         int count;
         FileIterator() {
@@ -306,6 +311,11 @@
             this.jarfile = jf;
         }
 
+        @Override
+        public void close() throws IOException {
+            jarfile.close();
+        }
+
         protected Set<String> scan() {
             try (JarFile jf = new JarFile(path.toFile())) {
                 return jf.stream().map(JarEntry::getName)