RFR: 8247973: Javadoc incorrect for IdentityArrayList, IdentityLinkedList

Alexey Ivanov aivanov at openjdk.java.net
Fri Dec 3 21:31:17 UTC 2021


On Fri, 3 Dec 2021 07:30:43 GMT, ANUPAM DEV <duke at openjdk.java.net> wrote:

> The documentation for following methods used equals() for object equality:
> 
> sun.awt.util.IdentityLinkedList#contains
> sun.awt.util.IdentityArrayList#contains
> sun.awt.util.IdentityArrayList#indexOf
> sun.awt.util.IdentityArrayList#lastIndexOf
> sun.awt.util.IdentityArrayList#remove(java.lang.Object)
> 
> I have updated the comments to use "==" operator for object equality. Kindly review the changes for the same.

I propose removing changes to `HttpURLConnection.java` from this PR. Both `IdentityArrayList`, `IdentityLinkedList` are in `java.desktop` module but `HttpURLConnection` is in `java.base` module. Submit a new issue to fix spelling errors in `HttpURLConnection.java`.

src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java line 219:

> 217:      * in this list, or -1 if this list does not contain the element.
> 218:      * More formally, returns the lowest index {@code i} such that
> 219:      * {@code get(i)==o},

Shall it have spaces on either side of `==`?
Suggestion:

     * {@code get(i) == o},


I see `IdentityLinkedList.java` doesn't have spaces around `==` in this case. Yet in this case, probably `{@code o == e}` should not have the spaces too.

src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java line 399:

> 397:     }
> 398: 
> 399:      /**

An extra space.

src/java.desktop/share/classes/sun/awt/util/IdentityArrayList.java line 401:

> 399:      /**
> 400:      * Removes the first occurrence of the specified element from this list,
> 401:      * if it is present.  If this list does not contain the element, it is

Suggestion:

     * if it is present.  If this list does not contain the element, the list is

I think it adds clarification to _what_ is unchanged.

-------------

Changes requested by aivanov (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/6694


More information about the net-dev mailing list