RFR: JDK-8288368: simplify code in ValueTaglet, remove redundant code
Hannes Wallnöfer
hannesw at openjdk.org
Tue Jul 5 09:00:39 UTC 2022
On Tue, 14 Jun 2022 17:46:50 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> Please review an almost trivial cleanup change, to eliminate the call to an ill-considered method in Utils, and then remove the method itself.
>>
>> Verified that there is no significant change in the generated docs as a result off the change. (Just changes in timestamp/version info).
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java line 123:
>
>> 121: return writer.valueTagOutput(field,
>> 122: text,
>> 123: field != holder);
>
> Shouldn't we use this instead (as suggested by `javax.lang.model.element.Element.equals`)?
> Suggestion:
>
> !field.equals(holder));
>
> That said, I still wonder where the original author saw _inaccuracies_ with `equals`. Have you investigated how that comment came to be?
Interestingly, it looks like no implementation of `Element` actually overrides `equals()`, meaning they all inherit the reference based implementation from `java.lang.Object`. I guess this also answers the question why the `elementsEquals` method was necessary at some point in time (methods returning different element instances).
-------------
PR: https://git.openjdk.org/jdk/pull/9149
More information about the javadoc-dev
mailing list