Example usage for org.objectweb.asm Opcodes ACC_ENUM

List of usage examples for org.objectweb.asm Opcodes ACC_ENUM

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes ACC_ENUM.

Prototype

int ACC_ENUM

To view the source code for org.objectweb.asm Opcodes ACC_ENUM.

Click Source Link

Usage

From source file:org.adjective.stout.writer.ByteCodeWriter.java

License:Apache License

private int getModifierCode(Set<ElementModifier> modifiers, MemberType type) {
    int code = getModifierCode(modifiers, (Sort) null);
    int illegal = Opcodes.ACC_ANNOTATION | Opcodes.ACC_BRIDGE | Opcodes.ACC_ENUM | Opcodes.ACC_INTERFACE
            | Opcodes.ACC_SUPER;//from   w  w  w . jav  a  2s  .co  m
    switch (type) {
    case FIELD:
        illegal |= Opcodes.ACC_ABSTRACT | Opcodes.ACC_NATIVE | Opcodes.ACC_STRICT | Opcodes.ACC_SYNCHRONIZED;
        break;
    case METHOD:
        if (isBitSet(Opcodes.ACC_ABSTRACT, code)) {
            illegal |= Opcodes.ACC_NATIVE | Opcodes.ACC_STRICT | Opcodes.ACC_SYNCHRONIZED | Opcodes.ACC_STATIC
                    | Opcodes.ACC_FINAL;
        }
        break;
    }
    if (isBitSet(illegal, code)) {
        throw new IllegalStateException(
                "Illegal combination of modifier codes: " + code + " (illegal codes: " + illegal + ")");
    }
    return code;
}

From source file:org.apache.groovy.parser.antlr4.AstBuilder.java

License:Apache License

@Override
public ClassNode visitClassDeclaration(ClassDeclarationContext ctx) {
    String packageName = moduleNode.getPackageName();
    packageName = null != packageName ? packageName : "";

    List<ModifierNode> modifierNodeList = ctx.getNodeMetaData(TYPE_DECLARATION_MODIFIERS);
    Objects.requireNonNull(modifierNodeList, "modifierNodeList should not be null");

    ModifierManager modifierManager = new ModifierManager(this, modifierNodeList);
    int modifiers = modifierManager.getClassModifiersOpValue();

    boolean syntheticPublic = ((modifiers & Opcodes.ACC_SYNTHETIC) != 0);
    modifiers &= ~Opcodes.ACC_SYNTHETIC;

    final ClassNode outerClass = classNodeStack.peek();
    ClassNode classNode;//from w ww  .  ja v  a  2 s  .c o m
    String className = this.visitIdentifier(ctx.identifier());

    if (VAR_STR.equals(className)) {
        throw createParsingFailedException("var cannot be used for type declarations", ctx.identifier());
    }

    if (asBoolean(ctx.ENUM())) {
        classNode = EnumHelper.makeEnumNode(asBoolean(outerClass) ? className : packageName + className,
                modifiers, null, outerClass);
    } else {
        if (asBoolean(outerClass)) {
            classNode = new InnerClassNode(outerClass, outerClass.getName() + "$" + className,
                    modifiers | (outerClass.isInterface() ? Opcodes.ACC_STATIC : 0), ClassHelper.OBJECT_TYPE);
        } else {
            classNode = new ClassNode(packageName + className, modifiers, ClassHelper.OBJECT_TYPE);
        }
    }

    configureAST(classNode, ctx);
    classNode.putNodeMetaData(CLASS_NAME, className);
    classNode.setSyntheticPublic(syntheticPublic);

    if (asBoolean(ctx.TRAIT())) {
        attachTraitAnnotation(classNode);
    }
    classNode.addAnnotations(modifierManager.getAnnotations());
    classNode.setGenericsTypes(this.visitTypeParameters(ctx.typeParameters()));

    boolean isInterface = asBoolean(ctx.INTERFACE()) && !asBoolean(ctx.AT());
    boolean isInterfaceWithDefaultMethods = false;

    // declaring interface with default method
    if (isInterface && this.containsDefaultMethods(ctx)) {
        isInterfaceWithDefaultMethods = true;
        attachTraitAnnotation(classNode);
        classNode.putNodeMetaData(IS_INTERFACE_WITH_DEFAULT_METHODS, true);
    }

    if (asBoolean(ctx.CLASS()) || asBoolean(ctx.TRAIT()) || isInterfaceWithDefaultMethods) { // class OR trait OR interface with default methods
        classNode.setSuperClass(this.visitType(ctx.sc));
        classNode.setInterfaces(this.visitTypeList(ctx.is));

        this.initUsingGenerics(classNode);
    } else if (isInterface) { // interface(NOT annotation)
        classNode.setModifiers(classNode.getModifiers() | Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT);

        classNode.setSuperClass(ClassHelper.OBJECT_TYPE);
        classNode.setInterfaces(this.visitTypeList(ctx.scs));

        this.initUsingGenerics(classNode);

        this.hackMixins(classNode);
    } else if (asBoolean(ctx.ENUM())) { // enum
        classNode.setModifiers(classNode.getModifiers() | Opcodes.ACC_ENUM | Opcodes.ACC_FINAL);

        classNode.setInterfaces(this.visitTypeList(ctx.is));

        this.initUsingGenerics(classNode);
    } else if (asBoolean(ctx.AT())) { // annotation
        classNode.setModifiers(classNode.getModifiers() | Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT
                | Opcodes.ACC_ANNOTATION);

        classNode.addInterface(ClassHelper.Annotation_TYPE);

        this.hackMixins(classNode);
    } else {
        throw createParsingFailedException("Unsupported class declaration: " + ctx.getText(), ctx);
    }

    // we put the class already in output to avoid the most inner classes
    // will be used as first class later in the loader. The first class
    // there determines what GCL#parseClass for example will return, so we
    // have here to ensure it won't be the inner class
    if (asBoolean(ctx.CLASS()) || asBoolean(ctx.TRAIT())) {
        classNodeList.add(classNode);
    }

    classNodeStack.push(classNode);
    ctx.classBody().putNodeMetaData(CLASS_DECLARATION_CLASS_NODE, classNode);
    this.visitClassBody(ctx.classBody());
    classNodeStack.pop();

    if (!(asBoolean(ctx.CLASS()) || asBoolean(ctx.TRAIT()))) {
        classNodeList.add(classNode);
    }

    groovydocManager.handle(classNode, ctx);

    return classNode;
}

From source file:org.apache.tika.parser.asm.XHTMLClassVisitor.java

License:Apache License

public void visit(int version, int access, String name, String signature, String superName,
        String[] interfaces) {/*from w w  w  . j  a  va 2  s  .c o  m*/
    type = Type.getObjectType(name);

    String className = type.getClassName();
    int dot = className.lastIndexOf('.');
    if (dot != -1) {
        packageName = className.substring(0, dot);
        className = className.substring(dot + 1);
    }

    metadata.set(TikaCoreProperties.TITLE, className);
    metadata.set(Metadata.RESOURCE_NAME_KEY, className + ".class");

    try {
        xhtml.startDocument();
        xhtml.startElement("pre");

        if (packageName != null) {
            writeKeyword("package");
            xhtml.characters(" " + packageName + ";\n");
        }

        writeAccess(access);
        if (isSet(access, Opcodes.ACC_INTERFACE)) {
            writeKeyword("interface");
            writeSpace();
            writeType(type);
            writeSpace();
            writeInterfaces("extends", interfaces);
        } else if (isSet(access, Opcodes.ACC_ENUM)) {
            writeKeyword("enum");
            writeSpace();
            writeType(type);
            writeSpace();
        } else {
            writeKeyword("class");
            writeSpace();
            writeType(type);
            writeSpace();
            if (superName != null) {
                Type superType = Type.getObjectType(superName);
                if (!superType.getClassName().equals("java.lang.Object")) {
                    writeKeyword("extends");
                    writeSpace();
                    writeType(superType);
                    writeSpace();
                }
            }
            writeInterfaces("implements", interfaces);
        }
        xhtml.characters("{\n");
    } catch (SAXException e) {
        throw new RuntimeException(e);
    }
}

From source file:org.bundlemaker.core.parser.bytecode.asm.ArtefactAnalyserClassVisitor.java

License:Open Source License

/**
 * @inheritDoc/* www  .  j  a  v  a2s.com*/
 */
@Override
public void visit(int version, int access, String name, String signature, String superName,
        String[] interfaces) {

    // get the type
    _type = Type.getObjectType(name);

    // get the abstract flag
    boolean abstractType = ((access & Opcodes.ACC_ABSTRACT) != 0);

    // get the type type
    TypeEnum typeEnum = null;
    if ((access & Opcodes.ACC_ENUM) != 0) {
        typeEnum = TypeEnum.ENUM;
    } else if ((access & Opcodes.ACC_ANNOTATION) != 0) {
        typeEnum = TypeEnum.ANNOTATION;
    } else if ((access & Opcodes.ACC_INTERFACE) != 0) {
        typeEnum = TypeEnum.INTERFACE;
        abstractType = true;
    } else {
        typeEnum = TypeEnum.CLASS;
    }

    // get the fully qualified name
    String fullyQualifiedName = VisitorUtils.getFullyQualifiedTypeName(_type);

    // record the contained type
    _recorder.recordContainedType(fullyQualifiedName, typeEnum, abstractType);

    if (_analyzeReferences) {

        // super type
        // TODO: USES
        Type superType = Type.getObjectType(superName);
        VisitorUtils.recordReferencedTypes(_recorder, true, false, false, superType);
        //
        for (String interfaceName : interfaces) {

            // implemented interfaces
            // TODO: USES
            Type implementsType = Type.getObjectType(interfaceName);
            VisitorUtils.recordReferencedTypes(_recorder, false, true, false, implementsType);
        }
    }
}

From source file:org.codehaus.groovy.antlr.EnumHelper.java

License:Apache License

public static ClassNode makeEnumNode(String name, int modifiers, ClassNode[] interfaces, ClassNode outerClass) {
    modifiers = modifiers | Opcodes.ACC_FINAL | Opcodes.ACC_ENUM;
    ClassNode enumClass;/*from w ww .  j a va 2  s  .c  o  m*/
    if (outerClass == null) {
        enumClass = new ClassNode(name, modifiers, null, interfaces, MixinNode.EMPTY_ARRAY);
    } else {
        name = outerClass.getName() + "$" + name;
        modifiers |= Opcodes.ACC_STATIC;
        enumClass = new InnerClassNode(outerClass, name, modifiers, null, interfaces, MixinNode.EMPTY_ARRAY);
    }

    // set super class and generics info
    // "enum X" -> class X extends Enum<X>
    GenericsType gt = new GenericsType(enumClass);
    ClassNode superClass = ClassHelper.makeWithoutCaching("java.lang.Enum");
    superClass.setGenericsTypes(new GenericsType[] { gt });
    enumClass.setSuperClass(superClass);
    superClass.setRedirect(ClassHelper.Enum_Type);

    return enumClass;
}

From source file:org.codehaus.groovy.antlr.EnumHelper.java

License:Apache License

public static FieldNode addEnumConstant(ClassNode enumClass, String name, Expression init) {
    int modifiers = PUBLIC_FS | Opcodes.ACC_ENUM;
    if (init != null && !(init instanceof ListExpression)) {
        ListExpression list = new ListExpression();
        list.addExpression(init);//from  ww  w. j av  a  2s  .co  m
        init = list;
    }
    FieldNode fn = new FieldNode(name, modifiers, enumClass.getPlainNodeReference(), enumClass, init);
    enumClass.addField(fn);
    return fn;
}

From source file:org.codehaus.groovy.control.StaticImportVisitor.java

License:Apache License

private boolean isEnum(ClassNode node) {
    return (node.getModifiers() & Opcodes.ACC_ENUM) != 0;
}

From source file:org.codehaus.groovy.parser.antlr4.ASTBuilder.java

License:Apache License

public ClassNode parseClassDeclaration(final GroovyLangParser.ClassDeclarationContext ctx) {
    boolean isEnum = asBoolean(ctx.KW_ENUM());

    final ClassNode outerClass = asBoolean(classNodeStack) ? classNodeStack.peek() : null;
    ClassNode[] interfaces = asBoolean(ctx.implementsClause())
            ? collect(ctx.implementsClause().genericClassNameExpression(), new Closure<ClassNode>(this, this) {
                public ClassNode doCall(GroovyLangParser.GenericClassNameExpressionContext it) {
                    return parseExpression(it);
                }/*  w  w  w  . j av a2  s . co m*/
            }).toArray(new ClassNode[0])
            : new ClassNode[0];

    ClassNode classNode;
    String packageName = moduleNode.getPackageName();
    packageName = packageName != null && asBoolean(packageName) ? packageName : "";

    if (isEnum) {
        classNode = EnumHelper.makeEnumNode(
                asBoolean(outerClass) ? ctx.IDENTIFIER().getText() : packageName + ctx.IDENTIFIER().getText(),
                Modifier.PUBLIC, interfaces, outerClass);
    } else {
        if (outerClass != null) {
            String name = outerClass.getName() + "$" + String.valueOf(ctx.IDENTIFIER());
            classNode = new InnerClassNode(outerClass, name, Modifier.PUBLIC, ClassHelper.OBJECT_TYPE);
        } else {
            classNode = new ClassNode(packageName + String.valueOf(ctx.IDENTIFIER()), Modifier.PUBLIC,
                    ClassHelper.OBJECT_TYPE);
        }
    }

    setupNodeLocation(classNode, ctx);

    if (asBoolean(ctx.KW_TRAIT())) {
        attachTraitTransformAnnotation(classNode);
    }

    attachAnnotations(classNode, ctx.annotationClause());

    //        moduleNode.addClass(classNode);
    classes.add(classNode);
    if (asBoolean(ctx.extendsClause())) {
        if (asBoolean(ctx.KW_INTERFACE()) && !asBoolean(ctx.AT())) { // interface(NOT annotation)
            List<ClassNode> interfaceList = new LinkedList<ClassNode>();
            for (GroovyLangParser.GenericClassNameExpressionContext genericClassNameExpressionContext : ctx
                    .extendsClause().genericClassNameExpression()) {
                interfaceList.add(parseExpression(genericClassNameExpressionContext));
            }
            (classNode).setInterfaces(interfaceList.toArray(new ClassNode[0]));
            (classNode).setSuperClass(ClassHelper.OBJECT_TYPE);
        } else {
            (classNode).setSuperClass(parseExpression(ctx.extendsClause().genericClassNameExpression(0)));
        }

    }

    if (asBoolean(ctx.implementsClause())) {
        (classNode).setInterfaces(interfaces);
    }

    if (!isEnum) {
        (classNode).setGenericsTypes(parseGenericDeclaration(ctx.genericDeclarationList()));
        (classNode).setUsingGenerics(
                (classNode.getGenericsTypes() != null && classNode.getGenericsTypes().length != 0)
                        || (classNode).getSuperClass().isUsingGenerics() || DefaultGroovyMethods
                                .any(classNode.getInterfaces(), new Closure<Boolean>(this, this) {
                                    public Boolean doCall(ClassNode it) {
                                        return it.isUsingGenerics();
                                    }
                                }));
    }

    classNode.setModifiers(
            parseClassModifiers(ctx.classModifier()) | (isEnum ? (Opcodes.ACC_ENUM | Opcodes.ACC_FINAL)
                    : ((asBoolean(ctx.KW_INTERFACE()) ? Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT : 0))));

    classNode.setSyntheticPublic((classNode.getModifiers() & Opcodes.ACC_SYNTHETIC) != 0);
    classNode.setModifiers(classNode.getModifiers() & ~Opcodes.ACC_SYNTHETIC);// FIXME Magic with synthetic modifier.

    if (asBoolean(ctx.AT())) {
        classNode.addInterface(ClassHelper.Annotation_TYPE);
        classNode.setModifiers(classNode.getModifiers() | Opcodes.ACC_ANNOTATION);
    }

    classNodeStack.add(classNode);
    parseClassBody(classNode, ctx.classBody());
    classNodeStack.pop();

    if (classNode.isInterface()) { // FIXME why interface has null mixin
        try {
            // FIXME Hack with visibility.
            Field field = ClassNode.class.getDeclaredField("mixins");
            field.setAccessible(true);
            field.set(classNode, null);
        } catch (IllegalAccessException e) {
            log.warning(createExceptionMessage(e));
        } catch (NoSuchFieldException e) {
            log.warning(createExceptionMessage(e));
        }
    }

    this.attachDocCommentAsMetaData(classNode, ctx);

    return classNode;
}

From source file:org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.java

License:Open Source License

/**
 * Build JDT TypeDeclarations for the groovy type declarations that were parsed from the source file.
 *///w  w w  . j  a va2s. co m
private void createTypeDeclarations(ModuleNode moduleNode) {
    List<ClassNode> moduleClassNodes = moduleNode.getClasses();
    List<TypeDeclaration> typeDeclarations = new ArrayList<TypeDeclaration>();
    Map<ClassNode, TypeDeclaration> fromClassNodeToDecl = new HashMap<ClassNode, TypeDeclaration>();

    char[] mainName = toMainName(compilationResult.getFileName());
    boolean isInner = false;
    List<ClassNode> classNodes = null;
    classNodes = moduleClassNodes;
    Map<ClassNode, List<TypeDeclaration>> innersToRecord = new HashMap<ClassNode, List<TypeDeclaration>>();
    for (ClassNode classNode : classNodes) {
        if (!classNode.isPrimaryClassNode()) {
            continue;
        }

        GroovyTypeDeclaration typeDeclaration = new GroovyTypeDeclaration(compilationResult, classNode);

        typeDeclaration.annotations = transformAnnotations(classNode.getAnnotations());
        // FIXASC duplicates code further down, tidy this up
        if (classNode instanceof InnerClassNode) {
            InnerClassNode innerClassNode = (InnerClassNode) classNode;
            ClassNode outerClass = innerClassNode.getOuterClass();
            String outername = outerClass.getNameWithoutPackage();
            String newInner = innerClassNode.getNameWithoutPackage().substring(outername.length() + 1);
            typeDeclaration.name = newInner.toCharArray();
            isInner = true;
        } else {
            typeDeclaration.name = classNode.getNameWithoutPackage().toCharArray();
            isInner = false;
        }

        // classNode.getInnerClasses();
        // classNode.
        boolean isInterface = classNode.isInterface();
        int mods = classNode.getModifiers();
        if ((mods & Opcodes.ACC_ENUM) != 0) {
            // remove final
            mods = mods & ~Opcodes.ACC_FINAL;
        }
        // FIXASC should this modifier be set?
        // mods |= Opcodes.ACC_PUBLIC;
        // FIXASC should not do this for inner classes, just for top level types
        // FIXASC does this make things visible that shouldn't be?
        mods = mods & ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED);
        if (!isInner) {
            if ((mods & Opcodes.ACC_STATIC) != 0) {
                mods = mods & ~(Opcodes.ACC_STATIC);
            }
        }
        typeDeclaration.modifiers = mods & ~(isInterface ? Opcodes.ACC_ABSTRACT : 0);

        if (!(classNode instanceof InnerClassNode)) {
            if (!CharOperation.equals(typeDeclaration.name, mainName)) {
                typeDeclaration.bits |= ASTNode.IsSecondaryType;
            }
        }

        fixupSourceLocationsForTypeDeclaration(typeDeclaration, classNode);

        if (classNode.getGenericsTypes() != null) {
            GenericsType[] genericInfo = classNode.getGenericsTypes();
            // Example case here: Foo<T extends Number & I>
            // the type parameter is T, the 'type' is Number and the bounds for the type parameter are just the extra bound
            // I.
            typeDeclaration.typeParameters = new TypeParameter[genericInfo.length];
            for (int tp = 0; tp < genericInfo.length; tp++) {
                TypeParameter typeParameter = new TypeParameter();
                typeParameter.name = genericInfo[tp].getName().toCharArray();
                ClassNode[] upperBounds = genericInfo[tp].getUpperBounds();
                if (upperBounds != null) {
                    // FIXASC (M3) Positional info for these references?
                    typeParameter.type = createTypeReferenceForClassNode(upperBounds[0]);
                    typeParameter.bounds = (upperBounds.length > 1 ? new TypeReference[upperBounds.length - 1]
                            : null);
                    for (int b = 1, max = upperBounds.length; b < max; b++) {
                        typeParameter.bounds[b - 1] = createTypeReferenceForClassNode(upperBounds[b]);
                        typeParameter.bounds[b - 1].bits |= ASTNode.IsSuperType;
                    }
                }
                typeDeclaration.typeParameters[tp] = typeParameter;
            }
        }

        boolean isEnum = (classNode.getModifiers() & Opcodes.ACC_ENUM) != 0;
        configureSuperClass(typeDeclaration, classNode.getSuperClass(), isEnum);
        configureSuperInterfaces(typeDeclaration, classNode);
        typeDeclaration.methods = createMethodAndConstructorDeclarations(classNode, isEnum, compilationResult);
        typeDeclaration.fields = createFieldDeclarations(classNode);
        typeDeclaration.properties = classNode.getProperties();
        if (classNode instanceof InnerClassNode) {
            InnerClassNode innerClassNode = (InnerClassNode) classNode;
            ClassNode outerClass = innerClassNode.getOuterClass();
            String outername = outerClass.getNameWithoutPackage();
            String newInner = innerClassNode.getNameWithoutPackage().substring(outername.length() + 1);
            typeDeclaration.name = newInner.toCharArray();

            // Record that we need to set the parent of this inner type later
            List<TypeDeclaration> inners = innersToRecord.get(outerClass);
            if (inners == null) {
                inners = new ArrayList<TypeDeclaration>();
                innersToRecord.put(outerClass, inners);
            }
            inners.add(typeDeclaration);
        } else {
            typeDeclarations.add(typeDeclaration);
        }
        fromClassNodeToDecl.put(classNode, typeDeclaration);
    }

    // For inner types, now attach them to their parents. This was not done earlier as sometimes the types are processed in
    // such an order that inners are dealt with before outers
    for (Map.Entry<ClassNode, List<TypeDeclaration>> innersToRecordEntry : innersToRecord.entrySet()) {
        TypeDeclaration outerTypeDeclaration = fromClassNodeToDecl.get(innersToRecordEntry.getKey());
        // Check if there is a problem locating the parent for the inner
        if (outerTypeDeclaration == null) {
            throw new GroovyEclipseBug(
                    "Failed to find the type declaration for " + innersToRecordEntry.getKey().getName());
        }
        List<TypeDeclaration> newInnersList = innersToRecordEntry.getValue();
        outerTypeDeclaration.memberTypes = newInnersList.toArray(new TypeDeclaration[newInnersList.size()]);
    }

    types = typeDeclarations.toArray(new TypeDeclaration[typeDeclarations.size()]);
}

From source file:org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.java

License:Open Source License

/**
 * Build JDT representations of all the fields on the groovy type. <br>
 * Enum field handling<br>//from  w  w w . j ava 2  s  .c  o m
 * Groovy handles them as follows: they have the ACC_ENUM bit set and the type is the type of the declaring enum type. When
 * building declarations, if you want the SourceTypeBinding to correctly build an enum field binding (in
 * SourceTypeBinding.resolveTypeFor(FieldBinding)) then you need to: (1) avoid setting modifiers, the enum fields are not
 * expected to have any modifiers (2) leave the type as null, that is how these things are identified by JDT.
 */
private FieldDeclaration[] createFieldDeclarations(ClassNode classNode) {
    List<FieldDeclaration> fieldDeclarations = new ArrayList<FieldDeclaration>();
    List<FieldNode> fieldNodes = classNode.getFields();
    if (fieldNodes != null) {
        for (FieldNode fieldNode : fieldNodes) {
            boolean isEnumField = (fieldNode.getModifiers() & Opcodes.ACC_ENUM) != 0;
            boolean isSynthetic = (fieldNode.getModifiers() & Opcodes.ACC_SYNTHETIC) != 0;
            if (!isSynthetic) {
                // JavaStubGenerator ignores private fields but I don't
                // think we want to here
                FieldDeclarationWithInitializer fieldDeclaration = new FieldDeclarationWithInitializer(
                        fieldNode.getName().toCharArray(), 0, 0);
                fieldDeclaration.annotations = transformAnnotations(fieldNode.getAnnotations());
                if (!isEnumField) {
                    fieldDeclaration.modifiers = fieldNode.getModifiers() & ~0x4000; // 4000 == AccEnum
                    fieldDeclaration.type = createTypeReferenceForClassNode(fieldNode.getType());
                }
                fieldDeclaration.javadoc = new Javadoc(108, 132);
                fixupSourceLocationsForFieldDeclaration(fieldDeclaration, fieldNode, isEnumField);
                fieldDeclaration.setGroovyInitializer(fieldNode.getInitialExpression());
                fieldDeclarations.add(fieldDeclaration);
            }
        }
    }
    return fieldDeclarations.toArray(new FieldDeclaration[fieldDeclarations.size()]);
}