Repository navigation
Description
Summary
Found while working #5851's follow-up (PR #5864): the production SQL parser is SQLAntlrParser (ANTLR4-based, com.arcadedb.query.sql.antlr), reached via StatementCache.parse() -> antlrParser.parse(statement). The legacy JavaCC/JJTree-generated parser under com.arcadedb.query.sql.parser - SqlParser.java (~27,200 lines), SqlParserTokenManager.java (~5,740 lines), and JJTSqlParserState.java - is never instantiated or invoked anywhere at runtime. There is no javacc-maven-plugin/jjtree step in engine/pom.xml either, so these aren't even regenerated from a source grammar any more; the original .jjt grammar was already archived as engine/src/main/grammar-archive/SQLGrammar.jjt.old. They're just ~33,000 lines of static, unmaintained, unreachable code sitting in the module.
Confirmed via grep -rl "new SqlParser(" --include="*.java" . across the repo: zero matches.
Not fully dead - two small holder classes have live consumers
SqlParserTreeConstants.java (357 lines) and SqlParserConstants.java (788 lines) are also JavaCC-generated, but they're pure constant tables (node-type IDs, token-type IDs and the tokenImage string array), not parsing logic, and a few files still import from them:
SelectStatement.java,MatchStatement.java,SQLQueryEngine.java-import static ...SqlParserTreeConstants.{JJTLIMIT,JJTTIMEOUT}(used as arbitrary-but-stable integer markers, unrelated to actual JavaCC tree-building)engine/src/test/java/.../function/FunctionReferenceGenerator.java- readsSqlParserConstants.tokenImageto enumerate SQL keywords for doc generation
Removal needs to either keep these two small constant-holder files (dropping only the actual parser/lexer: SqlParser.java, SqlParserTokenManager.java, JJTSqlParserState.java, and anything else with zero live references) or extract the handful of constants those four files actually use into a small new home and drop everything.
Suggested approach
- Confirm zero references the same way (
grep/an IDE "find usages" pass) right before removal, since this codebase has multiple agents landing PRs concurrently. - Remove
SqlParser.java,SqlParserTokenManager.java,JJTSqlParserState.javaoutright. - Either keep
SqlParserTreeConstants.java/SqlParserConstants.javaas-is (cheapest, still slightly odd to keep "JavaCC-generated" constant files with no generator), or extract justJJTLIMIT/JJTTIMEOUT/tokenImageinto a small hand-written replacement and drop those two files too. engine/src/main/grammar-archive/SQLGrammar.jjt.oldcan go too once the generated code it produced is gone.- Full
mvn -pl engine testpass afterward - the four live-consumer files above are the only ones that need re-verifying.
🤖 Generated with Claude Code
Activity
fix(#5867): also remove the orphaned JavaCC token/lexer support classes
fix(#5867): finish the job, delete SqlParserTreeConstants and its two…
fix(#5867): drop stale JaCoCo excludes for the deleted SqlParserToken…
fix(#5867): remove dead JavaCC-generated SQL parser and its no-op sel…