Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate assorted new APIs. #90

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/lang/String.java
Original file line number Diff line number Diff line change
@@ -4480,7 +4480,7 @@ public String translateEscapes() {
*
* @since 12
*/
public <R> R transform(Function<? super String, ? extends R> f) {
public <R extends @Nullable Object> R transform(Function<? super String, ? extends R> f) {
return f.apply(this);
}

@@ -4651,7 +4651,7 @@ public static String format( @Nullable Locale l, String format, @Nullable Objec
* @since 15
*
*/
public String formatted(Object... args) {
public String formatted(@Nullable Object... args) {
return new Formatter().format(this, args).toString();
}

2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/lang/ref/Reference.java
Original file line number Diff line number Diff line change
@@ -376,7 +376,7 @@ public <T> ReferenceQueue<T> newNativeReferenceQueue() {
* @return {@code true} if {@code obj} is the referent of this reference object
* @since 16
*/
public final boolean refersTo(T obj) {
public final boolean refersTo(@Nullable T obj) {
return refersToImpl(obj);
}

Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@ public interface InvocationHandler {
* @jvms 5.4.3 Resolution
*/
@CallerSensitive
public static Object invokeDefault(Object proxy, Method method, Object... args)
public static Object invokeDefault(Object proxy, Method method, @Nullable Object @Nullable ... args)
throws Throwable {
Objects.requireNonNull(proxy);
Objects.requireNonNull(method);
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/nio/charset/Charset.java
Original file line number Diff line number Diff line change
@@ -585,8 +585,8 @@ public static Charset forName(String charsetName) {
*
* @since 18
*/
public static Charset forName(String charsetName,
Charset fallback) {
public static @Nullable Charset forName(String charsetName,
@Nullable Charset fallback) {
try {
Charset cs = lookup(charsetName);
return cs != null ? cs : fallback;