RFR: 8369039: JDK-8348611 caused regression in Javac-Hot-Generate [v3]

Archie Cobbs acobbs at openjdk.org
Thu Oct 9 01:35:15 UTC 2025


On Wed, 8 Oct 2025 23:33:48 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> So just to understand this a bit better I instrumented to see how common that condition is and it seems that when `tree.getTag() == Tree.PACKAGEDEF` then `tree.annotations` is never empty. At least in this benchmark. Perhaps the case when there are no annotations are skipped earlier?

Really? I'm not seeing that. When I apply this patch, I see `size=0` unless there's actually an annotation there:

--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintMapper.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintMapper.java
@@ -179,6 +179,7 @@ private static class FileInfo {
         FileInfo(Lint rootLint, JCCompilationUnit tree) {
             rootRange = new LintRange(rootLint);
             for (JCTree decl : tree.defs) {
+if (decl instanceof JCPackageDecl p) System.out.println("package "+p.pid+": annotations.size="+p.annotations.size());
                 if (isTopLevelDecl(decl))
                     unmappedDecls.add(new Span(decl, tree.endPositions));
             }
         }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27651#discussion_r2415348184


More information about the compiler-dev mailing list