Skip to content

8326951: since-checker - missing @ since tags #18055

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

Closed
Closed
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions src/java.base/share/classes/java/io/PrintStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,6 @@ private void implWrite(byte[] buf, int off, int len) throws IOException {
*
* @see #writeBytes(byte[])
* @see #write(byte[],int,int)
*
* @since 14
Copy link
Member

@jaikiran jaikiran Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @since 14 was added here as part of https://bugs.openjdk.org/browse/JDK-8187898. The CSR explains what the changes were https://bugs.openjdk.org/browse/JDK-8230625. As noted in that CSR's specification (and attached images), the change for this method in that issue ended up being just API clarification (through a @apiNote) and no other change to this specific method. It continued to have the same signature including the throws clause that was previously available on this class through the super FilterOutputStream#write(byte[]) method.

So removing this @since 14 looks correct to me.

*/
@Override
public void write(byte[] buf) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -7919,6 +7919,8 @@ private static void tryFinallyChecks(MethodHandle target, MethodHandle cleanup)
* handles is not {@code int}, or if the types of
* the fallback handle and all of target handles are
* not the same.
*
* @since 17
*/
public static MethodHandle tableSwitch(MethodHandle fallback, MethodHandle... targets) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was introduced in Java 17 through https://bugs.openjdk.org/browse/JDK-8263087. So this addition of @since 17 looks fine to me.

Objects.requireNonNull(fallback);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -50,6 +50,8 @@ public MalformedParameterizedTypeException() {
* Constructs a {@code MalformedParameterizedTypeException} with
* the given detail message.
* @param message the detail message; may be {@code null}
*
* @since 10
*/
public MalformedParameterizedTypeException(String message) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both this and the explicit no-arg constructor were introduced in this class through https://bugs.openjdk.org/browse/JDK-8183175 in Java 10. Since an (implicit) no-arg constructor was always available even before that change, it makes sense to add a @since 10 to only this explicit constructor. This change looks good.

super(message);
Expand Down
8 changes: 8 additions & 0 deletions src/java.base/share/classes/java/nio/MappedByteBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ public final MappedByteBuffer rewind() {
* {@code force()} on the returned buffer, will only act on the sub-range
* of this buffer that the returned buffer represents, namely
* {@code [position(),limit())}.
*
* @since 17
*/
@Override
public abstract MappedByteBuffer slice();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other 3 methods on which this @since 17 is being added here were introduced in Java 17, through https://bugs.openjdk.org/browse/JDK-4833719. Before that change, these methods would have been available on this MappedByteBuffer through the super ByteBuffer class and those methods have been specified to return a ByteBuffer. After that change in JDK-4833719, these methods now return a MappedByteBuffer which is an observable change. So adding @since 17 to these methods looks correct to me.

Expand All @@ -410,19 +412,25 @@ public final MappedByteBuffer rewind() {
* of this buffer that the returned buffer represents, namely
* {@code [index,index+length)}, where {@code index} and {@code length} are
* assumed to satisfy the preconditions.
*
* @since 17
*/
@Override
public abstract MappedByteBuffer slice(int index, int length);

/**
* {@inheritDoc}
*
* @since 17
*/
@Override
public abstract MappedByteBuffer duplicate();

/**
* {@inheritDoc}
* @throws ReadOnlyBufferException {@inheritDoc}
*
* @since 17
*/
@Override
public abstract MappedByteBuffer compact();
Expand Down
3 changes: 2 additions & 1 deletion src/java.base/share/classes/java/util/Properties.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -185,6 +185,7 @@ public Properties() {
* accommodate this many elements
* @throws IllegalArgumentException if the initial capacity is less than
* zero.
* @since 10
*/
public Properties(int initialCapacity) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constructor was introduced in Java 10 through https://bugs.openjdk.org/browse/JDK-8189319, so adding @since 10 here looks correct to me.

this(null, initialCapacity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ public float nextFloat() {
* {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
* @implNote {@inheritDoc}
*
* @since 17
*/
@Override
public float nextFloat(float bound) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 nextFloat(...) methods which take parameters were introduced in Java 17 https://bugs.openjdk.org/browse/JDK-8248862, whereas the no-arg nextFloat() method existed prior to that. So adding @since 17 to these 2 methods looks correct to me.

Expand All @@ -516,6 +518,8 @@ public float nextFloat(float bound) {
* {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
* @implNote {@inheritDoc}
*
* @since 17
*/
@Override
public float nextFloat(float origin, float bound) {
Expand Down
2 changes: 2 additions & 0 deletions src/java.base/share/classes/java/util/zip/Deflater.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ public void setDictionary(byte[] dictionary) {
* @param dictionary the dictionary data bytes
* @see Inflater#inflate
* @see Inflater#getAdler()
*
* @since 11
*/
public void setDictionary(ByteBuffer dictionary) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was introduced in Java 11 through https://bugs.openjdk.org/browse/JDK-6341887. It appears to be an oversight that a @since 11 wasn't added to this method in that change, because other new methods introduced in that change did come with a @since 11. So this addition of @since 11 now looks fine to me.

synchronized (zsRef) {
Expand Down