List of usage examples for org.eclipse.jdt.internal.compiler.ast ASTNode HasLocalType
int HasLocalType
To view the source code for org.eclipse.jdt.internal.compiler.ast ASTNode HasLocalType.
Click Source Link
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MatchLocator.java
License:Open Source License
/** * Visit the given method declaration and report the nodes that match exactly the * search pattern (i.e. the ones in the matching nodes set) * Note that the method declaration has already been checked. *//*from w ww . j a v a2 s.co m*/ protected void reportMatching(AbstractMethodDeclaration method, TypeDeclaration type, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException { IJavaElement enclosingElement = null; // report method declaration itself if (accuracy > -1) { enclosingElement = createHandle(method, parent); if (enclosingElement != null) { // skip if unable to find method // compute source positions of the selector Scanner scanner = this.parser.scanner; int nameSourceStart = method.sourceStart; scanner.setSource(this.currentPossibleMatch.getContents()); scanner.resetTo(nameSourceStart, method.sourceEnd); try { scanner.getNextToken(); } catch (InvalidInputException e) { // ignore } if (encloses(enclosingElement)) { SearchMatch match = null; if (method.isDefaultConstructor()) { // Use type for match associated element as default constructor does not exist in source int offset = type.sourceStart; match = this.patternLocator.newDeclarationMatch(type, parent, type.binding, accuracy, type.sourceEnd - offset + 1, this); } else { int length = scanner.currentPosition - nameSourceStart; match = this.patternLocator.newDeclarationMatch(method, enclosingElement, method.binding, accuracy, length, this); } if (match != null) { report(match); } } } } // handle nodes for the local type first if ((method.bits & ASTNode.HasLocalType) != 0) { if (enclosingElement == null) { enclosingElement = createHandle(method, parent); } // Traverse method declaration to report matches both in local types declaration // and in local variables declaration ASTNode[] nodes = typeInHierarchy ? nodeSet.matchingNodes(method.declarationSourceStart, method.declarationSourceEnd) : null; boolean report = (this.matchContainer & PatternLocator.METHOD_CONTAINER) != 0 && encloses(enclosingElement); MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, report ? nodes : null, nodeSet, this); try { method.traverse(declarationVisitor, (ClassScope) null); } catch (WrappedCoreException e) { throw e.coreException; } // Report all nodes and remove them if (nodes != null) { int length = nodes.length; for (int i = 0; i < length; i++) { Integer level = (Integer) nodeSet.matchingNodes.removeKey(nodes[i]); if (report && level != null) { this.patternLocator.matchReportReference(nodes[i], enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), method.binding, level.intValue(), this); } } } } // report the type parameters TypeParameter[] typeParameters = method.typeParameters(); if (typeParameters != null) { if (enclosingElement == null) { enclosingElement = createHandle(method, parent); } if (enclosingElement != null) { reportMatching(typeParameters, enclosingElement, parent, method.binding, nodeSet); } } // report annotations if (method.annotations != null) { if (enclosingElement == null) { enclosingElement = createHandle(method, parent); } if (enclosingElement != null) { reportMatching(method.annotations, enclosingElement, null, method.binding, nodeSet, true, true); } } // references in this method if (typeInHierarchy) { ASTNode[] nodes = nodeSet.matchingNodes(method.declarationSourceStart, method.declarationSourceEnd); if (nodes != null) { if ((this.matchContainer & PatternLocator.METHOD_CONTAINER) != 0) { if (enclosingElement == null) { enclosingElement = createHandle(method, parent); } if (encloses(enclosingElement)) { if (this.pattern.mustResolve) { // Visit only if the pattern must resolve MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor( enclosingElement, nodes, nodeSet, this); method.traverse(declarationVisitor, (ClassScope) null); int length = nodes.length; for (int i = 0; i < length; i++) { Integer level = (Integer) nodeSet.matchingNodes.removeKey(nodes[i]); if (level != null) { // ensure that the reference has not been already reported while visiting this.patternLocator.matchReportReference(nodes[i], enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), method.binding, level.intValue(), this); } } } else { for (int i = 0, l = nodes.length; i < l; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); if (level != null) { // ensure that the reference has not been already reported while visiting this.patternLocator.matchReportReference(node, enclosingElement, null, null, method.binding, level.intValue(), this); } } } return; } } // Remove all remaining nodes for (int i = 0, l = nodes.length; i < l; i++) { nodeSet.matchingNodes.removeKey(nodes[i]); } } } }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MatchLocator.java
License:Open Source License
/** * Visit the given field declaration and report the nodes that match exactly the * search pattern (i.e. the ones in the matching nodes set) *//*w ww . j a v a 2 s. c om*/ protected void reportMatching(FieldDeclaration field, FieldDeclaration[] otherFields, TypeDeclaration type, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException { IJavaElement enclosingElement = null; if (accuracy > -1) { enclosingElement = createHandle(field, type, parent); if (encloses(enclosingElement)) { int offset = field.sourceStart; SearchMatch match = newDeclarationMatch(enclosingElement, field.binding, accuracy, offset, field.sourceEnd - offset + 1); if (field.initialization instanceof AllocationExpression) { reportAccurateEnumConstructorReference(match, field, (AllocationExpression) field.initialization); } else { report(match); } } } // handle the nodes for the local type first if ((field.bits & ASTNode.HasLocalType) != 0) { if (enclosingElement == null) { enclosingElement = createHandle(field, type, parent); } // Traverse field declaration(s) to report matches both in local types declaration // and in local variables declaration int fieldEnd = field.endPart2Position == 0 ? field.declarationSourceEnd : field.endPart2Position; ASTNode[] nodes = typeInHierarchy ? nodeSet.matchingNodes(field.sourceStart, fieldEnd) : null; boolean report = (this.matchContainer & PatternLocator.FIELD_CONTAINER) != 0 && encloses(enclosingElement); MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, report ? nodes : null, nodeSet, this); try { field.traverse(declarationVisitor, (MethodScope) null); } catch (WrappedCoreException e) { throw e.coreException; } // Report all nodes and remove them if (nodes != null) { int length = nodes.length; for (int i = 0; i < length; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); if (report && level != null) { if (node instanceof TypeDeclaration) { // use field declaration to report match (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88174) AllocationExpression allocation = ((TypeDeclaration) node).allocation; if (allocation != null && allocation.enumConstant != null) { node = field; } } this.patternLocator.matchReportReference(node, enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), field.binding, level.intValue(), this); } } } } // report annotations IJavaElement[] otherElements = null; if (field.annotations != null) { if (enclosingElement == null) { enclosingElement = createHandle(field, type, parent); } if (otherFields != null) { otherElements = createHandles(otherFields, type, parent); } reportMatching(field.annotations, enclosingElement, otherElements, field.binding, nodeSet, true, true); } if (typeInHierarchy) { // Look at field declaration if (field.endPart1Position != 0) { // not necessary if field is an initializer ASTNode[] nodes = nodeSet.matchingNodes(field.declarationSourceStart, field.endPart1Position); if (nodes != null) { if ((this.matchContainer & PatternLocator.FIELD_CONTAINER) == 0) { for (int i = 0, l = nodes.length; i < l; i++) nodeSet.matchingNodes.removeKey(nodes[i]); } else { if (enclosingElement == null) enclosingElement = createHandle(field, type, parent); if (encloses(enclosingElement)) { for (int i = 0, l = nodes.length; i < l; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); if (otherFields != null && otherElements == null) { otherElements = createHandles(otherFields, type, parent); } this.patternLocator.matchReportReference(node, enclosingElement, null, otherElements, field.binding, level.intValue(), this); } } } } } // Look in initializer int fieldEnd = field.endPart2Position == 0 ? field.declarationSourceEnd : field.endPart2Position; ASTNode[] nodes = nodeSet.matchingNodes(field.sourceStart, fieldEnd); if (nodes != null) { if ((this.matchContainer & PatternLocator.FIELD_CONTAINER) == 0) { for (int i = 0, l = nodes.length; i < l; i++) { nodeSet.matchingNodes.removeKey(nodes[i]); } } else { if (enclosingElement == null) { enclosingElement = createHandle(field, type, parent); } if (encloses(enclosingElement)) { MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, nodes, nodeSet, this); field.traverse(declarationVisitor, (MethodScope) null); int length = nodes.length; for (int i = 0; i < length; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); if (level != null) { // ensure that the reference has not been already reported while visiting if (node instanceof TypeDeclaration) { // use field declaration to report match (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88174) AllocationExpression allocation = ((TypeDeclaration) node).allocation; if (allocation != null && allocation.enumConstant != null) { node = field; } } this.patternLocator.matchReportReference(node, enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), field.binding, level.intValue(), this); } } return; } } } } }
From source file:org.eclipse.ajdt.core.parserbridge.AJSourceElementNotifier.java
License:Open Source License
private void visitIfNeeded(AbstractMethodDeclaration method) { if (this.localDeclarationVisitor != null && (method.bits & ASTNode.HasLocalType) != 0) { if (method instanceof ConstructorDeclaration) { ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) method; if (constructorDeclaration.constructorCall != null) { constructorDeclaration.constructorCall.traverse(this.localDeclarationVisitor, method.scope); }//from w w w .ja v a 2s . com } if (method.statements != null) { int statementsLength = method.statements.length; for (int i = 0; i < statementsLength; i++) method.statements[i].traverse(this.localDeclarationVisitor, method.scope); } } }
From source file:org.eclipse.ajdt.core.parserbridge.AJSourceElementNotifier.java
License:Open Source License
private void visitIfNeeded(FieldDeclaration field, TypeDeclaration declaringType) { if (this.localDeclarationVisitor != null && (field.bits & ASTNode.HasLocalType) != 0) { if (field.initialization != null) { try { this.localDeclarationVisitor.pushDeclaringType(declaringType); field.initialization.traverse(this.localDeclarationVisitor, (MethodScope) null); } finally { this.localDeclarationVisitor.popDeclaringType(); }/*from ww w .j ava2 s . c o m*/ } } }
From source file:org.eclipse.ajdt.core.parserbridge.AJSourceElementNotifier.java
License:Open Source License
private void visitIfNeeded(Initializer initializer) { if (this.localDeclarationVisitor != null && (initializer.bits & ASTNode.HasLocalType) != 0) { if (initializer.block != null) { initializer.block.traverse(this.localDeclarationVisitor, null); }//from ww w . j a va 2s . co m } }
From source file:org.eclipse.che.jdt.internal.core.search.matching.MatchLocator.java
License:Open Source License
/** * Visit the given method declaration and report the nodes that match exactly the * search pattern (i.e. the ones in the matching nodes set) * Note that the method declaration has already been checked. *//*from w ww . j a v a 2s .c o m*/ protected void reportMatching(AbstractMethodDeclaration method, TypeDeclaration type, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException { IJavaElement enclosingElement = null; // report method declaration itself if (accuracy > -1) { enclosingElement = createHandle(method, parent); if (enclosingElement != null) { // skip if unable to find method // compute source positions of the selector Scanner scanner = this.parser.scanner; int nameSourceStart = method.sourceStart; scanner.setSource(this.currentPossibleMatch.getContents()); scanner.resetTo(nameSourceStart, method.sourceEnd); try { scanner.getNextToken(); } catch (InvalidInputException e) { // ignore } if (encloses(enclosingElement)) { SearchMatch match = null; if (method.isDefaultConstructor()) { // Use type for match associated element as default constructor does not exist in source int offset = type.sourceStart; match = this.patternLocator.newDeclarationMatch(type, parent, type.binding, accuracy, type.sourceEnd - offset + 1, this); } else { int length = scanner.currentPosition - nameSourceStart; match = this.patternLocator.newDeclarationMatch(method, enclosingElement, method.binding, accuracy, length, this); } if (match != null) { report(match); } } } } // handle nodes for the local type first if ((method.bits & ASTNode.HasLocalType) != 0) { if (enclosingElement == null) { enclosingElement = createHandle(method, parent); } // Traverse method declaration to report matches both in local types declaration // and in local variables declaration ASTNode[] nodes = typeInHierarchy ? nodeSet.matchingNodes(method.declarationSourceStart, method.declarationSourceEnd) : null; boolean report = (this.matchContainer & PatternLocator.METHOD_CONTAINER) != 0 && encloses(enclosingElement); MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, report ? nodes : null, nodeSet, this, typeInHierarchy); try { method.traverse(declarationVisitor, (ClassScope) null); } catch (WrappedCoreException e) { throw e.coreException; } // Report all nodes and remove them if (nodes != null) { int length = nodes.length; for (int i = 0; i < length; i++) { Integer level = (Integer) nodeSet.matchingNodes.removeKey(nodes[i]); if (report && level != null) { this.patternLocator.matchReportReference(nodes[i], enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), method.binding, level.intValue(), this); } } } } // report the type parameters TypeParameter[] typeParameters = method.typeParameters(); if (typeParameters != null) { if (enclosingElement == null) { enclosingElement = createHandle(method, parent); } if (enclosingElement != null) { reportMatching(typeParameters, enclosingElement, parent, method.binding, nodeSet); } } // report annotations if (method.annotations != null) { if (enclosingElement == null) { enclosingElement = createHandle(method, parent); } if (enclosingElement != null) { reportMatching(method.annotations, enclosingElement, null, method.binding, nodeSet, true, true); } } // references in this method if (typeInHierarchy) { ASTNode[] nodes = nodeSet.matchingNodes(method.declarationSourceStart, method.declarationSourceEnd); if (nodes != null) { if ((this.matchContainer & PatternLocator.METHOD_CONTAINER) != 0) { if (enclosingElement == null) { enclosingElement = createHandle(method, parent); } if (encloses(enclosingElement)) { if (this.pattern.mustResolve) { // Visit only if the pattern must resolve MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor( enclosingElement, nodes, nodeSet, this, typeInHierarchy); method.traverse(declarationVisitor, (ClassScope) null); int length = nodes.length; for (int i = 0; i < length; i++) { Integer level = (Integer) nodeSet.matchingNodes.removeKey(nodes[i]); if (level != null) { // ensure that the reference has not been already reported while visiting this.patternLocator.matchReportReference(nodes[i], enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), method.binding, level.intValue(), this); } } } else { for (int i = 0, l = nodes.length; i < l; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); if (level != null) { // ensure that the reference has not been already reported while visiting this.patternLocator.matchReportReference(node, enclosingElement, null, null, method.binding, level.intValue(), this); } } } return; } } // Remove all remaining nodes for (int i = 0, l = nodes.length; i < l; i++) { nodeSet.matchingNodes.removeKey(nodes[i]); } } } }
From source file:org.eclipse.che.jdt.internal.core.search.matching.MatchLocator.java
License:Open Source License
/** * Visit the given field declaration and report the nodes that match exactly the * search pattern (i.e. the ones in the matching nodes set) *///from w w w . ja v a2s. co m protected void reportMatching(FieldDeclaration field, FieldDeclaration[] otherFields, TypeDeclaration type, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException { IJavaElement enclosingElement = null; if (accuracy > -1) { enclosingElement = createHandle(field, type, parent); if (encloses(enclosingElement)) { int offset = field.sourceStart; SearchMatch match = newDeclarationMatch(enclosingElement, field.binding, accuracy, offset, field.sourceEnd - offset + 1); if (field.initialization instanceof AllocationExpression) { reportAccurateEnumConstructorReference(match, field, (AllocationExpression) field.initialization); } else { report(match); } } } // handle the nodes for the local type first if ((field.bits & ASTNode.HasLocalType) != 0) { if (enclosingElement == null) { enclosingElement = createHandle(field, type, parent); } // Traverse field declaration(s) to report matches both in local types declaration // and in local variables declaration int fieldEnd = field.endPart2Position == 0 ? field.declarationSourceEnd : field.endPart2Position; ASTNode[] nodes = typeInHierarchy ? nodeSet.matchingNodes(field.sourceStart, fieldEnd) : null; boolean report = (this.matchContainer & PatternLocator.FIELD_CONTAINER) != 0 && encloses(enclosingElement); MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, report ? nodes : null, nodeSet, this, typeInHierarchy); try { field.traverse(declarationVisitor, (MethodScope) null); } catch (WrappedCoreException e) { throw e.coreException; } // Report all nodes and remove them if (nodes != null) { int length = nodes.length; for (int i = 0; i < length; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); if (report && level != null) { if (node instanceof TypeDeclaration) { // use field declaration to report match (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88174) AllocationExpression allocation = ((TypeDeclaration) node).allocation; if (allocation != null && allocation.enumConstant != null) { node = field; } } this.patternLocator.matchReportReference(node, enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), field.binding, level.intValue(), this); } } } } // report annotations IJavaElement[] otherElements = null; if (field.annotations != null) { if (enclosingElement == null) { enclosingElement = createHandle(field, type, parent); } if (otherFields != null) { otherElements = createHandles(otherFields, type, parent); } reportMatching(field.annotations, enclosingElement, otherElements, field.binding, nodeSet, true, true); } if (typeInHierarchy) { // Look at field declaration if (field.endPart1Position != 0) { // not necessary if field is an initializer ASTNode[] nodes = nodeSet.matchingNodes(field.declarationSourceStart, field.endPart1Position); if (nodes != null) { if ((this.matchContainer & PatternLocator.FIELD_CONTAINER) == 0) { for (int i = 0, l = nodes.length; i < l; i++) nodeSet.matchingNodes.removeKey(nodes[i]); } else { if (enclosingElement == null) enclosingElement = createHandle(field, type, parent); if (encloses(enclosingElement)) { for (int i = 0, l = nodes.length; i < l; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); if (otherFields != null && otherElements == null) { otherElements = createHandles(otherFields, type, parent); } this.patternLocator.matchReportReference(node, enclosingElement, null, otherElements, field.binding, level.intValue(), this); } } } } } // Look in initializer int fieldEnd = field.endPart2Position == 0 ? field.declarationSourceEnd : field.endPart2Position; ASTNode[] nodes = nodeSet.matchingNodes(field.sourceStart, fieldEnd); if (nodes != null) { if ((this.matchContainer & PatternLocator.FIELD_CONTAINER) == 0) { for (int i = 0, l = nodes.length; i < l; i++) { nodeSet.matchingNodes.removeKey(nodes[i]); } } else { if (enclosingElement == null) { enclosingElement = createHandle(field, type, parent); } if (encloses(enclosingElement)) { MemberDeclarationVisitor declarationVisitor = new MemberDeclarationVisitor(enclosingElement, nodes, nodeSet, this, typeInHierarchy); field.traverse(declarationVisitor, (MethodScope) null); int length = nodes.length; for (int i = 0; i < length; i++) { ASTNode node = nodes[i]; Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); if (level != null) { // ensure that the reference has not been already reported while visiting if (node instanceof TypeDeclaration) { // use field declaration to report match (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88174) AllocationExpression allocation = ((TypeDeclaration) node).allocation; if (allocation != null && allocation.enumConstant != null) { node = field; } } this.patternLocator.matchReportReference(node, enclosingElement, declarationVisitor.getLocalElement(i), declarationVisitor.getOtherElements(i), field.binding, level.intValue(), this); } } return; } } } } }
From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java
License:Open Source License
protected void markEnclosingMemberWithLocalType() { if (this.currentElement != null) return; // this is already done in the recovery code for (int i = this.astPtr; i >= 0; i--) { ASTNode node = this.astStack[i]; if (node instanceof AbstractMethodDeclaration || node instanceof FieldDeclaration || (node instanceof TypeDeclaration // mark type for now: all initializers will be marked when added to this type // and enclosing type must not be closed (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=147485) && ((TypeDeclaration) node).declarationSourceEnd == 0)) { node.bits |= ASTNode.HasLocalType; return; }// ww w . j a v a 2 s . c o m } // default to reference context (case of parse method body) if (this.referenceContext instanceof AbstractMethodDeclaration || this.referenceContext instanceof TypeDeclaration) { ((ASTNode) this.referenceContext).bits |= ASTNode.HasLocalType; } }
From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java
License:Open Source License
public void parse(FieldDeclaration field, TypeDeclaration type, CompilationUnitDeclaration unit, char[] initializationSource) { //only parse the initializationSource of the given field //convert bugs into parse error initialize();/*from ww w . j av a 2s . c om*/ goForExpression(); this.nestedMethod[this.nestedType]++; this.referenceContext = type; this.compilationUnit = unit; this.scanner.setSource(initializationSource); this.scanner.resetTo(0, initializationSource.length - 1); try { parse(); } catch (AbortCompilation ex) { this.lastAct = ERROR_ACTION; } finally { this.nestedMethod[this.nestedType]--; } if (this.lastAct == ERROR_ACTION) { field.bits |= ASTNode.HasSyntaxErrors; return; } field.initialization = this.expressionStack[this.expressionPtr]; // mark field with local type if one was found during parsing if ((type.bits & ASTNode.HasLocalType) != 0) { field.bits |= ASTNode.HasLocalType; } }
From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java
License:Open Source License
public void parse(Initializer initializer, TypeDeclaration type, CompilationUnitDeclaration unit) { //only parse the method body of md //fill out method statements //convert bugs into parse error boolean oldMethodRecoveryActivated = this.methodRecoveryActivated; if (this.options.performMethodsFullRecovery) { this.methodRecoveryActivated = true; }/*from www . java 2s . c om*/ initialize(); goForBlockStatementsopt(); this.nestedMethod[this.nestedType]++; pushOnRealBlockStack(0); this.referenceContext = type; this.compilationUnit = unit; this.scanner.resetTo(initializer.bodyStart, initializer.bodyEnd); // just on the beginning { try { parse(); } catch (AbortCompilation ex) { this.lastAct = ERROR_ACTION; } finally { this.nestedMethod[this.nestedType]--; if (this.options.performStatementsRecovery) { this.methodRecoveryActivated = oldMethodRecoveryActivated; } } checkNonNLSAfterBodyEnd(initializer.declarationSourceEnd); if (this.lastAct == ERROR_ACTION) { initializer.bits |= ASTNode.HasSyntaxErrors; return; } //refill statements initializer.block.explicitDeclarations = this.realBlockStack[this.realBlockPtr--]; int length; if (this.astLengthPtr > -1 && (length = this.astLengthStack[this.astLengthPtr--]) > 0) { System.arraycopy(this.astStack, (this.astPtr -= length) + 1, initializer.block.statements = new Statement[length], 0, length); } else { // check whether this block at least contains some comment in it if (!containsComment(initializer.block.sourceStart, initializer.block.sourceEnd)) { initializer.block.bits |= ASTNode.UndocumentedEmptyBlock; } } // mark initializer with local type if one was found during parsing if ((type.bits & ASTNode.HasLocalType) != 0) { initializer.bits |= ASTNode.HasLocalType; } }