On Fri, 28 Apr 2023 13:13:57 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:

>> Jim Laskey has updated the pull request with a new target base due to a 
>> merge or a rebase. The pull request now contains 14 commits:
>> 
>>  - Merge branch 'master' into 8306112
>>  - PreviewFeatures.isEnabled()
>>  - Clean up isPreview
>>  - Missing exception
>>  - Corrections
>>  - Update VM.java
>>  - Clean up testing
>>  - Update TestJavacTaskScanner.java
>>  - Merge branch 'master' into 8306112
>>  - Clean up
>>  - ... and 4 more: https://git.openjdk.org/jdk/compare/96cdf93b...53a5321d
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java line 627:
> 
>> 625:         }
>> 626: 
>> 627:         public boolean isAnonymousMainClass() {
> 
> This method seems a bit confusing to me. I believe the fields and methods 
> will be stripped from `defs` if/when the wrapping class is created, which 
> will mean this method will start to return `false`, no? It overall does not 
> seem like a generally useful predicate.
> 
> (If I understand this correctly, if we created the wrapping class in parser 
> neither of these two methods would be needed.)

Inlining

> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java line 640:
> 
>> 638:             // Find anonymous main class.
>> 639:             for (JCTree def : defs) {
>> 640:                 if (def.hasTag(CLASSDEF)) {
> 
> Nit, in cases like this, we lately tend to write `def instanceof JCClassDecl 
> cls`, although we understand this way to check the AST is only safe inside 
> javac.

Changing

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1180491264
PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1180491108

Reply via email to