Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
- `VersionCatalogStep` preserves standalone comments at section boundaries and the end of the file. ([#3048](https://github.com/diffplug/spotless/issues/3048))
- `VersionCatalogStep` preserves entries when comments contain unmatched brackets, preserves commas inside quoted strings, and keeps significant line boundaries in multiline entries. ([#3042](https://github.com/diffplug/spotless/pull/3042))
- `VersionCatalogStep` now reports unfinished entries as lints at their starting line. These fail formatting by default, so upgrading may expose catalog errors that previously caused silent data loss. ([#3042](https://github.com/diffplug/spotless/pull/3042))
- `FeatureClassLoader` now provides stub implementations of `lombok.*` classes (and synthesises empty classes for any unknown ones) so that the Eclipse JDT formatter step no longer fails with `NoClassDefFoundError` or `NoSuchMethodError` when lombok is active as a JVM agent (e.g. `-javaagent:lombok.jar` in Eclipse/VS Code/Cursor). ([#2795](https://github.com/diffplug/spotless/issues/2795))

## [4.10.2] - 2026-09-04
### Fixed
Expand Down
3 changes: 3 additions & 0 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ dependencies {
"tableTestFormatterCompileOnly"(libs.tabletest.formatter.core)
// zjsonPatch
"zjsonPatchCompileOnly"(libs.zjsonpatch)
// lombokStubs – needs ECJ types to match the exact method descriptors that lombok
// transplants into ECJ's ASTConverter, ASTNode, etc.
"lombokStubsCompileOnly"("org.eclipse.jdt:org.eclipse.jdt.core:3.46.0")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Moving forward, how would you like us to maintain this 3.46.0 version? Should we bump it to latest whenever a new version is released? Should we pin it here until/unless you open a PR that bumps it?

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.

Hi @nedtwigg Thanks for taking a look at this.

So I've looked at the history of the Eclipse code that is imported. It dates from >= 15 years ago (for ASTNode) (and similarly for IMember) , while ASTVisitor was created ~ early 2004 and has had additions (and some tiny removals for String Templates) since then for JDK versions - but as its used a parameter only this shouldn't affect it. So therefore I think this should be pinned and only reconsidered if there is perhaps a CVE or a fix needed.

}

// we'll hold the core lib to a high standard
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lombok.eclipse.agent;

/**
* Stub implementation of {@code lombok.eclipse.agent.EclipseLoaderPatcherTransplants}
* used only within the {@code FeatureClassLoader} isolation boundary.
*/
@SuppressWarnings("unused")
public class EclipseLoaderPatcherTransplants {

/** Stub – returns {@code false} so the normal class-loading path is used. */
public static boolean overrideLoadDecide(ClassLoader classLoader, String name, boolean resolve) {
return false;
}

/** Stub – returns {@code null} so the caller falls through to normal loading. */
public static Class<?> overrideLoadResult(ClassLoader classLoader, String name, boolean resolve) throws ClassNotFoundException {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lombok.eclipse.agent;

/**
* Stub implementation of {@code lombok.eclipse.agent.PatchDelegatePortal}
* used only within the {@code FeatureClassLoader} isolation boundary.
*/
@SuppressWarnings("unused")
public class PatchDelegatePortal {

/** Stub – always returns {@code false}. */
public static boolean handleDelegateForType(Object classScope) {
return false;
}

/** Stub – returns an empty array. */
public static Object[] addGeneratedDelegateMethods(Object returnValue, Object javaElement) {
return new Object[0];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lombok.eclipse.agent;

/**
* Stub implementation of {@code lombok.eclipse.agent.PatchDiagnostics} used
* only within the {@code FeatureClassLoader} isolation boundary.
*
* <p>When lombok is active as a JVM agent it patches ECJ's
* {@code ASTNode.setSourceRange} to call
* {@code PatchDiagnostics.setSourceRangeCheck}. The real class lives in
* lombok's shadow class-loader and is never reachable from
* {@code FeatureClassLoader}. This stub satisfies the call site so that
* source-range setting proceeds without a {@link NoSuchMethodError}.
* Returning {@code false} means "no override" — ECJ proceeds with its
* normal source-range assignment.
*/
@SuppressWarnings("unused")
public class PatchDiagnostics {

/** Stub – always returns {@code false} so ECJ applies its normal source-range logic. */
public static boolean setSourceRangeCheck(Object node, int start, int end) {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lombok.eclipse.agent;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
* Stub implementation of {@code lombok.eclipse.agent.PatchFixesShadowLoaded}
* used only within the {@code FeatureClassLoader} isolation boundary.
* Methods return their input unchanged; post-compiler steps are no-ops.
*/
@SuppressWarnings("unused")
public class PatchFixesShadowLoaded {

/** Stub – returns {@code origReturnValue} unchanged. */
public static String addLombokNotesToEclipseAboutDialog(String origReturnValue, String key) {
return origReturnValue;
}

/** Stub – returns {@code bytes} unchanged. */
public static byte[] runPostCompiler(byte[] bytes, String fileName) {
return bytes;
}

/** Stub – returns {@code out} unchanged. */
public static OutputStream runPostCompiler(OutputStream out) throws IOException {
return out;
}

/** Stub – returns {@code out} unchanged. */
public static BufferedOutputStream runPostCompiler(BufferedOutputStream out, String path, String name) throws IOException {
return out;
}
}
29 changes: 29 additions & 0 deletions lib/src/lombokStubs/java/lombok/eclipse/agent/PatchJavadoc.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lombok.eclipse.agent;

/**
* Stub implementation of {@code lombok.eclipse.agent.PatchJavadoc}
* used only within the {@code FeatureClassLoader} isolation boundary.
*/
@SuppressWarnings("unused")
public class PatchJavadoc {

/** Stub – returns {@code original} unchanged. */
public static String getHTMLContentFromSource(Object instance, String original, Object member) {
return original;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2026 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lombok.eclipse.agent;

/**
* Stub implementation of {@code lombok.eclipse.agent.PatchValEclipsePortal}
* used only within the {@code FeatureClassLoader} isolation boundary.
* All methods are no-ops.
*/
@SuppressWarnings("unused")
public class PatchValEclipsePortal {

public static void copyInitializationOfForEachIterable(Object parser) {}

public static void copyInitializationOfLocalDeclaration(Object parser) {}

public static void addFinalAndValAnnotationToVariableDeclarationStatement(Object converter, Object out, Object in) {}

public static void addFinalAndValAnnotationToSingleVariableDeclaration(Object converter, Object out, Object in) {}
}
Loading
Loading