On Tue, 4 Jan 2022 17:19:44 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:
> Currently, when javac encounters a javadoc reference, like `@see > PrintStream#println(int)`, will first try to find a method `println` in > `PrintStream` using subtyping on the argument types, which may find another > overload of the method with an argument that is a subtype of `int` - like > `println(double)`. Consequently, the link in the javadoc may be to a wrong > method. > > In this patch, the proposal is to use the subtype search only as a backup > option, using the existing check based on `isSameType` first, and only doing > an inexact match using subtyping if the more exact match fails to find a > method. This fallback should help possible existing broken references to > still work as before, while the preferred use of the more exact match should > select the correct method in usual correct cases. > > This patch fixes some instances of incorrect references in the JDK's javadoc, > a diff of the generated javadocs for the JDK mainline is here: > http://cr.openjdk.java.net/~jlahoda/8278373/JDK-8278373.diff This pull request has now been integrated. Changeset: 642ab34a Author: Jan Lahoda <jlah...@openjdk.org> URL: https://git.openjdk.java.net/jdk18/commit/642ab34a60172f4b629f953e146b54b9c7269033 Stats: 89 lines in 2 files changed: 71 ins; 2 del; 16 mod 8278373: JavacTrees.searchMethod finds incorrect match Reviewed-by: vromero, jjg ------------- PR: https://git.openjdk.java.net/jdk18/pull/79