Skip to content

Feat/source preserving annotation ordering - #350

Open
AntonLem wants to merge 33 commits into
mainfrom
feat/source-preserving-annotation-ordering
Open

AntonLem wants to merge 33 commits into
mainfrom
feat/source-preserving-annotation-ordering

Conversation

@AntonLem

@AntonLem AntonLem commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Compile annotation name, declaration length and argument criteria from
YAML configuration, with overlay support and stable ordering for ties.

Carry lexical annotation groups through the processing model and print
their original source fragments, preserving comments, line endings and
opt-out boundaries, including annotations absent from Spoon's AST.

Detect annotation-only relocations and report them through the existing
formatting diff. Reject null YAML collection entries and restore shared
quality-gate resource resolution for standalone module builds.

Add scanner, configuration, relocation and end-to-end regression coverage;
document the configuration DSL and deferred source-rewrite design. Remove
redundant collection copies while retaining required scanner snapshots.

Validation: clean verify for dependency-aware-sorting, core and cli
on JDK 21 (1040 tests, 3 skipped; no failures or errors).
Extract shared fragment models into AnnotationSrcGroup and lazily cache
each group's replacement code. Resolve gaps during sorting from layouts
prepared by the scanner, and merge group replacement into SrcPrinterOutput.

Preserve source bounds and comment ownership across repeated sorts, retain
independent lists for each group, and centralize whitespace and source-offset
helpers in SrcCodeUtils. Update regression tests and pipeline documentation.

Validation: 265 focused core tests, PMD, and CPD pass on JDK 21.
Keep annotation and member flags independent and derive their aggregate for processing flows. Skip relocation diagnostics unless changed declarations require a report.
Claim the compilation unit before the first sorting attempt, including unchanged and failed runs. Preserve the claim across model views and consumed clones; reparsing starts an independent sorting lifecycle.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T13:11:42.643744Z 085475f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5445fbb4d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 5445fbb4d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Resolve annotation names through source scopes, imports and module JDK types.
Separate name lookup, import context and repeatable-container metadata while
preserving source order across qualified and inherited annotation aliases.
Improve Unicode token handling, regression coverage and algorithm documentation.
Upgrade Palantir Java Format to 2.100.0.

Leave AnnotationOrderPreservationKeyCollector uncommitted pending review.
This partial snapshot requires that class before it can compile independently.
Preserve relative order for possible annotation aliases and repeatable
families without merging confirmed homonyms. Validate terminal identity
entries and reuse unchanged key sets.

Clarify runtime member lookup through type hierarchies, centralize
java.lang name metadata, and document per-annotation key scopes.
Cover collection ownership, cache failures, and nested annotation keys.
Mark unconfirmed annotation uses and repeatable-container roots with ?. and
remove redundant confirmation sets and lexical cache entries. Preserve
pair-specific alias dependencies and source-declared container relationships.

Separate repeatable-chain computation from memoization and cover imported
containers, inherited aliases, and defaulted array containers with compiled
regressions.
Expand each annotation fragment with candidate type/container keys instead
of generating synthetic pair keys and a separate pair index. Preserve
original keys and keep confirmed homonyms independently sortable.

Update collector contracts, regression tests, and the algorithm guide.
Build declaration indexes from streams and count types and members in one traversal. Remove redundant type-list helpers and the scanner's diagnostic-only offset parameter. Cover end-of-source diagnostics for unclosed annotation arguments.

Validation: 263 core tests passed on JDK 21, with formatting, SPDX, PMD/CPD, and POM checks.
Group annotation scanning and metadata helpers under translator.spoon.annotation. Separate parser tree traversal from Spoon operations shared across processing stages.

Restrict initial source-fragment construction to the producer package and derive sorted variants through copies that preserve source metadata. Keep relocation diagnostics with their shared model and package-private LIS helper. Update package documentation, conventions, and tests.

Validation: 797 core tests passed on JDK 21; one existing test is disabled. Formatting, SPDX, PMD/CPD, and POM checks passed.
Prepare immutable gap layouts while scanning and render selected annotation orders without copying groups or gaps. Store changed permutations separately and clarify source-order naming.
Return the working model and selected annotation orders through sorting results. Assemble printer context in flows, clarify original source-group names, and condense user-facing release notes.
Classify static imports and deduplicate inherited type declarations during annotation lookup. Read opt-out directives from Java comment tokens and preserve original source offsets.

Correct Javadoc parameter tags and links to match the declarations used by the current build.
Share translated text and original source offsets across annotation scanning, opt-out checks, and source printing.

Report malformed escapes at their original offsets, preserve trailing backslashes in line comments, and track preprocessing time separately. Document the Spoon and JDT workarounds to recheck on upgrade.
@AntonLem

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 085475fd29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The translator hands both freshly built arrays directly to UnicodeEscapeOffsets. Scope the suppression to its constructor and apply formatting and test method ordering in core.
Keep shared conventions at the repository root and place specialized rules alongside the code, tests, and guides they govern.

Move numbered printer scenarios directly under printer/ and update test resource paths and documentation to match the other end-to-end suites.
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.

1 participant