Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java188
-rw-r--r--org.eclipse.jdt.core/.settings/.api_filters7
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java20
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java13
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties6
7 files changed, 100 insertions, 141 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
index 064aa6ef83..9d6c10ac14 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
@@ -1199,6 +1199,7 @@ public void test011_problem_categories() {
expectedProblemAttributes.put("PreviewFeatureUsed", new ProblemAttributes(CategorizedProblem.CAT_COMPLIANCE));
expectedProblemAttributes.put("PreviewFeatureNotSupported", new ProblemAttributes(CategorizedProblem.CAT_COMPLIANCE));
expectedProblemAttributes.put("PreviewFeaturesNotAllowed", new ProblemAttributes(CategorizedProblem.CAT_PREVIEW_RELATED));
+ expectedProblemAttributes.put("FeatureNotSupported", new ProblemAttributes(CategorizedProblem.CAT_COMPLIANCE));
expectedProblemAttributes.put("SwitchExpressionsYieldIncompatibleResultExpressionTypes", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("SwitchExpressionsYieldEmptySwitchBlock", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
expectedProblemAttributes.put("SwitchExpressionsYieldNoResultExpression", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
@@ -2221,6 +2222,7 @@ public void test012_compiler_problems_tuning() {
expectedProblemAttributes.put("PreviewFeatureUsed", SKIP);
expectedProblemAttributes.put("PreviewFeatureNotSupported", SKIP);
expectedProblemAttributes.put("PreviewFeaturesNotAllowed", SKIP);
+ expectedProblemAttributes.put("FeatureNotSupported", SKIP);
expectedProblemAttributes.put("SwitchExpressionsYieldIncompatibleResultExpressionTypes", SKIP);
expectedProblemAttributes.put("SwitchExpressionsYieldEmptySwitchBlock", SKIP);
expectedProblemAttributes.put("SwitchExpressionsYieldNoResultExpression", SKIP);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
index 79f463143d..ffced9e1cf 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
@@ -7,6 +7,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -41,7 +45,7 @@ public class TextBlockTest extends AbstractRegressionTest {
return TextBlockTest.class;
}
public static Test suite() {
- return buildMinimalComplianceTestSuite(testClass(), F_14);
+ return buildMinimalComplianceTestSuite(testClass(), F_15);
}
public TextBlockTest(String testName){
super(testName);
@@ -52,10 +56,10 @@ public class TextBlockTest extends AbstractRegressionTest {
// Enables the tests to run individually
protected Map<String, String> getCompilerOptions(boolean previewFlag) {
Map<String, String> defaultOptions = super.getCompilerOptions();
- defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14);
- defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
+ defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_15);
+ defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_15);
defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
- defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, previewFlag ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
+ defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, previewFlag ? CompilerOptions.DISABLED : CompilerOptions.DISABLED);
defaultOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
return defaultOptions;
}
@@ -176,8 +180,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - escaped '\'
@@ -196,8 +199,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"abc\\def",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* Positive - Multi line text block with varying indentation
@@ -222,8 +224,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" line 2\n" +
"\n" +
"line 3",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* Positive - Multi line text block with varying indentation
@@ -248,8 +249,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" line 2\n" +
"\n" +
"line 3", // the trailing whitespace is trimmed by the test framework
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* Positive - Multi line text block with varying indentation
@@ -277,8 +277,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"\n" +
" line 3\n" +
">", // the trailing whitespace is trimmed by the test framework
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using unescaped '"' in text block
@@ -297,8 +296,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"\"abc-def",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using escaped '"' in text block
@@ -316,8 +314,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"\"abc-def\"",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using escaped \ and escaped " in text block
@@ -335,8 +332,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"\"abc\"\"\"def",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using Unicode in text block
@@ -356,8 +352,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"true",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - bigger piece of code as text block
@@ -380,8 +375,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"public void print(Object o) {\n" +
" System.out.println(Objects.toString(o));\n" +
"}",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - concatenation of string with text block
@@ -404,8 +398,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"public void print(Object o) {\n" +
" System.out.println(Objects.toString(o));\n" +
"}",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - freely using quotes
@@ -435,8 +428,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"can make words mean so many different things.\"\n" +
"\"The question is,\" said Humpty Dumpty,\n" +
"\"which is to be master - that's all.",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - html code with indentation
@@ -462,8 +454,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - html code with indentation with empty lines
@@ -490,8 +481,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
" </html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - html code with indentation with \r as terminator
@@ -518,8 +508,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - html code with indentation and trailing whitespace
@@ -546,8 +535,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using octal escape char for trailing whitespace
@@ -573,8 +561,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p> \n" +
" </body> \n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using text block as a method argument
@@ -600,8 +587,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
" </html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - using variable assigned with text block as a method argument
@@ -628,8 +614,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
/*
* positive - assigning strings and text blocks interchangeably.
@@ -657,8 +642,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>",
- null,
- new String[] {"--enable-preview"});
+ null);
}
public void test024() {
runConformTest(
@@ -697,8 +681,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" System.out.println(textb);\n" +
" }\n" +
"}",
- null,
- new String[] {"--enable-preview"});
+ null);
}
public void test025() {
runNegativeTest(
@@ -763,8 +746,7 @@ public class TextBlockTest extends AbstractRegressionTest {
" bar(MyDay.SUNDAY);\n" +
" }\n" +
" }",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// An empty text block
public void test028() {
@@ -781,8 +763,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// An empty text block
public void test029() {
@@ -801,32 +782,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"Hello Guru", // output comparison tool strips off all trailing whitespace
- getCompilerOptions(),
- new String[] {"--enable-preview"});
- }
- public void testBug550356() {
- Map<String, String> options = getCompilerOptions(false);
- runNegativeTest(
- new String[] {
- "X.java",
- "public class X {\n" +
- " public static String textb = \"\"\"\n" +
- "\"\"\";\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println(textb);\n" +
- " }\n" +
- "}\n"
- },
- "----------\n" +
- "1. ERROR in X.java (at line 2)\n" +
- " public static String textb = \"\"\"\n" +
- "\"\"\";\n" +
- " ^^^^^^^\n" +
- "Text Blocks is a preview feature and disabled by default. Use --enable-preview to enable\n" +
- "----------\n",
- null,
- true,
- options);
+ getCompilerOptions());
}
public void testBug551948_1() {
runConformTest(
@@ -845,8 +801,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", // output comparison tool strips off all trailing whitespace
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_2() {
runConformTest(
@@ -864,8 +819,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"abc\n defghi",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_3() {
runConformTest(
@@ -884,8 +838,7 @@ public class TextBlockTest extends AbstractRegressionTest {
},
"if x == True and \\\n" +
" y == False",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_4() {
runConformTest(
@@ -904,8 +857,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"red green blue orange",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_5() {
runNegativeTest(
@@ -948,8 +900,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"A line with spaces",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_7() {
runConformTest(
@@ -968,8 +919,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"red \ngreen \nblue", // trailing whitespaces are trimmed
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug551948_8() {
runConformTest(
@@ -993,8 +943,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"aaa\n\n" +
"bbb\n\n\n" +
"ccc",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_1() {
runConformTest(
@@ -1016,8 +965,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_2() {
runConformTest(
@@ -1040,8 +988,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_3() {
runConformTest(
@@ -1064,8 +1011,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_4() {
runConformTest(
@@ -1094,8 +1040,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_5() {
runConformTest(
@@ -1118,8 +1063,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"false",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_6() {
runConformTest(
@@ -1141,8 +1085,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_7() {
runConformTest(
@@ -1164,8 +1107,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_8() {
runConformTest(
@@ -1181,8 +1123,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"26",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// Escaped """ with escaping at the first '"'
public void testCompliances_9() {
@@ -1199,8 +1140,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"26",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// Escaped """ with escaping at the second '"'
public void testCompliances_10() {
@@ -1217,8 +1157,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"26",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
// Escaped """ with escaping at the third '"'
public void testCompliances_11() {
@@ -1235,8 +1174,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"26",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_12() {
runConformTest(
@@ -1258,8 +1196,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_13() {
runConformTest(
@@ -1280,8 +1217,7 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"256",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testCompliances_14() {
runConformTest(
@@ -1305,17 +1241,14 @@ public class TextBlockTest extends AbstractRegressionTest {
"}"
},
"true",
- getCompilerOptions(),
- new String[] {"--enable-preview"});
+ getCompilerOptions());
}
public void testBug553252() {
Map<String, String> defaultOptions = super.getCompilerOptions();
Map<String, String> copy = new HashMap<String, String>(defaultOptions);
- copy.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_13);
- copy.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_13);
- copy.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_13);
- copy.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
- copy.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
+ copy.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_14);
+ copy.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_14);
+ copy.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_14);
runNegativeTest(
new String[] {
"X.java",
@@ -1328,10 +1261,11 @@ public class TextBlockTest extends AbstractRegressionTest {
"}\n"
},
"----------\n" +
- "1. ERROR in X.java (at line 0)\n" +
- " public class X {\n" +
- " ^\n" +
- "Preview features enabled at an invalid source release level 13, preview can be enabled only at source level 14\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public static String textb = \"\"\"\n" +
+ "\"\"\";\n" +
+ " ^^^^^^^\n" +
+ "The Java feature \'Text Blocks\' is only available with source level 15 and above\n" +
"----------\n",
null,
true,
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters
index 4ddad2dc09..b69fcb4bbd 100644
--- a/org.eclipse.jdt.core/.settings/.api_filters
+++ b/org.eclipse.jdt.core/.settings/.api_filters
@@ -142,6 +142,13 @@
<message_argument value="2098858"/>
</message_arguments>
</filter>
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="3.23 BETA_JAVA15"/>
+ <message_argument value="3.22 BETA_JAVA15"/>
+ <message_argument value="FeatureNotSupported"/>
+ </message_arguments>
+ </filter>
</resource>
<resource path="dom/org/eclipse/jdt/core/dom/InstanceofExpression.java" type="org.eclipse.jdt.core.dom.InstanceofExpression">
<filter comment="For Java 14" id="336658481">
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
index 6eb059540e..2fac78d2f5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
@@ -776,8 +776,7 @@ void setSourceStart(int sourceStart);
/** @since 3.10 */
int MissingTypeInLambda = MethodRelated + 271;
- /** @since 3.20
- * @noreference preview related error */
+ /** @since 3.23 BETA_JAVA 15 */
int UnterminatedTextBlock = PreviewRelated + 272;
// type related problems
/** @since 3.1 */
@@ -2107,6 +2106,8 @@ void setSourceStart(int sourceStart);
int PreviewFeatureNotSupported = Compliance + 1105;
/** @since 3.20*/
int PreviewFeaturesNotAllowed = PreviewRelated + 1106;
+ /** @since 3.23 BETA_JAVA15 */
+ int FeatureNotSupported = Compliance + 1107;
/** @since 3.13 */
int UnlikelyCollectionMethodArgumentType = 1200;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index 653e39dd13..810b74b5a2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Tom Tromey - patch for readTable(String) as described in http://bugs.eclipse.org/bugs/show_bug.cgi?id=32196
@@ -965,6 +969,7 @@ private int stateStackLengthStack[] = new int[0];
protected boolean parsingJava8Plus;
protected boolean parsingJava9Plus;
protected boolean parsingJava14Plus;
+protected boolean parsingJava15Plus;
protected boolean parsingJava11Plus;
protected int unstackedAct = ERROR_ACTION;
private boolean haltOnSyntaxError = false;
@@ -986,8 +991,9 @@ public Parser(ProblemReporter problemReporter, boolean optimizeStringLiterals) {
initializeScanner();
this.parsingJava8Plus = this.options.sourceLevel >= ClassFileConstants.JDK1_8;
this.parsingJava9Plus = this.options.sourceLevel >= ClassFileConstants.JDK9;
- this.parsingJava14Plus = this.options.sourceLevel >= ClassFileConstants.JDK14;
this.parsingJava11Plus = this.options.sourceLevel >= ClassFileConstants.JDK11;
+ this.parsingJava14Plus = this.options.sourceLevel >= ClassFileConstants.JDK14;
+ this.parsingJava15Plus = this.options.sourceLevel >= ClassFileConstants.JDK15;
this.astLengthStack = new int[50];
this.patternLengthStack = new int[20];
this.expressionLengthStack = new int[30];
@@ -9765,14 +9771,8 @@ protected void consumeStaticOnly() {
}
}
protected void consumeTextBlock() {
- if (!this.parsingJava14Plus) {
- problemReporter().previewFeatureNotSupported(this.scanner.startPosition, this.scanner.currentPosition - 1, "Text Blocks", CompilerOptions.VERSION_14); //$NON-NLS-1$
- } else if (!this.options.enablePreviewFeatures){
- problemReporter().previewFeatureNotEnabled(this.scanner.startPosition, this.scanner.currentPosition - 1, "Text Blocks"); //$NON-NLS-1$
- } else {
- if (this.options.isAnyEnabled(IrritantSet.PREVIEW)) {
- problemReporter().previewFeatureUsed(this.scanner.startPosition, this.scanner.currentPosition - 1);
- }
+ if (!this.parsingJava15Plus) {
+ problemReporter().featureNotSupported(this.scanner.startPosition, this.scanner.currentPosition - 1, "Text Blocks", CompilerOptions.VERSION_15); //$NON-NLS-1$
}
char[] textBlock2 = this.scanner.getCurrentTextBlock();
TextBlock textBlock;
@@ -9787,8 +9787,6 @@ protected void consumeTextBlock() {
this.scanner.startPosition,
this.scanner.currentPosition - 1,
Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr));
- // TODO
- //this.compilationUnit.recordStringLiteral(stringLiteral, this.currentElement != null);
} else {
textBlock = new TextBlock(
textBlock2,
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index d9ae777e4b..2d7d82efb3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Benjamin Muskalla - Contribution for bug 239066
@@ -9530,6 +9534,15 @@ public void previewFeatureNotSupported(int sourceStart, int sourceEnd, String fe
sourceStart,
sourceEnd);
}
+public void featureNotSupported(int sourceStart, int sourceEnd, String featureName, String sourceLevel) {
+ String[] args = new String[] {featureName, sourceLevel};
+ this.handle(
+ IProblem.FeatureNotSupported,
+ args,
+ args,
+ sourceStart,
+ sourceEnd);
+}
public void useAssertAsAnIdentifier(int sourceStart, int sourceEnd) {
this.handle(
IProblem.UseAssertAsAnIdentifier,
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
index 76ac8be9d2..467ad2997f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
@@ -8,6 +8,10 @@
#
# SPDX-License-Identifier: EPL-2.0
#
+# This is an implementation of an early-draft specification developed under the Java
+# Community Process (JCP) and is made available for testing and evaluation purposes
+# only. The code is not compatible with any specification of the JCP.
+#
# Contributors:
# IBM Corporation - initial API and implementation
# Benjamin Muskalla - Contribution for bug 239066
@@ -890,7 +894,7 @@
1104 = You are using a preview language feature that may or may not be supported in a future release
1105 = The preview feature {0} is only available with source level {1} and above
1106 = Preview features enabled at an invalid source release level {0}, preview can be enabled only at source level {1}
-
+1107 = The Java feature ''{0}'' is only available with source level {1} and above
# more programming problems:
1200 = Unlikely argument type {0} for {1} on a {2}
1201 = Unlikely argument type for equals(): {0} seems to be unrelated to {2}

Back to the top