示例#1
0
 @Override
 public JCTree visitEnumConstant(final lombok.ast.EnumConstant node, final Void p) {
   final JCModifiers mods =
       setGeneratedBy(
           M(node)
               .Modifiers(
                   flagsFor(node.getModifiers()) | ENUM,
                   build(node.getAnnotations(), JCAnnotation.class)),
           source);
   lombok.ast.ClassDecl enumClassDecl = node.upTo(lombok.ast.ClassDecl.class);
   final JCExpression varType;
   if (enumClassDecl == null) {
     varType = build(Type(typeNodeOf(sourceNode).getName()));
   } else {
     varType = chainDots(node, enumClassDecl.getName());
   }
   final List<JCExpression> nilExp = List.nil();
   final JCNewClass init =
       setGeneratedBy(M(node).NewClass(null, nilExp, varType, nilExp, null), source);
   final JCVariableDecl enumContant =
       setGeneratedBy(M(node).VarDef(mods, name(node.getName()), varType, init), source);
   return enumContant;
 }
示例#2
0
 @Override
 public JCTree visitClassDecl(final lombok.ast.ClassDecl node, final Void p) {
   final JCModifiers mods =
       setGeneratedBy(
           M(node)
               .Modifiers(
                   flagsFor(node.getModifiers()),
                   build(node.getAnnotations(), JCAnnotation.class)),
           source);
   if (node.isInterface()) mods.flags |= Flags.INTERFACE;
   final ListBuffer<JCTree> defs = ListBuffer.lb();
   defs.appendList(build(node.getFields()));
   defs.appendList(build(node.getMethods()));
   defs.appendList(build(node.getMemberTypes()));
   final List<JCTypeParameter> typarams = build(node.getTypeParameters());
   final JCExpression extending = build(node.getSuperclass());
   final List<JCExpression> implementing = build(node.getSuperInterfaces());
   final JCClassDecl classDecl =
       setGeneratedBy(
           createClassDef(
               node, mods, name(node.getName()), typarams, extending, implementing, defs.toList()),
           source);
   return classDecl;
 }