Skip to content

Performance degradation with lombok#4713

Open
snjeza wants to merge 1 commit intoeclipse-jdt:masterfrom
snjeza:issue-4712
Open

Performance degradation with lombok#4713
snjeza wants to merge 1 commit intoeclipse-jdt:masterfrom
snjeza:issue-4712

Conversation

@snjeza
Copy link
Copy Markdown
Contributor

@snjeza snjeza commented Dec 23, 2025

Fixes #4712

@iloveeclipse
Copy link
Copy Markdown
Member

Could you please provide a regression test?

@snjeza
Copy link
Copy Markdown
Contributor Author

snjeza commented Dec 23, 2025

Could you please provide a regression test?

Can I start tests with the -javaagent VM argument?

@iloveeclipse
Copy link
Copy Markdown
Member

Can I start tests with the -javaagent VM argument?

Should be possible to start JVM from the test with extra arguments, the tests itself don't have individual configurations AFAIK.

@snjeza
Copy link
Copy Markdown
Contributor Author

snjeza commented Dec 23, 2025

@iloveeclipse I will try to create a test.

@snjeza
Copy link
Copy Markdown
Contributor Author

snjeza commented Dec 30, 2025

Could you please provide a regression test?

@iloveeclipse I have added ASTConverter18Test.testIssue4712()

@eclipse-jdt-bot
Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF
org.eclipse.jdt.core.compiler.batch/pom.xml
org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
org.eclipse.jdt.core.tests.model/pom.xml
org.eclipse.jdt.core/META-INF/MANIFEST.MF
org.eclipse.jdt.core/pom.xml

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From b1db6ac2c7ef67b78cafc5c6c22dfdefd0f9e153 Mon Sep 17 00:00:00 2001
From: Eclipse JDT Bot <jdt-bot@eclipse.org>
Date: Sat, 28 Feb 2026 00:14:25 +0000
Subject: [PATCH] Version bump(s) for 4.40 stream


diff --git a/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF
index 915d7eef49..f1e166fde4 100644
--- a/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Main-Class: org.eclipse.jdt.internal.compiler.batch.Main
 Bundle-ManifestVersion: 2
 Bundle-Name: Eclipse Compiler for Java(TM)
 Bundle-SymbolicName: org.eclipse.jdt.core.compiler.batch
-Bundle-Version: 3.45.0.qualifier
+Bundle-Version: 3.45.100.qualifier
 Bundle-ClassPath: .
 Bundle-Vendor: Eclipse.org
 Automatic-Module-Name: org.eclipse.jdt.core.compiler.batch
diff --git a/org.eclipse.jdt.core.compiler.batch/pom.xml b/org.eclipse.jdt.core.compiler.batch/pom.xml
index ce59619b2e..f0801f9261 100644
--- a/org.eclipse.jdt.core.compiler.batch/pom.xml
+++ b/org.eclipse.jdt.core.compiler.batch/pom.xml
@@ -17,7 +17,7 @@
     <version>4.40.0-SNAPSHOT</version>
   </parent>
   <artifactId>org.eclipse.jdt.core.compiler.batch</artifactId>
-  <version>3.45.0-SNAPSHOT</version>
+  <version>3.45.100-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <properties>
diff --git a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
index aa5c6b00cf..b7e54e66b3 100644
--- a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.core.tests.model;singleton:=true
-Bundle-Version: 3.13.700.qualifier
+Bundle-Version: 3.13.800.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Export-Package: org.eclipse.jdt.core.tests,
diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml
index 543b2b5542..9a5f15b809 100644
--- a/org.eclipse.jdt.core.tests.model/pom.xml
+++ b/org.eclipse.jdt.core.tests.model/pom.xml
@@ -19,7 +19,7 @@
     <relativePath>../tests-pom/</relativePath>
   </parent>
   <artifactId>org.eclipse.jdt.core.tests.model</artifactId>
-  <version>3.13.700-SNAPSHOT</version>
+  <version>3.13.800-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 
   <properties>
diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
index 349cfc604c..a2de32def2 100644
--- a/org.eclipse.jdt.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
-Bundle-Version: 3.45.0.qualifier
+Bundle-Version: 3.45.100.qualifier
 Bundle-Activator: org.eclipse.jdt.core.JavaCore
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml
index d3e8348cb1..49fe6a292a 100644
--- a/org.eclipse.jdt.core/pom.xml
+++ b/org.eclipse.jdt.core/pom.xml
@@ -17,7 +17,7 @@
     <version>4.40.0-SNAPSHOT</version>
   </parent>
   <artifactId>org.eclipse.jdt.core</artifactId>
-  <version>3.45.0-SNAPSHOT</version>
+  <version>3.45.100-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <properties>
-- 
2.53.0

Further information are available in Common Build Issues - Missing version increments.

@iloveeclipse
Copy link
Copy Markdown
Member

I've just rebased on master

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Addresses Eclipse JDT issue #4712 (“Performance degradation with lombok”) by avoiding expensive comment-mapping/scanning work when the AST contains synthetic/generated nodes with invalid/empty source ranges, and by tightening comment-mapper initialization.

Changes:

  • Skip visiting/comment-mapping for generated AST nodes (and generated siblings) in DefaultCommentMapper.
  • Avoid initializing DefaultCommentMapper when the compilation unit has no comments.
  • Add a regression test covering the reported scenario and harden the scanner against negative positions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java Skips generated nodes/siblings during comment mapping to prevent pathological scanning behavior.
org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java Only initializes the comment mapper when there are actual comments to map.
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java Adds a regression test for issue #4712 (currently includes a time-based assertion).
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Scanner.java Guards scanning against negative currentPosition after an IndexOutOfBoundsException.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5594 to +5595
// The convertCompilationUnit method would need to take less than one second to complete.
assertTrue((System.currentTimeMillis() - start) < 1000);
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test asserts a hard 1s wall-clock limit for AST.convertCompilationUnit(), which is likely to be flaky on slower/loaded CI agents and can cause unrelated failures. Consider replacing the time-based assertion with a deterministic functional assertion (e.g., verify comment mapping behavior for generated nodes) or moving this into the existing performance test infrastructure / using a much more resilient threshold with clear skip/assumption rules for slow environments.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AST.convertCompilationUnit() takes less than 20 ms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance degradation with lombok

4 participants