RFR: 8281376: Consider polymorphic methods when looking for overrides

Pavel Rappo prappo at openjdk.java.net
Thu Feb 10 16:08:04 UTC 2022


On Thu, 10 Feb 2022 15:41:51 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

> When looking for an overridden method, javadoc treated generic method candidates differently from those nongeneric.
> 
> - The new tests fail without the fix and pass with the fix.
> - JDK API Documentation built before and after are identical.

(Sorry, submitted the PR too early. The rest of the description is below.)

A method can be represented by `com.sun.tools.javac.code.Symbol`. While a symbol that corresponds to a nongeneric method has a tag `Type.METHOD` (`symbol.type.hasTag(TypeTag.METHOD)`), a symbol that corresponds to a generic method has a tag `Type.FOR_ALL`.

Instead of modifying the check to account for generic methods, I removed it altogether. My rationale was as follows. Before checking the tag of the symbol (`sym2`), the code ensures that both conditions are true:

 1. `sym instanceof MethodSymbol`
 2. `sym.overrides(sym2, ...)`

Given that, `sym2` cannot be anything but a method.

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

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


More information about the javadoc-dev mailing list