diff --git a/src/java.base/share/classes/java/util/jar/JarInputStream.java b/src/java.base/share/classes/java/util/jar/JarInputStream.java index 9d76f4101e4..1de4cedf238 100644 --- a/src/java.base/share/classes/java/util/jar/JarInputStream.java +++ b/src/java.base/share/classes/java/util/jar/JarInputStream.java @@ -140,7 +140,7 @@ private byte[] getBytes(InputStream is) * @exception SecurityException if any of the jar file entries * are incorrectly signed. */ - public ZipEntry getNextEntry() throws IOException { + public @Nullable ZipEntry getNextEntry() throws IOException { JarEntry e; if (first == null) { e = (JarEntry)super.getNextEntry(); diff --git a/src/java.base/share/classes/java/util/zip/ZipInputStream.java b/src/java.base/share/classes/java/util/zip/ZipInputStream.java index 23dc6648f2c..9a2e4ad9998 100644 --- a/src/java.base/share/classes/java/util/zip/ZipInputStream.java +++ b/src/java.base/share/classes/java/util/zip/ZipInputStream.java @@ -30,6 +30,9 @@ import org.checkerframework.checker.index.qual.LTEqLengthOf; import org.checkerframework.framework.qual.AnnotatedFor; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; + import java.io.InputStream; import java.io.IOException; import java.io.EOFException; @@ -48,6 +51,7 @@ * @since 1.1 */ @AnnotatedFor({"index"}) +@NullMarked public class ZipInputStream extends InflaterInputStream implements ZipConstants { private ZipEntry entry; @@ -119,7 +123,7 @@ public ZipInputStream(InputStream in, Charset charset) { * @exception ZipException if a ZIP file error has occurred * @exception IOException if an I/O error has occurred */ - public ZipEntry getNextEntry() throws IOException { + public @Nullable ZipEntry getNextEntry() throws IOException { ensureOpen(); if (entry != null) { closeEntry();