[jdk19] RFR: JDK-8275784: Bogus warning generated for record with compact constructor [v2]

Jonathan Gibbons jjg at openjdk.org
Mon Jun 27 17:17:40 UTC 2022


On Mon, 27 Jun 2022 17:02:24 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 270:
>> 
>>> 268:     }
>>> 269: 
>>> 270:     private  boolean isCanonicalRecordConstructor(ExecutableElement ee) {
>> 
>> Remove extra whitespace between `private` and `boolean`.
>> 
>> I would expect javax.lang.model to provide this functionality. Unfortunately, I couldn't find it. On the other hand, a very similar method exists in jdk.javadoc.internal.doclets.toolkit.util.Utils. It would be nice if we could avoid any duplication.
>
> I don't see how we can avoid duplication at this time.

It's not actually clear that `java.lang.model` has the info to provide this method, since the compact constructor is a syntactic form, that has disappeared by the time we get to the `ExecutableElement` for the constructor.  Sure, we could provide the method, but it's not clear we can detect the difference between the compact form and the use of explicit parameters.  I guess we could maybe put it on `Trees` if there is enough info on the AST, if it hasn't already been desugared away.

At some level, it comes down to ... do we allow the `@param` tags to be only omitted on the compact constructor (no args provided), or on the canonical constructor where the param names match the component names.

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

PR: https://git.openjdk.org/jdk19/pull/70


More information about the javadoc-dev mailing list