From 8f47457e2ecdd91b3dfa62a0f55ce9b847a1e393 Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Mon, 7 Oct 2024 10:54:33 -0400 Subject: [PATCH] Random `@Nullable` annotations: `Thread` and `AbstractPreferences`. (#60) --- src/java.base/share/classes/java/lang/Thread.java | 8 ++++---- .../classes/java/util/prefs/AbstractPreferences.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index 414d0ce7bae..73d96cd5cfe 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -1158,7 +1158,7 @@ public Thread() { * * @see Inheritance when creating threads */ - public Thread(Runnable task) { + public Thread(@Nullable Runnable task) { this(null, null, 0, task, 0, null); } @@ -1268,7 +1268,7 @@ public Thread(@Nullable ThreadGroup group, String name) { * * @see Inheritance when creating threads */ - public Thread(Runnable task, String name) { + public Thread(@Nullable Runnable task, String name) { this(null, checkName(name), 0, task, 0, null); } @@ -1322,7 +1322,7 @@ public Thread(Runnable task, String name) { * * @see Inheritance when creating threads */ - public Thread(@Nullable ThreadGroup group, Runnable task, String name) { + public Thread(@Nullable ThreadGroup group, @Nullable Runnable task, String name) { this(group, checkName(name), 0, task, 0, null); } @@ -1469,7 +1469,7 @@ public Thread(@Nullable ThreadGroup group, @Nullable Runnable task, String name, * @since 9 * @see Inheritance when creating threads */ - public Thread(ThreadGroup group, Runnable task, String name, + public Thread(@Nullable ThreadGroup group, @Nullable Runnable task, String name, long stackSize, boolean inheritInheritableThreadLocals) { this(group, checkName(name), (inheritInheritableThreadLocals ? 0 : NO_INHERIT_THREAD_LOCALS), diff --git a/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java b/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java index 459432b84f5..10ec45a78c1 100644 --- a/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java +++ b/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java @@ -200,7 +200,7 @@ public abstract class AbstractPreferences extends Preferences { * ({@code '/'}), or {@code parent} is {@code null} and * name isn't {@code ""}. */ - protected AbstractPreferences(AbstractPreferences parent, String name) { + protected AbstractPreferences(@Nullable AbstractPreferences parent, String name) { if (parent==null) { if (!name.isEmpty()) throw new IllegalArgumentException("Root name '"+name+