RFR: 8177100: APIs duplicated in JavaDoc
Nizar Benalla
nbenalla at openjdk.org
Thu May 8 16:03:54 UTC 2025
On Thu, 8 May 2025 15:07:15 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Please review this patch to fix a bug where a method can be documented multiple times
>> Consider these 4 classes
>>
>> A (interface)
>> / \
>> / \
>> (abstract class) C B ( interface)
>> \ /
>> \ /
>> D (class)
>>
>>
>> Where `A` declares `testA()`, `C` implements it `public final void testA()`, `B` extends `A` but does *not* override it, `D` extends `C` and implements `B`
>>
>> In the generated javadoc, `testA()` is documented twice.
>>
>> 
>>
>> After the patch, `testA()` is only documented once:
>>
>> 
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java line 691:
>
>> 689: if (inInterface) {
>> 690: List<ExecutableElement> list = overriddenByTable.get(inheritedMethod);
>> 691: if (list != null) {
>
> Can't we change this to `if (list != null && !list.isEmpty) return false;`?
>
> Comments can be to update the overall block comment to indicate that there is no contention - when a method overrides multiple superinterfaces' methods, including when it is final from superclasses, the superclass method always prevails due to method resolution rules in Java. All interface methods have low resolution priority.
I think this simplification works just fine.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25123#discussion_r2080018316
More information about the javadoc-dev
mailing list