diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-06-16 10:54:33 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-06-16 13:20:54 +0200 |
commit | 359b7845f21ac7ad023ce1a13af8f6b5d1833068 (patch) | |
tree | 9eeae95b9c89dc7a226e0703cad977bb841cd6cf /src/core/lombok/javac/handlers/JavacHandlerUtil.java | |
parent | 9066d57ed9073cd99d664b2676d6fde54af1a7b6 (diff) | |
download | lombok-359b7845f21ac7ad023ce1a13af8f6b5d1833068.tar.gz lombok-359b7845f21ac7ad023ce1a13af8f6b5d1833068.tar.bz2 lombok-359b7845f21ac7ad023ce1a13af8f6b5d1833068.zip |
Most of the javac implementation for HandleBuilder, plus
some minor updates and refactoring in the eclipse HandleBuilder.
Diffstat (limited to 'src/core/lombok/javac/handlers/JavacHandlerUtil.java')
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 2577befb..23bc2daf 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -806,12 +806,13 @@ public class JavacHandlerUtil { * * @param typeNode parent type to inject new type into * @param type New type (class, interface, etc) to inject. + * @return */ - public static void injectType(final JavacNode typeNode, final JCClassDecl type) { + public static JavacNode injectType(final JavacNode typeNode, final JCClassDecl type) { JCClassDecl typeDecl = (JCClassDecl) typeNode.get(); addSuppressWarningsAll(type.mods, typeNode, type.pos, getGeneratedBy(type)); typeDecl.defs = typeDecl.defs.append(type); - typeNode.add(type, Kind.TYPE); + return typeNode.add(type, Kind.TYPE); } private static void addSuppressWarningsAll(JCModifiers mods, JavacNode node, int pos, JCTree source) { @@ -1025,6 +1026,20 @@ public class JavacHandlerUtil { return result.toList(); } + public static JCExpression namePlusTypeParamsToTypeReference(TreeMaker maker, Name typeName, List<JCTypeParameter> params) { + ListBuffer<JCExpression> typeArgs = ListBuffer.lb(); + + if (!params.isEmpty()) { + for (JCTypeParameter param : params) { + typeArgs.append(maker.Ident(param.name)); + } + + return maker.TypeApply(maker.Ident(typeName), typeArgs.toList()); + } + + return maker.Ident(typeName); + } + static List<JCAnnotation> copyAnnotations(List<? extends JCExpression> in) { ListBuffer<JCAnnotation> out = ListBuffer.lb(); for (JCExpression expr : in) { |