Update Java reserved words to JLS9 18/69318/7
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 9 Mar 2018 15:59:52 +0000 (16:59 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 12 Mar 2018 10:21:09 +0000 (11:21 +0100)
This updates the mapping table to reflect the fact that "_" is not
a valid identifier in Java 9.

JIRA: MDSAL-318
Change-Id: Ia8f11868e7f244be0018dae38538d7800313af31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/BindingMapping.java
binding/yang-binding/src/test/java/org/opendaylight/yangtools/yang/binding/BindingMappingTest.java

index 133ae4c1c5411aa8212989a1eb304f544e605d7c..919d76530663e999ac239ec50ac50deca4f2af4a 100644 (file)
@@ -36,9 +36,7 @@ public final class BindingMapping {
         "default", "do", "double", "else", "enum", "extends", "final", "finally", "float", "for", "goto", "if",
         "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "package", "private",
         "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this",
-        "throw", "throws", "transient", "try", "void", "volatile", "while",
-        // FIXME: _ is excluded to retain compatibility with previous releases
-        // "_",
+        "throw", "throws", "transient", "try", "void", "volatile", "while", "_",
         // https://docs.oracle.com/javase/specs/jls/se9/html/jls-3.html#jls-3.10.3
         "false", "true",
         // https://docs.oracle.com/javase/specs/jls/se9/html/jls-3.html#jls-3.10.7
@@ -317,7 +315,7 @@ public final class BindingMapping {
     }
 
     /**
-     * Returns Java identifiers, conforming to JLS8 Section 3.8 to use for specified YANG assigned names
+     * Returns Java identifiers, conforming to JLS9 Section 3.8 to use for specified YANG assigned names
      * (RFC7950 Section 9.6.4). This method considers two distinct encodings: one the pre-Fluorine mapping, which is
      * okay and convenient for sane strings, and an escaping-based bijective mapping which works for all possible
      * Unicode strings.
index 3b6a21d8c1daad9574134425f0a3e35b480bd433..2542dfc2e1e44fd23bc51064b48ff9e55e060001 100644 (file)
@@ -80,7 +80,7 @@ public class BindingMappingTest {
         assertEqualMapping(of("AZ", "_09"), of("a-z", "0-9"));
 
         // Invalid identifier (conflicts with a Java 9 keyword)
-        assertEqualMapping("_", "_");
+        assertEqualMapping("$_", "_");
 
         // Invalid characters, fall back to bijection
         assertEqualMapping("$$2A$", "*");