From 4996428ea12be7e381d76614e34a15ad1cc6d275 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Thu, 8 May 2014 06:25:38 +0200 Subject: @Delegate has moved to lombok.experimental. Some work on the aliasing system to make that go smoothly. --- website/features/Delegate.html | 82 --------------------- website/features/Log.html | 2 +- website/features/experimental/Delegate.html | 93 ++++++++++++++++++++++++ website/features/experimental/FieldDefaults.html | 2 +- website/features/experimental/Wither.html | 2 +- website/features/experimental/index.html | 2 + website/features/index.html | 2 - 7 files changed, 98 insertions(+), 87 deletions(-) delete mode 100644 website/features/Delegate.html create mode 100644 website/features/experimental/Delegate.html (limited to 'website/features') diff --git a/website/features/Delegate.html b/website/features/Delegate.html deleted file mode 100644 index 02cdf290..00000000 --- a/website/features/Delegate.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - @Delegate -
-
-
- -

@Delegate

- -
-

Overview

-

- NEW IN Lombok 0.10: Any field or no-argument method can be annotated with @Delegate to let lombok generate delegate methods - that forward the call to this field (or the result of invoking this method). -

-

- Lombok delegates all public methods of the field's type (or method's return type), as well as those of its supertype except for all - methods declared in java.lang.Object. -

-

- You can pass any number of classes into the @Delegate annotation's types parameter. - If you do that, then lombok will delegate all public methods in those types (and their supertypes, except - java.lang.Object) instead of looking at the field/method's type. -

-

- All public non-Object methods that are part of the calculated type(s) are - copied, whether or not you also wrote implementations for those methods. That would thus result in duplicate method errors. You can avoid these - by using the @Delegate(excludes=SomeType.class) parameter to exclude all public methods in the excluded type(s), and their supertypes. -

-

- To have very precise control over what is delegated and what isn't, write private inner interfaces with method signatures, then specify these - private inner interfaces as types in @Delegate(types=PrivateInnerInterfaceWithIncludesList.class, excludes=SameForExcludes.class). -

-
-
-
-

With Lombok

-
@HTML_PRE@
-
-
-
-

Vanilla Java

-
@HTML_POST@
-
-
-
-
-

Small print

-

- When passing classes to the annotation's types or excludes parameter, you cannot include generics. - This is a limitation of java. Use private inner interfaces or classes that extend the intended type including the - generics parameter to work around this problem. -

- When passing classes to the annotation, these classes do not need to be supertypes of the field. See the example. -

- @Delegate cannot be used on static fields or methods. -

-
-
- -
-
-
- - - diff --git a/website/features/Log.html b/website/features/Log.html index bc9e017e..f47835c1 100644 --- a/website/features/Log.html +++ b/website/features/Log.html @@ -59,7 +59,7 @@
diff --git a/website/features/experimental/Delegate.html b/website/features/experimental/Delegate.html new file mode 100644 index 00000000..6f745f31 --- /dev/null +++ b/website/features/experimental/Delegate.html @@ -0,0 +1,93 @@ + + + + + + + + @Delegate +
+
+
+ +

@Delegate

+ +
+

Since

+

+ @Delegate was introduced as feature in lombok v0.10. It was moved to the experimental package in lombok v1.14; the old version from the main lombok package is now deprecated. +

+
+
+

Experimental

+

+ Experimental because: +

    +
  • Not used that much
  • +
  • Difficult to support for edge cases, such as recursive delegation.
  • +
  • API is rather unfriendly; it would be a lot nicer if you can simply implement some methods and let @Delegate generate delegates for whatever you didn't manually implement, but due to issues with generics erasure this also can't be made to work without caveats. +
+ Current status: negative - Currently we feel this feature will not move out of experimental status anytime soon, and support for this feature may be dropped if future versions of javac or ecj make it difficult to continue to maintain the feature. +
+
+

Overview

+

+ Any field or no-argument method can be annotated with @Delegate to let lombok generate delegate methods that forward the call to this field (or the result of invoking this method). +

+ Lombok delegates all public methods of the field's type (or method's return type), as well as those of its supertypes except for all + methods declared in java.lang.Object. +

+ You can pass any number of classes into the @Delegate annotation's types parameter. + If you do that, then lombok will delegate all public methods in those types (and their supertypes, except java.lang.Object) instead of looking at the field/method's type. +

+ All public non-Object methods that are part of the calculated type(s) are copied, whether or not you also wrote implementations for those methods. That would thus result in duplicate method errors. You can avoid these + by using the @Delegate(excludes=SomeType.class) parameter to exclude all public methods in the excluded type(s), and their supertypes. +

+ To have very precise control over what is delegated and what isn't, write private inner interfaces with method signatures, then specify these + private inner interfaces as types in @Delegate(types=PrivateInnerInterfaceWithIncludesList.class, excludes=SameForExcludes.class). +

+
+
+
+

With Lombok

+
@HTML_PRE@
+
+
+
+

Vanilla Java

+
@HTML_POST@
+
+
+
+
+

Small print

+

+ When passing classes to the annotation's types or excludes parameter, you cannot include generics. + This is a limitation of java. Use private inner interfaces or classes that extend the intended type including the + generics parameter to work around this problem. +

+ When passing classes to the annotation, these classes do not need to be supertypes of the field. See the example. +

+ @Delegate cannot be used on static fields or methods. +

+ @Delegate cannot be used when the calculated type(s) to delegate / exclude themselves contain @Delegate annotations; in other words, @Delegate will error if you attempt to use it recursively. +

+
+ +
+
+
+ + + diff --git a/website/features/experimental/FieldDefaults.html b/website/features/experimental/FieldDefaults.html index eff709ca..969da230 100644 --- a/website/features/experimental/FieldDefaults.html +++ b/website/features/experimental/FieldDefaults.html @@ -65,7 +65,7 @@
diff --git a/website/features/experimental/Wither.html b/website/features/experimental/Wither.html index 46d3b08b..b6634be4 100644 --- a/website/features/experimental/Wither.html +++ b/website/features/experimental/Wither.html @@ -85,7 +85,7 @@
diff --git a/website/features/experimental/index.html b/website/features/experimental/index.html index 1128787c..9a1c505f 100644 --- a/website/features/experimental/index.html +++ b/website/features/experimental/index.html @@ -30,6 +30,8 @@
Annoying API? Fix it yourself: Add new methods to existing types!
@FieldDefaults
New default field modifiers for the 21st century.
+
@Delegate
+
Don't lose your composition.
@Wither
Immutable 'setters' - methods that create a clone but with one changed field.
onMethod= / onConstructor= / onParam=
diff --git a/website/features/index.html b/website/features/index.html index f9b8cdfa..537ed166 100644 --- a/website/features/index.html +++ b/website/features/index.html @@ -40,8 +40,6 @@
Laziness is a virtue!
@Log
Captain's Log, stardate 24435.7: "What was that line again?"
-
@Delegate
-
Don't lose your composition.
experimental features
Here be dragons: Extra features which aren't quite ready for prime time yet.
-- cgit