RFR: 8325088: Overloads that differ in type parameters may be lost [v3]

Chen Liang liach at openjdk.org
Thu Apr 4 13:57:10 UTC 2024


On Thu, 4 Apr 2024 11:41:37 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlIds.java line 562:
>> 
>>> 560:                 && e.getKind() != ElementKind.METHOD)
>>> 561:             throw new IllegalArgumentException(String.valueOf(e.getKind()));
>>> 562:         var vmt = configuration.getVisibleMemberTable((TypeElement) e.getEnclosingElement());
>> 
>> Will the vmt differ if we specify `-private`? And say if we have 2 methods like:
>> 
>> private <T extends Runnable> void method(T arg) {}
>> public <T extends Number> void method(T arg) {}
>> 
>> Will the Number public method be consistently erased whether or not `-private` is set?
>
> The answer to your latter question is no. The id that will be assigned to that public method do depend on whether the private overload positioned before it is documented. You cannot do much about it with the current design of `VisibleMemberTable` without unduly complicating this PR. On the bright side, I reckon such a case is extremely rare.

That's actually a sign of relief that the same elements will have the same id with the same input source code

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18519#discussion_r1551738452


More information about the javadoc-dev mailing list