[lworld] RFR: 8368497: [lworld] redo: New lint category `initialization` for code that would not be allowed in the prologue [v2]

Chen Liang liach at openjdk.org
Wed Oct 1 20:53:57 UTC 2025


On Wed, 1 Oct 2025 20:20:46 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> redoing JDK-8367698 as the original fix had to be delta applied due to some test failures
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
> 
>   do not generate proxy variables for warned code

src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java line 190:

> 188:      */
> 189:     public static boolean isExplicitThisReference(Types types, Type.ClassType currentClass, JCTree tree) {
> 190:         Symbol.ClassSymbol currentClassSym = (Symbol.ClassSymbol)(types.erasure(currentClass)).tsym;

Suggestion:

        Symbol.ClassSymbol currentClassSym = (Symbol.ClassSymbol) types.erasure(currentClass).tsym;

src/jdk.compiler/share/classes/module-info.java line 170:

> 168:  * <tr><th scope="row">{@code incubating}           <td>use of incubating modules
> 169:  * <tr><th scope="row">{@code initialization}       <td>code in identity classes that wouldn't be allowed in early
> 170:  *                                                      construction due to a this dependency.

Suggestion:

 *                                                      construction due to a {@code this} dependency.

test/langtools/tools/javac/SuperInit/EarlyAssignments.java line 14:

> 12:  *          jdk.compiler/com.sun.tools.javac.main
> 13:  *          jdk.compiler/com.sun.tools.javac.tree
> 14:  *          jdk.compiler/com.sun.tools.javac.util

Can we put all these `@modules` into TEST.properties like this: https://github.com/openjdk/jdk/blob/db6320df980ebe7cf2a1c727970cc937ab549b97/test/jdk/jdk/classfile/TEST.properties#L2-L5

test/langtools/tools/javac/SuperInit/InitializationWarningTester.java line 143:

> 141:                 javaFile = p;
> 142:             } else if (p.toString().endsWith("out")) {
> 143:                 goldenFile = p;

Can we just do `baseDir.resolve(className + ".java")`, and do a `Files.exists` check for the golden file, instead of having complicated stuf like this?

test/lib/jdk/test/lib/NetworkConfiguration.java line 1:

> 1: /*

We should probably ignore initialization warnings for test libs at: https://github.com/openjdk/valhalla/blob/2bc50b323a5c57f5d55094196729f54b7dd98302/make/test/BuildTestLib.gmk#L65

test/micro/org/openjdk/bench/java/lang/StringEquals.java line 1:

> 1: /*

Instead of patching individual microbenchmarks, we should just include `initialization` here: https://github.com/openjdk/valhalla/blob/2bc50b323a5c57f5d55094196729f54b7dd98302/make/test/BuildMicrobenchmark.gmk#L86-L87

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1650#discussion_r2395836363
PR Review Comment: https://git.openjdk.org/valhalla/pull/1650#discussion_r2395837388
PR Review Comment: https://git.openjdk.org/valhalla/pull/1650#discussion_r2395858768
PR Review Comment: https://git.openjdk.org/valhalla/pull/1650#discussion_r2395863655
PR Review Comment: https://git.openjdk.org/valhalla/pull/1650#discussion_r2395871784
PR Review Comment: https://git.openjdk.org/valhalla/pull/1650#discussion_r2395869754


More information about the valhalla-dev mailing list