Skip to content

Commit

Permalink
Annotate assorted new APIs. (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpovirk authored Oct 7, 2024
1 parent dc252a2 commit 5142764
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
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
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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();
}

Expand Down
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
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
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
Expand Up @@ -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;
Expand Down

0 comments on commit 5142764

Please sign in to comment.