Example usage for org.eclipse.jdt.internal.compiler.lookup ExtraCompilerModifiers AccSemicolonBody

List of usage examples for org.eclipse.jdt.internal.compiler.lookup ExtraCompilerModifiers AccSemicolonBody

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup ExtraCompilerModifiers AccSemicolonBody.

Prototype

int AccSemicolonBody

To view the source code for org.eclipse.jdt.internal.compiler.lookup ExtraCompilerModifiers AccSemicolonBody.

Click Source Link

Usage

From source file:com.android.tools.lint.psi.EcjPsiBuilder.java

License:Apache License

@Nullable
private EcjPsiMethod toMethod(EcjPsiClass cls, AbstractMethodDeclaration method) {
    if (method instanceof ConstructorDeclaration) {
        if ((method.bits & ASTNode.IsDefaultConstructor) != 0) {
            return null;
        }/*  w w w  . java 2  s.  c  o  m*/
    }

    boolean isAnnotation = method instanceof AnnotationMethodDeclaration;
    EcjPsiMethod psiMethod;
    if (!isAnnotation) {
        psiMethod = new EcjPsiMethod(mManager, cls, method);
    } else {
        psiMethod = new EcjPsiAnnotationMethod(mManager, cls, method);
    }

    cls.adoptChild(psiMethod);
    EcjPsiModifierList modifierList = toModifierList(psiMethod, method);
    psiMethod.setModifierList(modifierList);
    if (cls.isInterface()) {
        boolean hasDefaultMethod = method.statements != null && method.statements.length > 0;
        int modifiers = modifierList.getModifiers();
        modifiers |= (hasDefaultMethod ? 0 : Modifier.ABSTRACT) | Modifier.PUBLIC;
        modifiers &= ~(Modifier.PROTECTED | Modifier.PRIVATE);
        modifierList.setModifiers(modifiers);
    } else if (cls.isAnnotationType()) {
        int modifiers = modifierList.getModifiers();
        modifiers |= Modifier.ABSTRACT | Modifier.PUBLIC;
        modifiers &= ~(Modifier.PROTECTED | Modifier.PRIVATE);
        modifierList.setModifiers(modifiers);
    } else if (cls.isEnum() && method.isConstructor()) {
        int modifiers = modifierList.getModifiers();
        modifiers |= Modifier.PRIVATE;
        modifiers &= ~(Modifier.PUBLIC | Modifier.PROTECTED);
        modifierList.setModifiers(modifiers);
    }

    TypeParameter[] typeParameters = method.typeParameters();
    if (typeParameters != null) {
        psiMethod.setTypeParameters(toTypeParameterList(psiMethod, typeParameters));
    }

    if (method instanceof MethodDeclaration && !method.isConstructor()) {
        TypeReference returnType = ((MethodDeclaration) method).returnType;
        if (returnType != null) {
            psiMethod.setReturnTypeElement(toTypeElement(psiMethod, returnType));
        }
    }

    psiMethod.setNameIdentifier(toIdentifier(cls, method.selector,
            toRange(method.sourceStart, method.sourceStart + method.selector.length)));

    psiMethod.setArguments(toParameterList(psiMethod, method.arguments));
    PsiReferenceList psiReferenceList = toTypeReferenceList(psiMethod, method.thrownExceptions,
            Role.THROWS_LIST);
    psiMethod.setThrownExceptions(psiReferenceList);

    PsiCodeBlock body;
    if (method instanceof ConstructorDeclaration) {
        ExplicitConstructorCall constructorCall = ((ConstructorDeclaration) method).constructorCall;
        body = toBlock(psiMethod, method.statements, constructorCall, method.bodyStart - 1, method.bodyEnd + 1);
    } else if (method instanceof MethodDeclaration) {
        boolean semiColonBody = ((method.modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0);
        if (!method.isAbstract() && !method.isNative() && !semiColonBody) {
            body = toBlock(psiMethod, method.statements, null, method.bodyStart - 1, method.bodyEnd + 1);
        } else {
            body = null;
        }
        if (isAnnotation) {
            //noinspection CastConflictsWithInstanceof
            AnnotationMethodDeclaration amd = (AnnotationMethodDeclaration) method;
            if (amd.defaultValue != null) {
                PsiExpression defaultValue = toExpression(psiMethod, amd.defaultValue);
                ((EcjPsiAnnotationMethod) psiMethod).setValue(defaultValue);
            }
        }
    } else {
        body = toBlock(psiMethod, method.statements, null, method.bodyStart - 1, method.bodyEnd + 1);
    }
    psiMethod.setBody(body);

    return psiMethod;
}

From source file:com.codenvy.ide.ext.java.server.internal.compiler.parser.SourceTypeConverter.java

License:Open Source License

private TypeDeclaration convert(SourceType typeHandle, CompilationResult compilationResult)
        throws JavaModelException {
    SourceTypeElementInfo typeInfo = (SourceTypeElementInfo) typeHandle.getElementInfo();
    if (typeInfo.isAnonymousMember())
        throw new AnonymousMemberFound();
    /* create type declaration - can be member type */
    TypeDeclaration type = new TypeDeclaration(compilationResult);
    if (typeInfo.getEnclosingType() == null) {
        if (typeHandle.isAnonymous()) {
            type.name = CharOperation.NO_CHAR;
            type.bits |= (ASTNode.IsAnonymousType | ASTNode.IsLocalType);
        } else {/*from w w w. j a v  a2s .com*/
            if (typeHandle.isLocal()) {
                type.bits |= ASTNode.IsLocalType;
            }
        }
    } else {
        type.bits |= ASTNode.IsMemberType;
    }
    if ((type.bits & ASTNode.IsAnonymousType) == 0) {
        type.name = typeInfo.getName();
    }
    type.name = typeInfo.getName();
    int start, end; // only positions available
    type.sourceStart = start = typeInfo.getNameSourceStart();
    type.sourceEnd = end = typeInfo.getNameSourceEnd();
    type.modifiers = typeInfo.getModifiers();
    type.declarationSourceStart = typeInfo.getDeclarationSourceStart();
    type.declarationSourceEnd = typeInfo.getDeclarationSourceEnd();
    type.bodyEnd = type.declarationSourceEnd;

    // convert 1.5 specific constructs only if compliance is 1.5 or above
    if (this.has1_5Compliance) {
        /* convert annotations */
        type.annotations = convertAnnotations(typeHandle);
    }
    /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=324850, even in a 1.4 project, we
       must internalize type variables and observe any parameterization of super class
       and/or super interfaces in order to be able to detect overriding in the presence
       of generics.
     */
    char[][] typeParameterNames = typeInfo.getTypeParameterNames();
    if (typeParameterNames.length > 0) {
        int parameterCount = typeParameterNames.length;
        char[][][] typeParameterBounds = typeInfo.getTypeParameterBounds();
        type.typeParameters = new TypeParameter[parameterCount];
        for (int i = 0; i < parameterCount; i++) {
            type.typeParameters[i] = createTypeParameter(typeParameterNames[i], typeParameterBounds[i], start,
                    end);
        }
    }

    /* set superclass and superinterfaces */
    if (typeInfo.getSuperclassName() != null) {
        type.superclass = createTypeReference(typeInfo.getSuperclassName(), start, end,
                true /* include generics */);
        type.superclass.bits |= ASTNode.IsSuperType;
    }
    char[][] interfaceNames = typeInfo.getInterfaceNames();
    int interfaceCount = interfaceNames == null ? 0 : interfaceNames.length;
    if (interfaceCount > 0) {
        type.superInterfaces = new TypeReference[interfaceCount];
        for (int i = 0; i < interfaceCount; i++) {
            type.superInterfaces[i] = createTypeReference(interfaceNames[i], start, end,
                    true /* include generics */);
            type.superInterfaces[i].bits |= ASTNode.IsSuperType;
        }
    }
    /* convert member types */
    if ((this.flags & MEMBER_TYPE) != 0) {
        SourceType[] sourceMemberTypes = typeInfo.getMemberTypeHandles();
        int sourceMemberTypeCount = sourceMemberTypes.length;
        type.memberTypes = new TypeDeclaration[sourceMemberTypeCount];
        for (int i = 0; i < sourceMemberTypeCount; i++) {
            type.memberTypes[i] = convert(sourceMemberTypes[i], compilationResult);
            type.memberTypes[i].enclosingType = type;
        }
    }

    /* convert intializers and fields*/
    InitializerElementInfo[] initializers = null;
    int initializerCount = 0;
    if ((this.flags & LOCAL_TYPE) != 0) {
        initializers = typeInfo.getInitializers();
        initializerCount = initializers.length;
    }
    SourceField[] sourceFields = null;
    int sourceFieldCount = 0;
    if ((this.flags & FIELD) != 0) {
        sourceFields = typeInfo.getFieldHandles();
        sourceFieldCount = sourceFields.length;
    }
    int length = initializerCount + sourceFieldCount;
    if (length > 0) {
        type.fields = new FieldDeclaration[length];
        for (int i = 0; i < initializerCount; i++) {
            type.fields[i] = convert(initializers[i], compilationResult);
        }
        int index = 0;
        for (int i = initializerCount; i < length; i++) {
            type.fields[i] = convert(sourceFields[index++], type, compilationResult);
        }
    }

    /* convert methods - need to add default constructor if necessary */
    boolean needConstructor = (this.flags & CONSTRUCTOR) != 0;
    boolean needMethod = (this.flags & METHOD) != 0;
    if (needConstructor || needMethod) {

        SourceMethod[] sourceMethods = typeInfo.getMethodHandles();
        int sourceMethodCount = sourceMethods.length;

        /* source type has a constructor ?           */
        /* by default, we assume that one is needed. */
        int extraConstructor = 0;
        int methodCount = 0;
        int kind = TypeDeclaration.kind(type.modifiers);
        boolean isAbstract = kind == TypeDeclaration.INTERFACE_DECL
                || kind == TypeDeclaration.ANNOTATION_TYPE_DECL;
        if (!isAbstract) {
            extraConstructor = needConstructor ? 1 : 0;
            for (int i = 0; i < sourceMethodCount; i++) {
                if (sourceMethods[i].isConstructor()) {
                    if (needConstructor) {
                        extraConstructor = 0; // Does not need the extra constructor since one constructor already exists.
                        methodCount++;
                    }
                } else if (needMethod) {
                    methodCount++;
                }
            }
        } else {
            methodCount = needMethod ? sourceMethodCount : 0;
        }
        type.methods = new AbstractMethodDeclaration[methodCount + extraConstructor];
        if (extraConstructor != 0) { // add default constructor in first position
            type.methods[0] = type.createDefaultConstructor(false, false);
        }
        int index = 0;
        boolean hasAbstractMethods = false;
        for (int i = 0; i < sourceMethodCount; i++) {
            SourceMethod sourceMethod = sourceMethods[i];
            SourceMethodElementInfo methodInfo = (SourceMethodElementInfo) sourceMethod.getElementInfo();
            boolean isConstructor = methodInfo.isConstructor();
            if ((methodInfo.getModifiers() & ClassFileConstants.AccAbstract) != 0) {
                hasAbstractMethods = true;
            }
            if ((isConstructor && needConstructor) || (!isConstructor && needMethod)) {
                AbstractMethodDeclaration method = convert(sourceMethod, methodInfo, compilationResult);
                if (isAbstract || method.isAbstract()) { // fix-up flag
                    method.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
                }
                type.methods[extraConstructor + index++] = method;
            }
        }
        if (hasAbstractMethods)
            type.bits |= ASTNode.HasAbstractMethods;
    }

    return type;
}

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryTypeConverter.java

License:Open Source License

private TypeDeclaration convert(IType type, IType alreadyComputedMember,
        TypeDeclaration alreadyComputedMemberDeclaration) throws JavaModelException {
    /* create type declaration - can be member type */
    TypeDeclaration typeDeclaration = new TypeDeclaration(this.compilationResult);

    if (type.getDeclaringType() != null) {
        typeDeclaration.bits |= ASTNode.IsMemberType;
    }/*from  www  .ja  va  2s  .co  m*/
    typeDeclaration.name = type.getElementName().toCharArray();
    typeDeclaration.modifiers = type.getFlags();

    /* set superclass and superinterfaces */
    if (type.getSuperclassName() != null) {
        TypeReference typeReference = createTypeReference(type.getSuperclassTypeSignature());
        if (typeReference != null) {
            typeDeclaration.superclass = typeReference;
            typeDeclaration.superclass.bits |= ASTNode.IsSuperType;
        }
    }

    String[] interfaceTypes = type.getSuperInterfaceTypeSignatures();
    int interfaceCount = interfaceTypes == null ? 0 : interfaceTypes.length;
    typeDeclaration.superInterfaces = new TypeReference[interfaceCount];
    int count = 0;
    for (int i = 0; i < interfaceCount; i++) {
        TypeReference typeReference = createTypeReference(interfaceTypes[i]);
        if (typeReference != null) {
            typeDeclaration.superInterfaces[count] = typeReference;
            typeDeclaration.superInterfaces[count++].bits |= ASTNode.IsSuperType;
        }
    }
    if (count != interfaceCount) {
        System.arraycopy(typeDeclaration.fields, 0,
                typeDeclaration.superInterfaces = new TypeReference[interfaceCount], 0, interfaceCount);
    }

    // convert 1.5 specific constructs only if compliance is 1.5 or above
    if (this.has1_5Compliance) {

        /* convert type parameters */
        ITypeParameter[] typeParameters = type.getTypeParameters();
        if (typeParameters != null && typeParameters.length > 0) {
            int parameterCount = typeParameters.length;
            org.eclipse.jdt.internal.compiler.ast.TypeParameter[] typeParams = new org.eclipse.jdt.internal.compiler.ast.TypeParameter[parameterCount];
            for (int i = 0; i < parameterCount; i++) {
                ITypeParameter typeParameter = typeParameters[i];
                typeParams[i] = createTypeParameter(typeParameter.getElementName().toCharArray(),
                        stringArrayToCharArray(typeParameter.getBounds()), 0, 0);
            }

            typeDeclaration.typeParameters = typeParams;
        }
    }

    /* convert member types */
    IType[] memberTypes = type.getTypes();
    int memberTypeCount = memberTypes == null ? 0 : memberTypes.length;
    typeDeclaration.memberTypes = new TypeDeclaration[memberTypeCount];
    for (int i = 0; i < memberTypeCount; i++) {
        if (alreadyComputedMember != null && alreadyComputedMember.getFullyQualifiedName()
                .equals(memberTypes[i].getFullyQualifiedName())) {
            typeDeclaration.memberTypes[i] = alreadyComputedMemberDeclaration;
        } else {
            typeDeclaration.memberTypes[i] = convert(memberTypes[i], null, null);
        }
        typeDeclaration.memberTypes[i].enclosingType = typeDeclaration;
    }

    /* convert fields */
    IField[] fields = type.getFields();
    int fieldCount = fields == null ? 0 : fields.length;
    typeDeclaration.fields = new FieldDeclaration[fieldCount];
    count = 0;
    for (int i = 0; i < fieldCount; i++) {
        FieldDeclaration fieldDeclaration = convert(fields[i], type);
        if (fieldDeclaration != null) {
            typeDeclaration.fields[count++] = fieldDeclaration;
        }
    }
    if (count != fieldCount) {
        System.arraycopy(typeDeclaration.fields, 0, typeDeclaration.fields = new FieldDeclaration[count], 0,
                count);
    }

    /* convert methods - need to add default constructor if necessary */
    IMethod[] methods = type.getMethods();
    int methodCount = methods == null ? 0 : methods.length;

    /* source type has a constructor ?           */
    /* by default, we assume that one is needed. */
    int neededCount = 1;
    for (int i = 0; i < methodCount; i++) {
        if (methods[i].isConstructor()) {
            neededCount = 0;
            // Does not need the extra constructor since one constructor already exists.
            break;
        }
    }
    boolean isInterface = type.isInterface();
    neededCount = isInterface ? 0 : neededCount;
    typeDeclaration.methods = new AbstractMethodDeclaration[methodCount + neededCount];
    if (neededCount != 0) { // add default constructor in first position
        typeDeclaration.methods[0] = typeDeclaration.createDefaultConstructor(false, false);
    }
    boolean hasAbstractMethods = false;
    count = 0;
    for (int i = 0; i < methodCount; i++) {
        AbstractMethodDeclaration method = convert(methods[i], type);
        if (method != null) {
            boolean isAbstract;
            if ((isAbstract = method.isAbstract()) || isInterface) { // fix-up flag
                method.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
            }
            if (isAbstract) {
                hasAbstractMethods = true;
            }
            typeDeclaration.methods[neededCount + (count++)] = method;
        }
    }
    if (count != methodCount) {
        System.arraycopy(typeDeclaration.methods, 0,
                typeDeclaration.methods = new AbstractMethodDeclaration[count + neededCount], 0,
                count + neededCount);
    }
    if (hasAbstractMethods) {
        typeDeclaration.bits |= ASTNode.HasAbstractMethods;
    }
    return typeDeclaration;
}

From source file:lombok.eclipse.handlers.HandleSuperBuilder.java

License:Open Source License

private MethodDeclaration generateAbstractSelfMethod(EclipseNode tdParent, boolean override,
        String builderGenericName) {
    MethodDeclaration out = new MethodDeclaration(
            ((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
    out.selector = SELF_METHOD_NAME;//from   ww  w  . j  a  v  a 2 s.co m
    out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
    out.modifiers = ClassFileConstants.AccAbstract | ClassFileConstants.AccProtected
            | ExtraCompilerModifiers.AccSemicolonBody;
    if (override)
        out.annotations = new Annotation[] {
                makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, tdParent.get()) };
    out.returnType = new SingleTypeReference(builderGenericName.toCharArray(), 0);
    return out;
}

From source file:lombok.eclipse.handlers.HandleSuperBuilder.java

License:Open Source License

private MethodDeclaration generateAbstractBuildMethod(EclipseNode tdParent, String methodName, boolean override,
        String classGenericName, ASTNode source) {

    MethodDeclaration out = new MethodDeclaration(
            ((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
    out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;

    out.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract
            | ExtraCompilerModifiers.AccSemicolonBody;
    out.selector = methodName.toCharArray();
    out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
    out.returnType = new SingleTypeReference(classGenericName.toCharArray(), 0);
    if (override)
        out.annotations = new Annotation[] { makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, source) };
    out.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
    return out;//from  www . jav  a 2 s . c o  m
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void consumeAnnotationTypeMemberDeclaration() {
    // AnnotationTypeMemberDeclaration ::= AnnotationTypeMemberDeclarationHeader AnnotationTypeMemberHeaderExtendedDims DefaultValueopt ';'
    AnnotationMethodDeclaration annotationTypeMemberDeclaration = (AnnotationMethodDeclaration) this.astStack[this.astPtr];
    annotationTypeMemberDeclaration.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
    // store the this.endPosition (position just before the '}') in case there is
    // a trailing comment behind the end of the method
    int declarationEndPosition = flushCommentsDefinedPriorTo(this.endStatementPosition);
    annotationTypeMemberDeclaration.bodyStart = this.endStatementPosition;
    annotationTypeMemberDeclaration.bodyEnd = declarationEndPosition;
    annotationTypeMemberDeclaration.declarationSourceEnd = declarationEndPosition;
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void consumeConstructorHeader() {
    // ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt

    AbstractMethodDeclaration method = (AbstractMethodDeclaration) this.astStack[this.astPtr];

    if (this.currentToken == TokenNameLBRACE) {
        method.bodyStart = this.scanner.currentPosition;
    }/*from  w w  w . java 2 s .  c o  m*/
    // recovery
    if (this.currentElement != null) {
        if (this.currentToken == TokenNameSEMICOLON) { // for invalid constructors
            method.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
            method.declarationSourceEnd = this.scanner.currentPosition - 1;
            method.bodyEnd = this.scanner.currentPosition - 1;
            if (this.currentElement.parseTree() == method && this.currentElement.parent != null) {
                this.currentElement = this.currentElement.parent;
            }
        }
        this.restartRecovery = true; // used to avoid branching back into the regular automaton
    }
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void consumeInvalidConstructorDeclaration() {
    // ConstructorDeclaration ::= ConstructorHeader ';'
    // now we know that the top of stack is a constructorDeclaration
    ConstructorDeclaration cd = (ConstructorDeclaration) this.astStack[this.astPtr];

    cd.bodyEnd = this.endPosition; // position just before the trailing semi-colon
    cd.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
    // report the problem and continue the parsing - narrowing the problem onto the method

    cd.modifiers |= ExtraCompilerModifiers.AccSemicolonBody; // remember semi-colon body
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void consumeInvalidConstructorDeclaration(boolean hasBody) {
    // InvalidConstructorDeclaration ::= ConstructorHeader ConstructorBody ==> true
    // InvalidConstructorDeclaration ::= ConstructorHeader ';' ==> false

    /*//w  ww . jav  a 2  s .c o m
    this.astStack : modifiers arguments throws statements
    this.identifierStack : name
     ==>
    this.astStack : MethodDeclaration
    this.identifierStack :
    */
    if (hasBody) {
        // pop the position of the {  (body of the method) pushed in block decl
        this.intPtr--;
    }

    //statements
    if (hasBody) {
        this.realBlockPtr--;
    }

    int length;
    if (hasBody && ((length = this.astLengthStack[this.astLengthPtr--]) != 0)) {
        this.astPtr -= length;
    }
    ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) this.astStack[this.astPtr];
    constructorDeclaration.bodyEnd = this.endStatementPosition;
    constructorDeclaration.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
    if (!hasBody) {
        constructorDeclaration.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
    }
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void consumeMethodDeclaration(boolean isNotAbstract) {
    // MethodDeclaration ::= MethodHeader MethodBody
    // AbstractMethodDeclaration ::= MethodHeader ';'

    /*//w  ww.  ja v a 2 s  .  c  om
    this.astStack : modifiers arguments throws statements
    this.identifierStack : type name
    this.intStack : dim dim dim
     ==>
    this.astStack : MethodDeclaration
    this.identifierStack :
    this.intStack :
    */

    int length;
    if (isNotAbstract) {
        // pop the position of the {  (body of the method) pushed in block decl
        this.intPtr--;
        this.intPtr--;
    }

    int explicitDeclarations = 0;
    Statement[] statements = null;
    if (isNotAbstract) {
        //statements
        explicitDeclarations = this.realBlockStack[this.realBlockPtr--];
        if (!this.options.ignoreMethodBodies) {
            if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
                System.arraycopy(this.astStack, (this.astPtr -= length) + 1, statements = new Statement[length],
                        0, length);
            }
        } else {
            length = this.astLengthStack[this.astLengthPtr--];
            this.astPtr -= length;
        }
    }

    // now we know that we have a method declaration at the top of the ast stack
    MethodDeclaration md = (MethodDeclaration) this.astStack[this.astPtr];
    md.statements = statements;
    md.explicitDeclarations = explicitDeclarations;

    // cannot be done in consumeMethodHeader because we have no idea whether or not there
    // is a body when we reduce the method header
    if (!isNotAbstract) { //remember the fact that the method has a semicolon body
        md.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
    } else if (!(this.diet && this.dietInt == 0) && statements == null
            && !containsComment(md.bodyStart, this.endPosition)) {
        md.bits |= ASTNode.UndocumentedEmptyBlock;
    }
    // store the this.endPosition (position just before the '}') in case there is
    // a trailing comment behind the end of the method
    md.bodyEnd = this.endPosition;
    md.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
}