GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make column option token access consistent and explicit by minleejae · Pull Request #2777 · JSQLParser/JSqlParser

Conversation

@minleejae

@minleejae minleejae commented Oct 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Purpose

Make leaf column-option tokens a consistent read-only snapshot, with an explicit way to edit raw options. Currently getTokens().set(...) can mutate a raw option's SQL, silently edit a detached typed-option snapshot, or throw depending on the option kind.

Current design (As-is)

ColumnDefinition.getColumnSpecs() already provides an unmodifiable snapshot, but ColumnOption.getTokens() mixes mutable backing lists, mutable snapshots and unmodifiable lists. Raw factories also retain the caller's list or array. Generated-column token lists are mutable snapshots whose edits do not affect rendering.

Target design (To-be)

  • Return unmodifiable detached snapshots from raw and typed option tokens, including generated definitions.
  • Add setTokens(List<String>) for opaque Kind.OTHER options, copying the input. Raw factories also copy inputs. Preserve null (unset) versus empty raw tokens.
  • Reject raw token replacement on typed options, including SERIAL DEFAULT VALUE, with an explicit exception. Typed setters and editable expression/constraint children remain the way to edit structured options.
  • Document migration and preserve custom deparser and traversal behavior.

Migration

Direct token-list mutation now throws consistently. Use an explicit replacement for opaque options:

List<String> replacement = new ArrayList<>(rawOption.getTokens());
replacement.set(1, "FIXED");
rawOption.setTokens(replacement);

For typed options, use e.g. option.setDefaultExpression(...) or option.getGeneratedDefinition().setExpression(...). To replace a typed option with raw text, replace the node through column.getColumnOptions().set(i, ColumnOption.raw(tokens)).

Validation

  • Tests cover read-only tokens across typed kinds; parsed CREATE/ALTER raw-option editing; input ownership; null/empty semantics; explicit rejection without mutation; live expression edits; stable snapshots; custom expression rendering; traversal and reparsing.
  • Java 17 offline Gradle spotlessApply check: 10,065 tests, 10,040 passed, 25 skipped, zero failures/errors. Grammar, Checkstyle, PMD, SpotBugs and coverage checks pass.
  • Default PMD comparison finds no newly affected symbols; pre-existing complexity and field-placement findings remain.

Integration validation

Applied #2770, #2771 and all four follow-ups (#2775–#2778) together on master (066f581e), resolving overlapping validator edits while preserving their respective behavior. The integrated build passes Java 17 offline Gradle spotlessApply check: 10,141 tests, 10,116 passed, 25 skipped, zero failures/errors. The combined ALTER validator has zero findings under the default PMD complexity and field-placement rules.

Replayed 882 previously DB-validated MySQL/PostgreSQL DDL fixtures: 875 pass and the same seven existing parse gaps remain. SQL output, reparsing and AST node-type sets match the preceding integration baseline, with no new differences. This replay did not rerun the databases.

The published head passes grammar checks, Gradle and Maven on Ubuntu/Windows/macOS, and Codacy. Deployment-only jobs are skipped as expected for a PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@minleejae
Make column option tokens read-only snapshots
a885b17
Signed-off-by: minleejae <[email protected]>
@manticore-projects
manticore-projects merged commit dc50c7d into JSQLParser:master Oct 13, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@manticore-projects

manticore-projects commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 14, 2026
Share typed MySQL index options across CREATE INDEX and table definitions #2810
Merged
Model MySQL column positions and attributes #2813
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@minleejae @manticore-projects
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.