Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v31]

2023-11-21 Thread Jim Laskey
> Address changes from JEP 445 to JEP 463.
> 
> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class.
> 
> - Don't mark class on read.
> 
> - Remove reflection and annotation processing related to unnamed classes.
> 
> - Simplify main method search.

Jim Laskey has updated the pull request incrementally with one additional 
commit since the last revision:

  Update Class.java

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/16461/files
  - new: https://git.openjdk.org/jdk/pull/16461/files/b14c6a54..fd0c92f8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=16461&range=30
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16461&range=29-30

  Stats: 34 lines in 1 file changed: 9 ins; 17 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/16461.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16461/head:pull/16461

PR: https://git.openjdk.org/jdk/pull/16461


Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v31]

2023-11-21 Thread Jim Laskey
On Tue, 21 Nov 2023 17:52:49 GMT, Jim Laskey  wrote:

>> Address changes from JEP 445 to JEP 463.
>> 
>> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class.
>> 
>> - Don't mark class on read.
>> 
>> - Remove reflection and annotation processing related to unnamed classes.
>> 
>> - Simplify main method search.
>
> Jim Laskey has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update Class.java

The comments are attached to the modifiers (first thing it encounters.) I’m 
sure the javadoc toolset has a method that gets the comments from the right 
thing.

-

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


Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v31]

2023-11-21 Thread Pavel Rappo
On Tue, 21 Nov 2023 18:51:55 GMT, Jim Laskey  wrote:

> I’m sure the javadoc toolset has a method that gets the comments from the 
> right thing.

That's exactly where those comments disappear from, javadoc. Comments of normal 
class methods and comments of methods of implicitly declared class seem to be 
tree-ified differently. Can these comments become lost during 
copying/reconstruction? I'll try to figure out more.

-

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


Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v31]

2023-11-21 Thread Pavel Rappo
On Tue, 21 Nov 2023 18:59:51 GMT, Pavel Rappo  wrote:

> I'll try to figure out more.

So this method seems to be a proximate-ish cause for that behaviour: 
`JavacParser.topLevelMethodOrFieldDeclaration`. If it gets `null` or comment to 
attach to `JCTree.JCMethodDecl` later depends on the presence of modifiers. 
This is not the case with normal class methods, where the comments are robustly 
attached regardless of whether modifiers are present.

-

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


Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v31]

2023-11-21 Thread Alan Bateman
On Tue, 21 Nov 2023 17:52:49 GMT, Jim Laskey  wrote:

>> Address changes from JEP 445 to JEP 463.
>> 
>> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class.
>> 
>> - Don't mark class on read.
>> 
>> - Remove reflection and annotation processing related to unnamed classes.
>> 
>> - Simplify main method search.
>
> Jim Laskey has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update Class.java

src/java.base/share/classes/java/lang/Class.java line 4823:

> 4821:  * signatures in a class."
> 4822:  * {@link SecurityException SecurityExceptions} can halt
> 4823:  * the search. In this case, a null is returned.

I see the latest update changes this to return null if denied by the SM. This 
seems very inconsistent with the other methods so I'm wondering why this has 
changed?

-

PR Review Comment: https://git.openjdk.org/jdk/pull/16461#discussion_r1401056196


Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v31]

2023-11-21 Thread Jim Laskey
On Tue, 21 Nov 2023 19:16:06 GMT, Alan Bateman  wrote:

>> Jim Laskey has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Update Class.java
>
> src/java.base/share/classes/java/lang/Class.java line 4823:
> 
>> 4821:  * signatures in a class."
>> 4822:  * {@link SecurityException SecurityExceptions} can halt
>> 4823:  * the search. In this case, a null is returned.
> 
> I see the latest update changes this to return null if denied by the SM. This 
> seems very inconsistent with the other methods so I'm wondering why this has 
> changed?

Requested by CSR.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/16461#discussion_r1401089920


Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second Preview) [v31]

2023-11-21 Thread Jonathan Gibbons
On Tue, 21 Nov 2023 18:51:55 GMT, Jim Laskey  wrote:

> The comments are attached to the modifiers (first thing it encounters.) I’m 
> sure the javadoc toolset has a method that gets the comments from the right 
> thing.

In the AST created by the parser, doc comments should be attached to 
_declarations_ (`JCClassDecl`, `JCMethodDecl`, `JCVariableDecl` etc) not 
modifiers.  There is nothing in the javadoc toolset that _gets the comments 
from the right thing_.

-

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