aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xAUTHORS1
-rw-r--r--src/core/lombok/javac/handlers/HandleSuperBuilder.java28
2 files changed, 29 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 77cbbfe9..fa0f5e1e 100755
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,7 @@
Lombok contributors in alphabetical order:
Adam Juraszek <juriad@gmail.com>
+Aleksandr Zhelezniak <lekan1992@gmail.com>
Bulgakov Alexander <buls@yandex.ru>
Caleb Brinkman <floralvikings@gmail.com>
Christian Nüssgens <christian@nuessgens.com>
diff --git a/src/core/lombok/javac/handlers/HandleSuperBuilder.java b/src/core/lombok/javac/handlers/HandleSuperBuilder.java
index 0f809571..83dc23d1 100644
--- a/src/core/lombok/javac/handlers/HandleSuperBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleSuperBuilder.java
@@ -26,6 +26,7 @@ import static lombok.javac.Javac.*;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import java.util.ArrayList;
+import java.util.Collections;
import javax.lang.model.element.Modifier;
@@ -1007,8 +1008,35 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
typeParamsForBuilderParameter.add(maker.Ident(((JCTypeParameter)typeParam).getName()));
} else if (typeParam instanceof JCIdent) {
typeParamsForBuilderParameter.add(maker.Ident(((JCIdent)typeParam).getName()));
+ } else if (typeParam instanceof JCFieldAccess) {
+ typeParamsForBuilderParameter.add(copySelect(maker, (JCFieldAccess) typeParam));
}
}
return typeParamsForBuilderParameter;
}
+
+ private JCExpression copySelect(JavacTreeMaker maker, JCFieldAccess typeParam) {
+ java.util.List<Name> chainNames = new ArrayList<Name>();
+ JCExpression expression = typeParam;
+ while (expression != null) {
+ if (expression instanceof JCFieldAccess) {
+ chainNames.add(((JCFieldAccess) expression).getIdentifier());
+ expression = ((JCFieldAccess) expression).getExpression();
+ } else if (expression instanceof JCIdent) {
+ chainNames.add(((JCIdent) expression).getName());
+ expression = null;
+ }
+ }
+
+ Collections.reverse(chainNames);
+ JCExpression typeParameter = null;
+ for (Name name : chainNames) {
+ if (typeParameter == null) {
+ typeParameter = maker.Ident(name);
+ } else {
+ typeParameter = maker.Select(typeParameter, name);
+ }
+ }
+ return typeParameter;
+ }
}