Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thomann2019-02-07 14:37:21 +0000
committerJay Arthanareeswaran2019-02-07 15:08:22 +0000
commit2a504ee503ea1288959c8ff005b9e06e8300fea2 (patch)
tree5720d46c770e02c06ee8f1ce6b2f43848d334641
parentf7b7264efd96a9b892819e046d340c8667b196d2 (diff)
downloadeclipse.jdt.core-2a504ee503ea1288959c8ff005b9e06e8300fea2.tar.gz
eclipse.jdt.core-2a504ee503ea1288959c8ff005b9e06e8300fea2.tar.xz
eclipse.jdt.core-2a504ee503ea1288959c8ff005b9e06e8300fea2.zip
Bug 544159 - [12] Support for Unicode 11
Change-Id: I24171d81e08574f4f0eb394467d77b5fb96ed599 Signed-off-by: Olivier Thomann <Olivier_Thomann@ca.ibm.com>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode11Test.java69
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java21
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part0.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part1.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part14.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part2.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start0.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start1.rscbin0 -> 8192 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start2.rscbin0 -> 8192 bytes
10 files changed, 90 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
index 075b3060c8..69bfe88e8e 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
@@ -176,6 +176,7 @@ public static Test suite() {
// add 10 specific test here (check duplicates)
ArrayList since_10 = new ArrayList();
since_10.add(JEP286Test.class);
+ since_10.add(Unicode10Test.class);
// add 11 specific test here (check duplicates)
ArrayList since_11 = new ArrayList();
@@ -185,6 +186,7 @@ public static Test suite() {
// add 12 specific test here (check duplicates)
ArrayList since_12 = new ArrayList();
since_12.add(SwitchExpressionTest.class);
+ since_12.add(Unicode11Test.class);
// Build final test suite
TestSuite all = new TestSuite(TestAll.class.getName());
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode11Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode11Test.java
new file mode 100644
index 0000000000..878286b8a3
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode11Test.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2019 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * 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
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import java.util.Map;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+public class Unicode11Test extends AbstractRegressionTest {
+public Unicode11Test(String name) {
+ super(name);
+}
+public static Test suite() {
+ return buildMinimalComplianceTestSuite(testClass(), F_12);
+}
+public void test1() {
+ Map<String, String> options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_12);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public int a\u0560; // new unicode character in unicode 11.0 \n" +
+ "}",
+ },
+ "",
+ options);
+}
+public void test2() {
+ Map<String, String> options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_11);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public int a\\u0560; // new unicode character in unicode 11.0 \n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public int a\\u0560; // new unicode character in unicode 11.0 \n" +
+ " ^^^^^^\n" +
+ "Syntax error on token \"Invalid Character\", delete this token\n" +
+ "----------\n",
+ null,
+ true,
+ options);
+}
+public static Class<Unicode11Test> testClass() {
+ return Unicode11Test.class;
+}
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
index c9bf5ce3bc..d20a4d224c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
@@ -47,6 +47,7 @@ public class ScannerHelper {
private static long[][][] Tables8;
private static long[][][] Tables9;
private static long[][][] Tables11;
+ private static long[][][] Tables12;
public final static int MAX_OBVIOUS = 128;
public final static int[] OBVIOUS_IDENT_CHAR_NATURES = new int[MAX_OBVIOUS];
@@ -151,6 +152,9 @@ static void initializeTable19() {
static void initializeTableJava11() {
Tables11 = initializeTables("unicode10"); //$NON-NLS-1$
}
+static void initializeTableJava12() {
+ Tables12 = initializeTables("unicode11"); //$NON-NLS-1$
+}
static long[][][] initializeTables(String unicode_path) {
long[][][] tempTable = new long[2][][];
tempTable[START_INDEX] = new long[3][];
@@ -290,12 +294,18 @@ public static boolean isJavaIdentifierPart(long complianceLevel, int codePoint)
initializeTable19();
}
return isJavaIdentifierPart0(codePoint, Tables9);
- } else {
+ } else if (complianceLevel <= ClassFileConstants.JDK11) {
// java 11 supports Unicode 10
if (Tables11 == null) {
initializeTableJava11();
}
return isJavaIdentifierPart0(codePoint, Tables11);
+ } else {
+ // java 12 supports Unicode 11
+ if (Tables12 == null) {
+ initializeTableJava12();
+ }
+ return isJavaIdentifierPart0(codePoint, Tables12);
}
}
public static boolean isJavaIdentifierPart(long complianceLevel, char high, char low) {
@@ -351,12 +361,19 @@ public static boolean isJavaIdentifierStart(long complianceLevel, int codePoint)
initializeTable19();
}
return isJavaIdentifierStart0(codePoint, Tables9);
- } else {
+ } else if (complianceLevel <= ClassFileConstants.JDK11) {
// java 11 supports Unicode 10
if (Tables11 == null) {
initializeTableJava11();
}
return isJavaIdentifierStart0(codePoint, Tables11);
+ } else {
+
+ // java 12 supports Unicode 11
+ if (Tables12 == null) {
+ initializeTableJava12();
+ }
+ return isJavaIdentifierStart0(codePoint, Tables12);
}
}
private static int toCodePoint(char high, char low) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part0.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part0.rsc
new file mode 100644
index 0000000000..f434660ef0
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part0.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part1.rsc
new file mode 100644
index 0000000000..abb590ba3d
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part14.rsc
new file mode 100644
index 0000000000..c8241e80d5
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part14.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part2.rsc
new file mode 100644
index 0000000000..ab6b33ed48
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part2.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start0.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start0.rsc
new file mode 100644
index 0000000000..1cd786208c
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start0.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start1.rsc
new file mode 100644
index 0000000000..2ca6b51f99
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start2.rsc
new file mode 100644
index 0000000000..ab6b33ed48
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start2.rsc
Binary files differ

Back to the top