From d1d75812b049df4c7e7b388f82a986409cfba22e Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Fri, 22 May 2015 08:56:33 -0700 Subject: [PATCH] 8064736: Part of java.util.jar.JarFile spec looks confusing with references to Zip Update the api doc for entries()/stream() accordingly Reviewed-by: alanb --- .../share/classes/java/util/jar/JarFile.java | 16 ++++++++++++++-- .../share/classes/java/util/zip/ZipFile.java | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java index 3c01aacecc2..f565bc02361 100644 --- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java @@ -268,13 +268,25 @@ class JarFile extends ZipFile { } /** - * Returns an enumeration of the zip file entries. + * Returns an enumeration of the jar file entries. + * + * @return an enumeration of the jar file entries + * @throws IllegalStateException + * may be thrown if the jar file has been closed */ public Enumeration entries() { return new JarEntryIterator(); } - @Override + /** + * Returns an ordered {@code Stream} over the jar file entries. + * Entries appear in the {@code Stream} in the order they appear in + * the central directory of the jar file. + * + * @return an ordered {@code Stream} of entries in this jar file + * @throws IllegalStateException if the jar file has been closed + * @since 1.8 + */ public Stream stream() { return StreamSupport.stream(Spliterators.spliterator( new JarEntryIterator(), size(), diff --git a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java index e6b9f01a38b..8669158bbc9 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java +++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java @@ -538,7 +538,7 @@ class ZipFile implements ZipConstants, Closeable { } /** - * Return an ordered {@code Stream} over the ZIP file entries. + * Returns an ordered {@code Stream} over the ZIP file entries. * Entries appear in the {@code Stream} in the order they appear in * the central directory of the ZIP file. *