aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-07-20 22:39:35 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-07-20 22:39:35 +0200
commitf38811779b9280bff7adebde64ed23b554a42dd9 (patch)
tree34c6f0c80e0314ae4e396a1685524d453b2f7bdf /src/core/lombok/eclipse
parente2289ef2007981ff285bc7221e89b99211598e27 (diff)
downloadlombok-f38811779b9280bff7adebde64ed23b554a42dd9.tar.gz
lombok-f38811779b9280bff7adebde64ed23b554a42dd9.tar.bz2
lombok-f38811779b9280bff7adebde64ed23b554a42dd9.zip
added javac impl of toBuilder along with test file.
Diffstat (limited to 'src/core/lombok/eclipse')
-rw-r--r--src/core/lombok/eclipse/handlers/HandleBuilder.java16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index c7ff714b..ee6dfd70 100644
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -223,6 +223,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
char[][] pkg = null;
if (md.returnType.dimensions() > 0) {
annotationNode.addError(TO_BUILDER_NOT_SUPPORTED);
+ return;
}
if (md.returnType instanceof SingleTypeReference) {
@@ -243,9 +244,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
return;
}
- EclipseNode selfType = parent;
- while (selfType != null && selfType.getKind() != Kind.TYPE) selfType = selfType.up();
- if (selfType == null || !equals(selfType.getName(), token)) {
+ if (tdParent == null || !equals(tdParent.getName(), token)) {
annotationNode.addError(TO_BUILDER_NOT_SUPPORTED);
return;
}
@@ -274,12 +273,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
if (!Arrays.equals(((SingleTypeReference) tpOnRet[i]).token, onMethod.name)) continue;
pos = i;
}
- if (pos == -1) {
- annotationNode.addError("@Builder(toBuilder=true) requires that each type parameter on the static method is part of the typeargs of the return value. Type parameter " + new String(onMethod.name) + " is not part of the return type.");
- return;
- }
-
- if (tpOnType == null || tpOnType.length <= pos) {
+ if (pos == -1 || tpOnType == null || tpOnType.length <= pos) {
annotationNode.addError("@Builder(toBuilder=true) requires that each type parameter on the static method is part of the typeargs of the return value. Type parameter " + new String(onMethod.name) + " is not part of the return type.");
return;
}
@@ -388,8 +382,8 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
if (constructorExists(builderType) == MemberExistsResult.NOT_EXISTS) {
ConstructorDeclaration cd = HandleConstructor.createConstructor(
- AccessLevel.PACKAGE, builderType, Collections.<EclipseNode>emptyList(), null,
- annotationNode, Collections.<Annotation>emptyList());
+ AccessLevel.PACKAGE, builderType, Collections.<EclipseNode>emptyList(), null,
+ annotationNode, Collections.<Annotation>emptyList());
if (cd != null) injectMethod(builderType, cd);
}