aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers/singulars
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2017-01-19 21:36:01 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2017-01-19 21:53:04 +0100
commit19d0b8d018877d6121a2c855e830c0472f6c518f (patch)
treeb5a9a17109acc20d0649acf4262cbe410e4b6b00 /src/core/lombok/javac/handlers/singulars
parentb867f81b8a251a8a32e42f53c2be34d520938bd7 (diff)
downloadlombok-19d0b8d018877d6121a2c855e830c0472f6c518f.tar.gz
lombok-19d0b8d018877d6121a2c855e830c0472f6c518f.tar.bz2
lombok-19d0b8d018877d6121a2c855e830c0472f6c518f.zip
refactor of how creating void types works, also cleaned up some syntax.
Diffstat (limited to 'src/core/lombok/javac/handlers/singulars')
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java8
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java8
-rw-r--r--src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java8
3 files changed, 15 insertions, 9 deletions
diff --git a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
index 4de39d98..fba4c80e 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacGuavaSingularizer.java
@@ -36,6 +36,7 @@ import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
import lombok.javac.handlers.JavacSingularsRecipes.SingularData;
import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symtab;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCExpression;
@@ -71,15 +72,16 @@ abstract class JavacGuavaSingularizer extends JavacSingularizer {
@Override public void generateMethods(SingularData data, JavacNode builderType, JCTree source, boolean fluent, boolean chain) {
JavacTreeMaker maker = builderType.getTreeMaker();
- JCExpression returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ Symtab symbolTable = builderType.getSymbolTable();
+ JCExpression returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
JCStatement returnStatement = chain ? maker.Return(maker.Ident(builderType.toName("this"))) : null;
generateSingularMethod(maker, returnType, returnStatement, data, builderType, source, fluent);
- returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
returnStatement = chain ? maker.Return(maker.Ident(builderType.toName("this"))) : null;
generatePluralMethod(maker, returnType, returnStatement, data, builderType, source, fluent);
- returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
returnStatement = chain ? maker.Return(maker.Ident(builderType.toName("this"))) : null;
generateClearMethod(maker, returnType, returnStatement, data, builderType, source);
}
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
index e167c7e2..7beb29cb 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilListSetSingularizer.java
@@ -33,6 +33,7 @@ import lombok.javac.handlers.JavacHandlerUtil;
import lombok.javac.handlers.JavacSingularsRecipes.SingularData;
import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symtab;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCExpression;
@@ -82,17 +83,18 @@ abstract class JavacJavaUtilListSetSingularizer extends JavacJavaUtilSingularize
}
JavacTreeMaker maker = builderType.getTreeMaker();
+ Symtab symbolTable = builderType.getSymbolTable();
Name thisName = builderType.toName("this");
- JCExpression returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ JCExpression returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
JCStatement returnStatement = chain ? maker.Return(maker.Ident(thisName)) : null;
generateSingularMethod(maker, returnType, returnStatement, data, builderType, source, fluent);
- returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
returnStatement = chain ? maker.Return(maker.Ident(thisName)) : null;
generatePluralMethod(maker, returnType, returnStatement, data, builderType, source, fluent);
- returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
returnStatement = chain ? maker.Return(maker.Ident(thisName)) : null;
generateClearMethod(maker, returnType, returnStatement, data, builderType, source);
}
diff --git a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
index 1acae7e3..93b120e1 100644
--- a/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
+++ b/src/core/lombok/javac/handlers/singulars/JavacJavaUtilMapSingularizer.java
@@ -37,6 +37,7 @@ import lombok.javac.handlers.JavacSingularsRecipes.SingularData;
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symtab;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCExpression;
@@ -107,16 +108,17 @@ public class JavacJavaUtilMapSingularizer extends JavacJavaUtilSingularizer {
}
JavacTreeMaker maker = builderType.getTreeMaker();
+ Symtab symbolTable = builderType.getSymbolTable();
- JCExpression returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ JCExpression returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
JCStatement returnStatement = chain ? maker.Return(maker.Ident(builderType.toName("this"))) : null;
generateSingularMethod(maker, returnType, returnStatement, data, builderType, source, fluent);
- returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
returnStatement = chain ? maker.Return(maker.Ident(builderType.toName("this"))) : null;
generatePluralMethod(maker, returnType, returnStatement, data, builderType, source, fluent);
- returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(maker, CTC_VOID));
+ returnType = chain ? cloneSelfType(builderType) : maker.Type(createVoidType(symbolTable, CTC_VOID));
returnStatement = chain ? maker.Return(maker.Ident(builderType.toName("this"))) : null;
generateClearMethod(maker, returnType, returnStatement, data, builderType, source);
}