Skip to content

Java grammar: volatile/strictfp, empty enum bodies, comma-separated for-updates - #163

Merged
prozak merged 1 commit into
masterfrom
claude/java-grammar-quick-wins
Jul 3, 2026
Merged

Java grammar: volatile/strictfp, empty enum bodies, comma-separated for-updates#163
prozak merged 1 commit into
masterfrom
claude/java-grammar-quick-wins

Conversation

@prozak

@prozak prozak commented Jul 3, 2026

Copy link
Copy Markdown
Owner

The #139+#140+#141 bundle from umbrella #21 — three one-rule java.pg changes
in one PR so the token-renumbering golden churn is reviewed once.

Changes

  • Modifier gains 'volatile' and 'strictfp' (JLS 8.3.1.4, 8.1.1.3).
    Reserved words, so promoting them from id costs nothing; like every
    modifier they only ever extend a ModifierList (same argument as
    default in PR Add support for Phase 4g Java language features #132). Closes Java grammar: 'volatile' and 'strictfp' modifiers #139.
  • EnumDeclaration's constant list becomes optional (JLS 8.9):
    enum E { } and the declarations-only enum F { ; void m() { } } parse.
    The empty-list reduce fires only on ;/}, disjoint from constant
    starters. Documented tolerance gap: the bare-comma body { , } stays a
    parse error (the trailing comma lives inside EnumConstantList).
    Closes Java grammar: empty enum bodies (enum E { }) #140.
  • The classic for's update slot becomes ForUpdateList?, an optional
    comma-separated expression list (JLS 14.14.1). return and the condition
    slot keep plain OptExpression; the init slot deliberately stays a single
    expression (Type-vs-Expression region). The , continuation is a fresh
    shift — only ) follows a complete update expression today. Closes Java grammar: comma-separated for-update lists (i++, pos++) #141.

Verification (PR #132 protocol)

  • Conflict delta: zero — happy reports 13 shift/reduce, 0 reduce/reduce
    (and 2 unused terminals) before and after; inventory header updated.
  • Goldens: only test/golden/java/* churned; diff is the two new Modifier
    constructors, the ForUpdateList rule + antiquote support, and pure
    Tk__/Ctr__ renumbering. Both cabal suites pass (incl. dual-front-end
    AST equality).
  • Probes test-volatile-strictfp / test-empty-enum / test-for-update-list
    wired into make test-all-java — 41/41 pass. make test-java-qq green
    (the ForStatement shape change has no QQ fallout).
  • Lexical token goldens unchanged (make test-lex-java 6/6 without accept —
    the lexical corpus contains no volatile/strictfp).
  • Commons-lang corpus: 9 files off the parse blacklists — main 27→22
    (232→237 passing), tests 18→14 (249→253); make test-parse-commons-lang-all
    and make test-lex-commons-lang-all at 0 failures. The two affected
    holdouts fail on their next already-filed gap and stay listed:
    StrBuilder.javachar[]::new (Java grammar: array class literals (String[].class) and array-constructor method references (TimeUnit[]::new) #142), FastDateParserTest.java
    multi-param lambda under a cast (Java grammar: lambda directly under a cast ((Predicate<T>) t -> ...) #145).

Ticks the first three boxes in #21.

🤖 Generated with Claude Code

…or-updates

Three one-rule java.pg gaps bundled into one PR to pay the token-renumbering
golden churn once (as #139 suggests). Conflict delta is ZERO: happy reports
13 shift/reduce, 0 reduce/reduce before and after; each rule carries its
conflict argument and the inventory header records the batch.

- Modifier gains 'volatile' (JLS 8.3.1.4) and 'strictfp' (JLS 8.1.1.3):
  reserved words, and like every modifier they only extend a ModifierList
  (closes #139)
- EnumDeclaration's constant list becomes optional (JLS 8.9): 'enum E { }'
  and the declarations-only 'enum F { ; void m() { } }' now parse; the
  bare-comma body '{ , }' stays a tolerated parse error (closes #140)
- The classic for's update slot becomes ForUpdateList, an optional
  comma-separated expression list (JLS 14.14.1); return and the condition
  slot keep plain OptExpression, and the init slot deliberately stays
  single (Type-vs-Expression region) (closes #141)

Probes test-volatile-strictfp/test-empty-enum/test-for-update-list wired
into make test-all-java (41/41 pass). Lexical token goldens unchanged (the
lexical corpus has no volatile/strictfp). Commons-lang corpus: 9 files come
off the parse blacklists (main 27->22, 232->237 passing; tests 18->14,
249->253), all suites 0 failures. The two affected holdouts moved to their
next already-filed gap: StrBuilder to char[]::new (#142), FastDateParserTest
to a multi-param lambda under a cast (#145).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@prozak
prozak merged commit f9f71a7 into master Jul 3, 2026
8 checks passed
@prozak
prozak deleted the claude/java-grammar-quick-wins branch July 3, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant