Skip to content

Switch to SourceVersion.isKeyword() #2735

Closed

Description

@otbutz

// copied from janino
private static final Set<String> KEYWORDS = new HashSet<>(Arrays.asList(
"first_match",
"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", "non-sealed", "null",
"package", "permits", "private", "protected", "public",
"record", "return",
"sealed", "short", "static", "strictfp", "super", "switch", "synchronized",
"this", "throw", "throws", "transient", "true", "try",
"var", "void", "volatile",
"while",
"yield",
"_"
));

(what's up with first_match ?)

https://docs.oracle.com/javase/8/docs/api/javax/lang/model/SourceVersion.html#isKeyword-java.lang.CharSequence-

This avoids having to curate a list of Java keywords and instead uses the information provided by the standard library.

Activity

  1. karussell commented on Jan 27, 2023

    @karussell
    Member

    Cool 👍

    (what's up with first_match ?)

    Ah, yes, we can avoid it. It was a keyword in the "language" before janino.

  2. added this to the 7.0 milestone on Jan 27, 2023
  3. added a commit that references this issue on Mar 21, 2023
    084133a
  4. added a commit that references this issue on Jun 21, 2023
    b3825b7
  5. added a commit that references this issue on Oct 27, 2023
    7a0960e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions