On Tue, 21 Nov 2023 12:58:42 GMT, Jim Laskey <jlas...@openjdk.org> wrote:

>> @JimLaskey, in my experiments for JDK-8308715 (Create a mechanism for 
>> Implicitly Declared Class javadoc), I found that 
>> `javax.lang.model.util.Elements.getOrigin` reports `Origin.EXPLICIT` for the 
>> implicitly declared class and `Origin.MANDATED` for that class' constructor. 
>> Shouldn't they both be `Origin.MANDATED` because the elements are created 
>> from source, not class files, which have some limitations on `ACC_MANDATED`?
>
> @pavelrappo Classes can’t be MANDATED. Looking at the code I see that 
> EXPLICIT is the default return value when no other conditions apply.

@JimLaskey, I note that something weird is happening in relation to comments on 
method declarations. Comments on field declarations might be affected too, but 
I haven't checked.

Comments on method declarations are correctly captured only if those 
declarations are minimal. That is, if they consist of a result, name, and 
parameters. Whenever modifiers like public, protected, private, static, or 
final appear, the comments disappear.

Briefly looking at `com.sun.tools.javac.parser.JavacParser` code (which I have 
no clue what is doing), I assume the comments are getting misattributed to some 
other tokens.

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

PR Comment: https://git.openjdk.org/jdk/pull/16461#issuecomment-1821458574

Reply via email to