diff --git a/src/java.base/share/classes/java/lang/StackWalker.java b/src/java.base/share/classes/java/lang/StackWalker.java index 8a39c465c2b..c8b8deb6c88 100644 --- a/src/java.base/share/classes/java/lang/StackWalker.java +++ b/src/java.base/share/classes/java/lang/StackWalker.java @@ -24,6 +24,9 @@ */ package java.lang; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; + import jdk.internal.reflect.CallerSensitive; import java.lang.invoke.MethodType; @@ -89,6 +92,7 @@ * * @since 9 */ +@NullMarked public final class StackWalker { /** * A {@code StackFrame} object represents a method invocation returned by @@ -213,7 +217,7 @@ public default String getDescriptor() { * * @jvms 4.7.10 The {@code SourceFile} Attribute */ - public String getFileName(); + public @Nullable String getFileName(); /** * Returns the line number of the source line containing the execution @@ -528,7 +532,7 @@ private static EnumSet