Skip to content

Consolidate CASCADE/RESTRICT enums (breaking API change) - #2745

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:refactor/shared-cascade-behavior-20261002
Oct 11, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:refactor/shared-cascade-behavior-20261002

Conversation

@minleejae

@minleejae minleejae commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Five statement-specific enums currently represent the same CASCADE/RESTRICT syntax, requiring callers to translate between types. Replace them with net.sf.jsqlparser.statement.CascadeBehavior and update grammar, consumers and tests.

Breaking API changes: remove AlterDomain.Behavior, AlterType.Behavior, DropPolicy.Behavior, Truncate.DropBehavior and Revoke.Behavior. Existing accessor names now accept/return CascadeBehavior; AlterType.AttributeChange is included. Callers must update imports and recompile. There are no compatibility aliases or overloaded setters. usage.rst includes the migration.

Null still means the clause is omitted, explicit RESTRICT remains distinct, and Truncate.setCascade(false) retains its previous behavior. SQL grammar alternatives, dialect handling and rendered SQL are unchanged. Foreign-key referential actions keep their separate enum.

Validation: Java 17 Gradle check passes: 9,419 tests, 9,394 passed, 25 skipped, zero failures/errors. This includes formatting, grammar conflicts, Checkstyle, PMD and SpotBugs. Focused regression coverage exercises option changes/removal across all affected statement forms, generic/PostgreSQL parsing, toString, deparser and reparsing.

Combined validation of these three refactoring branches: Gradle check passes (9,465 tests, 9,440 passed, 25 skipped, zero failures). All 882 original DDL fixtures execute on MySQL 8.4.11/PostgreSQL 18.6. The 875 supported cases also produce toString and deparser SQL that executes successfully. Seven parse failures already exist on base bb55bb9, including two foreign-option identifier cases using SAMPLE. Final parsing results and SQL outputs match the base and the DB-replayed outputs exactly; there are no new parsing/rendering regressions.

Replace five nested public enums with statement.CascadeBehavior, including AlterType attribute changes. Preserve omitted clauses and existing render/parser behavior, and document the breaking API migration.

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit 3befd9d into JSQLParser:master Oct 11, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

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