fix(groovy): enum body with a constructor fails to parse
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- Under an hour
- Newbie friendliness
- 72/100
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
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
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dekobon/big-code-analysis
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
dekobon/big-code-analysis#1713 ·
Maintainers usually reply within 1 day
-
bug python vcs
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
dekobon/big-code-analysis#1624 · 1 comment ·
Maintainers usually reply within 1 day
-
cli documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
dekobon/big-code-analysis#1485 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dekobon/big-code-analysis#1458 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
dekobon/big-code-analysis#1444 ·
Maintainers usually reply within 1 day
All issues in dekobon/big-code-analysis
Similar issues
-
rivetkit 3.0: HTTP 400 overloaded on node pool upsert is treated as fatal and exits the processOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rivet-dev/rivet#5933 · 1 comment ·
Maintainers usually reply within 1 day
-
Add a `--skip-readme` option to `gleam new`Possibly taken @mine-tech-oficial claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
gleam-lang/gleam#6458 · 1 reaction ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
CyberTimon/RapidRAW#2049 ·
Maintainers usually reply within 1 day
-
build.yml: macOS arm64 DMG fails, cargo missing on the macos-26 runner imagePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getopenscreen/openscreen#1423 ·
Maintainers usually reply within 1 day
-
bug good first issue python
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day