Skip to content

fix: split CCJSqlParserTokenManager static initializers to avoid 64KB…#2425

Merged
manticore-projects merged 1 commit intoJSQLParser:masterfrom
starlake-ai:fix/split-clinit-method-too-large
Apr 8, 2026
Merged

fix: split CCJSqlParserTokenManager static initializers to avoid 64KB…#2425
manticore-projects merged 1 commit intoJSQLParser:masterfrom
starlake-ai:fix/split-clinit-method-too-large

Conversation

@hayssams
Copy link
Copy Markdown
Contributor

@hayssams hayssams commented Apr 8, 2026

… method limit

The generated CCJSqlParserTokenManager class has a clinit method that reaches 64,452 bytes -- dangerously close to the JVM 65,535 byte limit. ASM-based tools like sbt-assembly add transformation overhead that pushes it over, causing MethodTooLargeException during fat JAR creation.

Add a splitTokenManagerStaticInit Gradle task that post-processes the generated Java file after JavaCC code generation, extracting 6 large static array initializations (stringLiterals, jjstrLiteralImages, jjmatchKinds, jjnewLexState, jjcompositeState, jjnextStateSet) into separate private static methods. This reduces clinit from 64,452 bytes to 404 bytes.

… method limit

The generated CCJSqlParserTokenManager class has a clinit method that reaches
64,452 bytes -- dangerously close to the JVM 65,535 byte limit. ASM-based tools
like sbt-assembly add transformation overhead that pushes it over, causing
MethodTooLargeException during fat JAR creation.

Add a splitTokenManagerStaticInit Gradle task that post-processes the generated
Java file after JavaCC code generation, extracting 6 large static array
initializations (stringLiterals, jjstrLiteralImages, jjmatchKinds, jjnewLexState,
jjcompositeState, jjnextStateSet) into separate private static methods. This
reduces clinit from 64,452 bytes to 404 bytes.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@manticore-projects
Copy link
Copy Markdown
Contributor

Thank you! Please see javacc/javacc-8-core#3
I will try to move this upstream to JavaCC itself.

@manticore-projects manticore-projects merged commit cf5bbc9 into JSQLParser:master Apr 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants