Skip to content

Add legacy SourceOrdering option#1541

Merged
elucash merged 1 commit intoimmutables:masterfrom
christophercolumbusdog:legacy-source-ordering
Mar 31, 2025
Merged

Add legacy SourceOrdering option#1541
elucash merged 1 commit intoimmutables:masterfrom
christophercolumbusdog:legacy-source-ordering

Conversation

@christophercolumbusdog
Copy link
Copy Markdown

Prior to Immutables 2.7.5, the source ordering was defined be a "shallow" approach where accessors from the child class were added first, then the superclass, then the interfaces. This changed in 2.7.5, where the order became interfaces, then superclass, then child class. Issue 889 acknowledged this as a breaking
change, and it has made it difficult for some clients to migrate safely to later versions.

Add a new system property,
org.immutables.useLegacyAccessorOrdering,
that when set to true, reverts to the <=2.7.4 ordering. This should enable more clients to migrate to more recent versions safely.

This should fix issue #1488

Prior to Immutables 2.7.5, the source ordering was
defined be a "shallow" approach where accessors from
the child class were added first, then the superclass,
then the interfaces. This changed in 2.7.5, where the
order became interfaces, then superclass, then child
class. Issue 889 acknowledged this as a breaking
change, and it has made it difficult for some clients
to migrate safely to later versions.

Add a new system property,
org.immutables.useLegacyAccessorOrdering,
that when set to true, reverts to the <=2.7.4 ordering.
This should enable more clients to migrate to more
recent versions safely.
@elucash
Copy link
Copy Markdown
Member

elucash commented Mar 31, 2025

Thank you for the PR! It was extremely hard for me to look into it myself and got it right. I assume you've verified it works for the intended use case (migrating from older versions). I want to add at least some tests and planning to add @Style attribute in addition to JVM property, so both will work

@elucash elucash merged commit 5d6bb87 into immutables:master Mar 31, 2025
16 checks passed
elucash added a commit that referenced this pull request Mar 31, 2025
@christophercolumbusdog
Copy link
Copy Markdown
Author

Excellent, thanks for merging! This was tested against our migration use case, and we verified that it enabled the migration in most cases. We ran across issue #1540, which prevented a complete upgrade; hopefully, we can address that one, too!

@christophercolumbusdog christophercolumbusdog deleted the legacy-source-ordering branch March 31, 2025 19:09
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