This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 65b5709e86241b0220876f427bf5d5150c1a1c54
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jan 17 11:59:45 2025 +0000

    As of the JLS for Java 9, "_" is also a reserved keyword
---
 java/org/apache/el/util/Validation.java | 9 ++++++---
 webapps/docs/changelog.xml              | 5 +++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/el/util/Validation.java 
b/java/org/apache/el/util/Validation.java
index b9c60df265..dbb185d3c6 100644
--- a/java/org/apache/el/util/Validation.java
+++ b/java/org/apache/el/util/Validation.java
@@ -18,13 +18,16 @@ package org.apache.el.util;
 
 public class Validation {
 
-    // Java keywords, boolean literals & the null literal in alphabetical order
-    private static final String invalidIdentifiers[] = { "abstract", "assert", 
"boolean", "break", "byte", "case",
+    /*
+     * Java keywords, boolean literals & the null literal in alphabetical 
order. As per the Java Language Specification,
+     * none of these are permitted to be used as an identifier.
+     */
+    private static final String invalidIdentifiers[] = { "_", "abstract", 
"assert", "boolean", "break", "byte", "case",
             "catch", "char", "class", "const", "continue", "default", "do", 
"double", "else", "enum", "extends",
             "false", "final", "finally", "float", "for", "goto", "if", 
"implements", "import", "instanceof", "int",
             "interface", "long", "native", "new", "null", "package", 
"private", "protected", "public", "return",
             "short", "static", "strictfp", "super", "switch", "synchronized", 
"this", "throw", "throws", "transient",
-            "true", "try", "void", "volatile", "while" };
+            "true", "try", "void", "volatile", "while"};
 
     private static final boolean SKIP_IDENTIFIER_CHECK =
             Boolean.getBoolean("org.apache.el.parser.SKIP_IDENTIFIER_CHECK");
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e992e700e0..1658e21e64 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -239,6 +239,11 @@
         contained parameters. Pull request <pr>803</pr> provided by Chenjp.
         (markt)
       </fix>
+      <fix>
+        Update the identifier validation in the Expression Language parser to
+        reflect that, as of Java 9, <code>_</code> is also a Java keyword and
+        may not be used as an identifier. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to