8330954: since-checker - Fix remaining @ since tags in java.base

Reviewed-by: liach, naoto
This commit is contained in:
Nizar Benalla 2024-07-04 15:44:57 +00:00 committed by Chen Liang
parent 3050ba0176
commit f4fa35e28b
12 changed files with 69 additions and 4 deletions

View file

@ -371,6 +371,9 @@ public class FileInputStream extends InputStream
return (capacity == nread) ? buf : Arrays.copyOf(buf, nread); return (capacity == nread) ? buf : Arrays.copyOf(buf, nread);
} }
/**
* @since 11
*/
@Override @Override
public byte[] readNBytes(int len) throws IOException { public byte[] readNBytes(int len) throws IOException {
if (len < 0) if (len < 0)

View file

@ -41,7 +41,11 @@ public sealed interface ClassSignature
/** {@return the type parameters of this class} */ /** {@return the type parameters of this class} */
List<Signature.TypeParam> typeParameters(); List<Signature.TypeParam> typeParameters();
/** {@return the instantiation of the superclass in this signature} */ /**
* {@return the instantiation of the superclass in this signature}
*
* @since 23
*/
Signature.ClassTypeSig superclassSignature(); Signature.ClassTypeSig superclassSignature();
/** {@return the instantiation of the interfaces in this signature} */ /** {@return the instantiation of the interfaces in this signature} */

View file

@ -374,6 +374,9 @@ public sealed interface ClassDesc
*/ */
String descriptorString(); String descriptorString();
/**
* @since 21
*/
@Override @Override
Class<?> resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException; Class<?> resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException;

View file

@ -207,6 +207,9 @@ public sealed interface MethodHandleDesc
*/ */
MethodTypeDesc invocationType(); MethodTypeDesc invocationType();
/**
* @since 21
*/
@Override @Override
MethodHandle resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException; MethodHandle resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException;

View file

@ -222,6 +222,8 @@ public sealed interface MethodTypeDesc
* @apiNote {@linkplain MethodTypeDesc} can represent method type descriptors * @apiNote {@linkplain MethodTypeDesc} can represent method type descriptors
* that are not representable by {@linkplain MethodType}, such as methods with * that are not representable by {@linkplain MethodType}, such as methods with
* more than 255 parameter slots, so attempts to resolve these may result in errors. * more than 255 parameter slots, so attempts to resolve these may result in errors.
*
* @since 21
*/ */
@Override @Override
MethodType resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException; MethodType resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException;

View file

@ -618,6 +618,8 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
* // Take action (e.g. throw an Exception) * // Take action (e.g. throw an Exception)
* } * }
* } * }
*
* @since 23
*/ */
long maxByteAlignment(); long maxByteAlignment();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -521,8 +521,6 @@ public abstract sealed class Reference<T>
* *
* @return never returns normally * @return never returns normally
* @throws CloneNotSupportedException always * @throws CloneNotSupportedException always
*
* @since 11
*/ */
@Override @Override
protected Object clone() throws CloneNotSupportedException { protected Object clone() throws CloneNotSupportedException {

View file

@ -586,12 +586,18 @@ public class ChoiceFormat extends NumberFormat {
return Double.valueOf(bestNumber); return Double.valueOf(bestNumber);
} }
/**
* @since 23
*/
@Override @Override
public boolean isStrict() { public boolean isStrict() {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(
"ChoiceFormat does not utilize leniency when parsing"); "ChoiceFormat does not utilize leniency when parsing");
} }
/**
* @since 23
*/
@Override @Override
public void setStrict(boolean strict) { public void setStrict(boolean strict) {
throw new UnsupportedOperationException( throw new UnsupportedOperationException(

View file

@ -2178,6 +2178,9 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
return ((r = result) == null) ? valueIfAbsent : (T) reportJoin(r, "getNow"); return ((r = result) == null) ? valueIfAbsent : (T) reportJoin(r, "getNow");
} }
/**
* @since 19
*/
@Override @Override
public T resultNow() { public T resultNow() {
Object r = result; Object r = result;
@ -2193,6 +2196,9 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
throw new IllegalStateException(); throw new IllegalStateException();
} }
/**
* @since 19
*/
@Override @Override
public Throwable exceptionNow() { public Throwable exceptionNow() {
Object r = result; Object r = result;
@ -2440,26 +2446,41 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
return uniExceptionallyStage(null, fn); return uniExceptionallyStage(null, fn);
} }
/**
* @since 12
*/
public CompletableFuture<T> exceptionallyAsync( public CompletableFuture<T> exceptionallyAsync(
Function<Throwable, ? extends T> fn) { Function<Throwable, ? extends T> fn) {
return uniExceptionallyStage(defaultExecutor(), fn); return uniExceptionallyStage(defaultExecutor(), fn);
} }
/**
* @since 12
*/
public CompletableFuture<T> exceptionallyAsync( public CompletableFuture<T> exceptionallyAsync(
Function<Throwable, ? extends T> fn, Executor executor) { Function<Throwable, ? extends T> fn, Executor executor) {
return uniExceptionallyStage(screenExecutor(executor), fn); return uniExceptionallyStage(screenExecutor(executor), fn);
} }
/**
* @since 12
*/
public CompletableFuture<T> exceptionallyCompose( public CompletableFuture<T> exceptionallyCompose(
Function<Throwable, ? extends CompletionStage<T>> fn) { Function<Throwable, ? extends CompletionStage<T>> fn) {
return uniComposeExceptionallyStage(null, fn); return uniComposeExceptionallyStage(null, fn);
} }
/**
* @since 12
*/
public CompletableFuture<T> exceptionallyComposeAsync( public CompletableFuture<T> exceptionallyComposeAsync(
Function<Throwable, ? extends CompletionStage<T>> fn) { Function<Throwable, ? extends CompletionStage<T>> fn) {
return uniComposeExceptionallyStage(defaultExecutor(), fn); return uniComposeExceptionallyStage(defaultExecutor(), fn);
} }
/**
* @since 12
*/
public CompletableFuture<T> exceptionallyComposeAsync( public CompletableFuture<T> exceptionallyComposeAsync(
Function<Throwable, ? extends CompletionStage<T>> fn, Function<Throwable, ? extends CompletionStage<T>> fn,
Executor executor) { Executor executor) {
@ -2585,6 +2606,9 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
return ((r = result) instanceof AltResult) && r != NIL; return ((r = result) instanceof AltResult) && r != NIL;
} }
/**
* @since 19
*/
@Override @Override
public State state() { public State state() {
Object r = result; Object r = result;

View file

@ -327,6 +327,8 @@ public class DelayQueue<E extends Delayed> extends AbstractQueue<E>
* @return the <em>expired head</em> of this queue * @return the <em>expired head</em> of this queue
* @throws NoSuchElementException if this queue has no elements with an * @throws NoSuchElementException if this queue has no elements with an
* expired delay * expired delay
*
* @since 21
*/ */
public E remove() { public E remove() {
return super.remove(); return super.remove();

View file

@ -887,6 +887,9 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
return (status & (DONE | ABNORMAL)) == DONE; return (status & (DONE | ABNORMAL)) == DONE;
} }
/**
* @since 19
*/
@Override @Override
public State state() { public State state() {
int s = status; int s = status;
@ -896,6 +899,9 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
State.CANCELLED; State.CANCELLED;
} }
/**
* @since 19
*/
@Override @Override
public V resultNow() { public V resultNow() {
int s = status; int s = status;
@ -910,6 +916,9 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
return getRawResult(); return getRawResult();
} }
/**
* @since 19
*/
@Override @Override
public Throwable exceptionNow() { public Throwable exceptionNow() {
Throwable ex; Throwable ex;

View file

@ -205,6 +205,9 @@ public class FutureTask<V> implements RunnableFuture<V> {
return report(s); return report(s);
} }
/**
* @since 19
*/
@Override @Override
public V resultNow() { public V resultNow() {
switch (state()) { // Future.State switch (state()) { // Future.State
@ -221,6 +224,9 @@ public class FutureTask<V> implements RunnableFuture<V> {
} }
} }
/**
* @since 19
*/
@Override @Override
public Throwable exceptionNow() { public Throwable exceptionNow() {
switch (state()) { // Future.State switch (state()) { // Future.State
@ -236,6 +242,9 @@ public class FutureTask<V> implements RunnableFuture<V> {
} }
} }
/**
* @since 19
*/
@Override @Override
public State state() { public State state() {
int s = state; int s = state;