Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fix(groovy): enum body with a constructor fails to parse

Open Beginner friendly
#1,408 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
Under an hour
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
tooling

Research direction

Look for existing ERROR-probe regression fixtures in the test directory, following the pattern of similar JVM language fixtures. Add a new fixture using the enum constructor example from the issue, ensuring the test harness detects the parse error. Run the test suite to confirm the fixture integrates correctly.

Written by the indexing model from the issue text.

Description

bug

Summary

dekobon-tree-sitter-groovy cannot parse a Groovy enum body that
declares a constructor. The enum closes early on a zero-width MISSING
}, the constructor is re-parsed as a top-level expression_statement,
and ABC bills each one as a branch.

Measured

enum E {
    A(1), B, C(2)
    E(int v) { }
    E() { }
}

bca metrics --no-config -O json reports abc.branches = 2. Removing
the two constructors from the same file gives abc.branches = 0. The
two branches are the constructor declarations, counted as calls.

The parse

bca dump on the file above:

├─ {enum_declaration:196} from (1, 1) to (2, 18)      <- ends at line 2
│  ╰─ {enum_body:197} from (1, 8) to (2, 18)
│     ├─ {enum_constant:198} : A(1)
│     ├─ {enum_constant:198} : B
│     ├─ {enum_constant:198} : C(2)
│     ╰─ {}:7} from (2, 18) to (2, 18) :               <- zero-width MISSING
├─ {expression_statement:212} from (3, 5) to (3, 13) : E(int v)
...

rg '\{(ERROR|MISSING)' over the dump confirms it:

{ERROR:65535} from (3, 11) to (3, 12) : v
{ERROR:65535} from (5, 1) to (5, 2) : }

An enum with a constructor is ordinary Groovy, so this is a grammar
limitation rather than an input problem.

Impact

Every metric is wrong for such a file, not just ABC: the enum's members
land in the file space instead of the enum's, so nom, wmc, npm and
the space tree are all affected. ABC's branches is simply the easiest
symptom to measure.

Next step

Per AGENTS.md ("If a bug is in the grammar … document it
as upstream-grammar and either workaround locally or coordinate the
upstream fix; do not paper over it silently"), this wants an upstream
fix in dekobon-tree-sitter-groovy rather than a downstream arm. Worth
adding an ERROR-probe regression fixture here in the meantime so the
day the grammar is bumped and the shape changes, we notice.

Found while

Sibling-sweeping #1384 (Kotlin primary-constructor superclass call) —
the Groovy enum fixture was measured only to compare enum-constant
argument handling across the JVM family.

Dominant language
Rust
Stars
32
Forks
3
Avg merge
1d 15h
Merged PRs (30d)
56

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dekobon/big-code-analysis

All issues in dekobon/big-code-analysis

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.