Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ jobs:
- eclipse-202006-jdk8
- eclipse-202403
- eclipse-202503
- eclipse-202509
- eclipse-I-build
- eclipse-oxygen-full
- eclipse-202403-full
- eclipse-202503-full
- eclipse-202509-full
- eclipse-I-build-full
- ecj11
- ecj14
Expand Down
15 changes: 15 additions & 0 deletions buildScripts/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<conf name="eclipse-202006" />
<conf name="eclipse-202403" />
<conf name="eclipse-202503" />
<conf name="eclipse-202509" />

<conf name="mapstruct" />
</configurations>
Expand Down Expand Up @@ -135,6 +136,20 @@
<dependency org="org.osgi" name="org.osgi.service.prefs" rev="1.1.2" conf="eclipse-202503->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.text" rev="3.14.300" conf="eclipse-202503->default" transitive="false" />

<dependency org="org.eclipse.platform" name="org.eclipse.core.runtime" rev="3.34.0" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="org.eclipse.jdt.core" rev="3.43.0" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="org.eclipse.jdt.ui" rev="3.35.100" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="ecj" rev="3.43.0" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.common" rev="3.20.200" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.registry" rev="3.12.500" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.app" rev="1.7.500" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.resources" rev="3.23.0" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.contenttype" rev="3.9.700" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.jobs" rev="3.15.700" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.osgi" rev="3.23.200" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.osgi" name="org.osgi.service.prefs" rev="1.1.2" conf="eclipse-202509->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.text" rev="3.14.400" conf="eclipse-202509->default" transitive="false" />

<!-- integration with other libraries -->
<dependency org="org.mapstruct" name="mapstruct-processor" rev="1.3.1.Final" conf="mapstruct->default" transitive="false" />
</dependencies>
Expand Down
4 changes: 4 additions & 0 deletions buildScripts/setup.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
<fetchdep.eclipse.osgi name="2025-03" version="4.35" />
</target>

<target name="deps.eclipse.202509" depends="deps.rtstubs18, compile.support">
<fetchdep.eclipse.osgi name="2025-09" version="4.37" />
</target>

<target name="deps.eclipse.integration" depends="deps.rtstubs18, compile.support">
<fetchdep.eclipse.osgi name="I-build" version="I-builds" />
</target>
Expand Down
9 changes: 9 additions & 0 deletions buildScripts/tests.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn
<test.eclipse-X version="202503" />
</target>

<target name="test.eclipse-202509" depends="test.compile, test.formatter.compile" description="runs the tests on your default VM, testing the 2025-09 release of eclipse">
<fetchdep.eclipse version="202509" />
<test.eclipse-X version="202509" />
</target>

<target name="test.eclipse-I-build" depends="test.compile, test.formatter.compile, deps.rtstubs18, compile.support" description="runs the tests on your default VM, testing the latest integration build of eclipse">
<fetchdep.eclipse.updatesite name="I-build" version="I-builds" target="lib/" resolveDependencies="false">
<bundles>
Expand Down Expand Up @@ -300,6 +305,10 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn
<test.eclipse-X-full version="2025-03" />
</target>

<target name="test.eclipse-202509-full" depends="test.eclipse.compile, test.formatter.compile, deps.eclipse.202509" description="runs the full eclipse tests on your default VM, testing the 2025-09 release of eclipse">
<test.eclipse-X-full version="2025-09" />
</target>

<target name="test.eclipse-I-build-full" depends="test.eclipse.compile, test.formatter.compile, deps.eclipse.integration" description="runs the full eclipse tests on your default VM, testing the latest integration build of eclipse">
<test.eclipse-X-full version="I-build" />
</target>
Expand Down
1 change: 1 addition & 0 deletions src/core/lombok/eclipse/handlers/HandleLockedUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public static void handle(String annotationValue, Annotation source, EclipseNode
tryStatement.tryBlock = block;
tryStatement.finallyBlock = new Block(0);
tryStatement.finallyBlock.statements = new Statement[] { unLock };
setGeneratedBy(tryStatement, source);

method.statements = new Statement[] { acquireLock, tryStatement };

Expand Down
25 changes: 25 additions & 0 deletions src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public String mapResourceName(int classFileFormatVersion, String resourceName) {
patchASTConverterLiterals(sm);
patchASTNodeSearchUtil(sm);
patchFieldInitializer(sm);
patchFoldingStructure(sm);

patchPostCompileHookEcj(sm);

Expand Down Expand Up @@ -1073,6 +1074,30 @@ private static void patchASTNodeSearchUtil(ScriptManager sm) {
.build());
}

private static void patchFoldingStructure(ScriptManager sm) {
sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.exitEarly()
.target(new MethodTarget("org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$FoldingVisitor", "createFoldingRegionForTryBlock", "void", "org.eclipse.jdt.core.dom.TryStatement"))
.target(new MethodTarget("org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$FoldingVisitor", "createFoldingRegionForFinallyBlock", "void", "org.eclipse.jdt.core.dom.TryStatement"))
.target(new MethodTarget("org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$FoldingVisitor", "createFoldingRegionForStatement", "void", "org.eclipse.jdt.core.dom.ASTNode"))
.target(new MethodTarget("org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$FoldingVisitor", "createFoldingRegion", "void", "org.eclipse.jdt.core.dom.ASTNode", "boolean"))
.decisionMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "isGenerated", "boolean", "org.eclipse.jdt.core.dom.ASTNode"))
.request(StackRequest.PARAM1)
.transplant()
.build());

sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.exitEarly()
.target(new MethodTarget("org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$FoldingVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.TypeDeclaration"))
.target(new MethodTarget("org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$FoldingVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.MethodDeclaration"))
.target(new MethodTarget("org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$FoldingVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.IfStatement"))
.target(new MethodTarget("org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$FoldingVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.IfStatement"))
.decisionMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "isGenerated", "boolean", "org.eclipse.jdt.core.dom.ASTNode"))
.request(StackRequest.PARAM1)
.valueMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "returnFalse", "boolean", "java.lang.Object"))
.transplant()
.build());

}

private static void patchFieldInitializer(ScriptManager sm) {
sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.addField()
.targetClass("org.eclipse.jdt.internal.core.CompilationUnitStructureRequestor")
Expand Down
25 changes: 25 additions & 0 deletions test/eclipse/resource/folding/cleanup/CleanupFolding.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package pkg;

import lombok.Cleanup;

import java.util.List;

public class CleanupFolding {
public void method() {
@Cleanup FileInputStream inStream = new FileInputStream("test");

List<String> a = null;

if (a.isBlank()) {
return;
}

try {

} catch (Exception e) {

} finally {

}
}
}
24 changes: 24 additions & 0 deletions test/eclipse/resource/folding/locked/LockedFolding.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package pkg;

import lombok.Locked;

import java.util.List;

public class LockedFolding {
@Locked
public void method() {
List<String> a = null;

if (a.isBlank()) {
return;
}

try {

} catch (Exception e) {

} finally {

}
}
}
21 changes: 21 additions & 0 deletions test/eclipse/resource/folding/nonNull/NonNullFolding.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package pkg;

import java.util.List;

import lombok.NonNull;

public class NonNullFolding {
public void method(@NonNull List<String> a) {
if (a.isEmpty()) {
return;
}

try {

} catch (Exception e) {

} finally {

}
}
}
24 changes: 24 additions & 0 deletions test/eclipse/resource/folding/synch/SynchronizedFolding.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package pkg;

import lombok.Synchronized;

import java.util.List;

public class LockedFolding {
@Synchronized
public void method() {
List<String> a = null;

if (a.isBlank()) {
return;
}

try {

} catch (Exception e) {

} finally {

}
}
}
5 changes: 3 additions & 2 deletions test/eclipse/src/lombok/eclipse/EclipseTests.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 The Project Lombok Authors.
* Copyright (C) 2022-2025 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -27,6 +27,7 @@

import lombok.eclipse.cleanup.CleanupTest;
import lombok.eclipse.compile.NoErrorsTest;
import lombok.eclipse.edit.FoldingTest;
import lombok.eclipse.edit.SelectTest;
import lombok.eclipse.misc.DelegateTest;
import lombok.eclipse.misc.JavadocTest;
Expand All @@ -37,7 +38,7 @@
import lombok.eclipse.references.FindReferencesTest;

@RunWith(Suite.class)
@SuiteClasses({ExtractInterfaceTest.class, RenameTest.class, SelectTest.class, CleanupTest.class, FindReferencesTest.class, InlineTest.class, NoErrorsTest.class, JavadocTest.class, DelegateTest.class, ExtractVariableTest.class})
@SuiteClasses({ExtractInterfaceTest.class, RenameTest.class, SelectTest.class, CleanupTest.class, FindReferencesTest.class, InlineTest.class, NoErrorsTest.class, JavadocTest.class, DelegateTest.class, ExtractVariableTest.class, FoldingTest.class})
public class EclipseTests {

}
44 changes: 44 additions & 0 deletions test/eclipse/src/lombok/eclipse/TestUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2025 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package lombok.eclipse;

import static org.junit.Assume.assumeTrue;

import org.eclipse.core.runtime.adaptor.EclipseStarter;
import org.osgi.framework.Bundle;

public class TestUtils {
public static void assumeMinJdtVersion(int version) {
Bundle coreBundle = getBundle("org.eclipse.jdt.core");

assumeTrue(coreBundle.getVersion().getMinor() >= version);
}

public static Bundle getBundle(String name) {
for (Bundle bundle : EclipseStarter.getSystemBundleContext().getBundles()) {
if (bundle.getSymbolicName().equals(name)) {
return bundle;
}
}
return null;
}
}
Loading
Loading