Bug 563004 - [parser][14] Parse compact record constructor with kind
K_CLASS_BODY_DECLARATIONS
Reverting the addition of new K_RECORD_BODY_DECLARATIONS
Change-Id: Idee76ed6b3954522c390811494d932ac3740a735
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/180956
Reviewed-by: Manoj Palat <manpalat@in.ibm.com>
Reviewed-by: Sarika Sinha <sarika.sinha@in.ibm.com>
Tested-by: JDT Bot <jdt-bot@eclipse.org>
Tested-by: Sarika Sinha <sarika.sinha@in.ibm.com>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
index 094bba4..b4ab2dd 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
@@ -13283,6 +13283,6 @@
formatSource(source,
"public Record {\n" +
"}",
- CodeFormatter.K_RECORD_BODY_DECLARATIONS);
+ CodeFormatter.K_CLASS_BODY_DECLARATIONS);
}
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
index ad1cafc..bf3d8f8 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
@@ -124,13 +124,6 @@
public static final int K_COMPILATION_UNIT = 0x08;
/**
- * Kind constant used to request that the source be parsed
- * as a compilation unit.
- * @since 3.26
- */
- public static final int K_RECORD_BODY_DECLARATIONS = 0x16;
-
- /**
* Creates a new object for creating a Java abstract syntax tree
* (AST) following the specified set of API rules.
*
@@ -1452,39 +1445,6 @@
ast.setOriginalModificationCount(ast.modificationCount());
return compilationUnit;
}
- case K_RECORD_BODY_DECLARATIONS:
- final org.eclipse.jdt.internal.compiler.ast.ASTNode[] recordNodes =
- codeSnippetParsingUtil.parseClassBodyDeclarations(
- this.rawSource,
- this.sourceOffset,
- this.sourceLength,
- this.compilerOptions,
- true,
- (this.bits & CompilationUnitResolver.STATEMENT_RECOVERY) != 0);
- recordedParsingInformation = codeSnippetParsingUtil.recordedParsingInformation;
- comments = recordedParsingInformation.commentPositions;
- if (comments != null) {
- converter.buildCommentsTable(compilationUnit, comments);
- }
- compilationUnit.setLineEndTable(recordedParsingInformation.lineEnds);
- if (recordNodes != null) {
- // source has no syntax error or the statement recovery is enabled
- RecordDeclaration recordDeclaration = converter.convertToRecord(recordNodes);
- recordDeclaration.setSourceRange(this.sourceOffset, this.sourceOffset + this.sourceLength);
- rootNodeToCompilationUnit(recordDeclaration.getAST(), compilationUnit, recordDeclaration, codeSnippetParsingUtil.recordedParsingInformation, null);
- ast.setDefaultNodeFlag(0);
- ast.setOriginalModificationCount(ast.modificationCount());
- return recordDeclaration;
- } else {
- // source has syntax error and the statement recovery is disabled
- CategorizedProblem[] problems = recordedParsingInformation.problems;
- if (problems != null) {
- compilationUnit.setProblems(problems);
- }
- ast.setDefaultNodeFlag(0);
- ast.setOriginalModificationCount(ast.modificationCount());
- return compilationUnit;
- }
}
throw new IllegalStateException();
}
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatter.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatter.java
index 82cd9da..bccfa86 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatter.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatter.java
@@ -100,17 +100,6 @@
public static final int K_COMPILATION_UNIT = 0x08;
/**
- * Kind used to format a set of class body declarations
- *<p>
- * if the corresponding comment option is set to
- * <code>true</code> then it is also possible to format the comments on the fly
- * by adding the {@link #F_INCLUDE_COMMENTS} flag to this kind of format.
- * </p>
- * @since 3.26
- */
- public static final int K_RECORD_BODY_DECLARATIONS = 0x16;
-
- /**
* Kind used to format a single-line comment
* @since 3.1
*/