diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 618cf710..7375d310 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -4,6 +4,7 @@ Lombok Changelog ### v1.18.47 "Edgy Guinea Pig" * BUGFIX: `@SneakyThrows` usage on JDK26 no longer results in class files that require `lombok.jar` to be on the runtime classpath (which should not be neccessary). [#4040](https://github.com/projectlombok/lombok/issues/4022). * PROMOTION: `@SuperBuilder` has been promoted to the main package. Otherwise, no changes have been made to the annotation. The old experimental annotation will remain for a few versions, at which point it will be marked as a deprecated annotation. Eventually it'll be removed. If you had `lombok.config` configuration for this annotation, the configuration keys for this feature have been renamed. +* OLD-CRUFT: `lombok.experimental.Wither` and `lombok.Delegate` are deprecated remnants; these features were moved (to respectively `lombok.With` and `lombok.experimental.Delegate` over 5 years ago. They are now removed entirely. If your project is dependent on an older version of lombok which still has those; fret not, lombok still processes these annotations. It just no longer includes them in the jar. ### v1.18.46 (April 22nd, 2026) * PLATFORM: JDK26 support added [#4019](https://github.com/projectlombok/lombok/issues/4019). diff --git a/src/core/lombok/Delegate.java b/src/core/lombok/Delegate.java deleted file mode 100644 index 0c5a4c2c..00000000 --- a/src/core/lombok/Delegate.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2010-2017 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; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * @deprecated Use {@link lombok.experimental.Delegate} instead. - */ -@Target({ElementType.FIELD, ElementType.METHOD}) -@Retention(RetentionPolicy.SOURCE) -@Deprecated -public @interface Delegate { - /** - * Normally the type of the field is used as delegate type. However, to choose a different type to delegate, you can list one (or more) types here. Note that types with - * type arguments can only be done as a field type. A solution for this is to create a private inner interface/class with the appropriate types extended, and possibly - * with all methods you'd like to delegate listed, and then supply that class here. The field does not actually have to implement the type you're delegating; the - * type listed here is used only to determine which delegate methods to generate. - * - * NB: All methods in {@code Object}, as well as {@code canEqual(Object other)} will never be delegated. - * - * @return For each method (not already in {@code java.lang.Object}) in these types, generate a delegate method. - */ - Class>[] types() default {}; - - /** - * Each method in any of the types listed here (include supertypes) will not be delegated. - * - * NB: All methods in {@code Object}, as well as {@code canEqual(Object other)} will never be delegated. - * - * @return For each method (not already in {@code java.lang.Object}) in these types, skip generating a delegate method (overrides {@code types()}). - */ - Class>[] excludes() default {}; -} diff --git a/src/core/lombok/experimental/Wither.java b/src/core/lombok/experimental/Wither.java deleted file mode 100644 index cf20c1eb..00000000 --- a/src/core/lombok/experimental/Wither.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2012-2019 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.experimental; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import lombok.AccessLevel; - -/** - * Put on any field to make lombok build a 'wither' - a withX method which produces a clone of this object (except for 1 field which gets a new value). - *
- * Complete documentation is found at the project lombok features page for @Wither. - *
- * Even though it is not listed, this annotation also has the {@code onParam} and {@code onMethod} parameter. See the full documentation for more details. - *
- * Example: - *
- * private @Wither final int foo; - *- * - * will generate: - * - *
- * public SELF_TYPE withFoo(int foo) {
- * return this.foo == foo ? this : new SELF_TYPE(otherField1, otherField2, foo);
- * }
- *
- *
- * This annotation can also be applied to a class, in which case it'll be as if all non-static fields that don't already have
- * a {@code Wither} annotation have the annotation.
- *
- * @deprecated {@link lombok.With} has been promoted to the main package, so use that one instead.
- */
-@Target({ElementType.FIELD, ElementType.TYPE})
-@Retention(RetentionPolicy.SOURCE)
-public @interface Wither {
- /**
- * If you want your wither to be non-public, you can specify an alternate access level here.
- *
- * @return The method will be generated with this access modifier.
- */
- AccessLevel value() default AccessLevel.PUBLIC;
-
- /**
- * Any annotations listed here are put on the generated method.
- * The syntax for this feature depends on JDK version (nothing we can do about that; it's to work around javac bugs).
- * up to JDK7:
- * {@code @Wither(onMethod=@__({@AnnotationsGoHere}))}
- * from JDK8:
- * {@code @Wither(onMethod_={@AnnotationsGohere})} // note the underscore after {@code onMethod}.
- *
- * @return List of annotations to apply to the generated method.
- */
- AnyAnnotation[] onMethod() default {};
-
- /**
- * Any annotations listed here are put on the generated method's parameter.
- * The syntax for this feature depends on JDK version (nothing we can do about that; it's to work around javac bugs).
- * up to JDK7:
- * {@code @Wither(onParam=@__({@AnnotationsGoHere}))}
- * from JDK8:
- * {@code @Wither(onParam_={@AnnotationsGohere})} // note the underscore after {@code onParam}.
- *
- * @return List of annotations to apply to the generated parameter in the method.
- */
- AnyAnnotation[] onParam() default {};
-
- /**
- * Placeholder annotation to enable the placement of annotations on the generated code.
- * @deprecated Don't use this annotation, ever - Read the documentation.
- */
- @Deprecated
- @Retention(RetentionPolicy.SOURCE)
- @Target({})
- @interface AnyAnnotation {}
-}
diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java
index 4d72eea3..96c22fa2 100644
--- a/src/core/lombok/javac/handlers/HandleDelegate.java
+++ b/src/core/lombok/javac/handlers/HandleDelegate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2021 The Project Lombok Authors.
+ * Copyright (C) 2010-2026 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
@@ -25,7 +25,6 @@ import static com.sun.tools.javac.code.Flags.*;
import static lombok.core.handlers.HandlerUtil.handleExperimentalFlagUsage;
import static lombok.javac.handlers.JavacHandlerUtil.*;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
@@ -109,8 +108,7 @@ public class HandleDelegate extends JavacAnnotationHandler