Skip to content

Jinjava 3.0: Roll back some of the unnecessary breaking changes#1316

Open
jasmith-hs wants to merge 5 commits intomasterfrom
3.0.0-less-binary-incompatibility
Open

Jinjava 3.0: Roll back some of the unnecessary breaking changes#1316
jasmith-hs wants to merge 5 commits intomasterfrom
3.0.0-less-binary-incompatibility

Conversation

@jasmith-hs
Copy link
Copy Markdown
Contributor

There can be some binary incompatibility issues with how I migrated JinjavaConfig to an immutable and LegacyOverrides to an Immutable.

  • The JinjavaConfig migration binary incompatibility can be solved by having JinjavaConfig remain a class so that the reference to JinjavaConfig#newBuilder remains a class method reference rather than an interface method reference.

  • I could not keep LegacyOverrides as an immutable, and had to revert it back to being a POJO. Trying to solve the interface method reference backwards incompatibility issue by making it a class could introduce a static class initialization deadlock due to the static members like LegacyOverrides.NONE referencing a subclass of LegacyOverrides (ImmutableLegacyOverrides)

  • I kept it so that eager execution will continue to reconstruct the JinjavaInterpreter arguments as ____int3rpr3t3r____ rather than null so that if needing to revert an upgrade to Jinjava 3.0, there won't have been any first-phase eager execution outputs that are backwards incompatible (as resolving null for exptests and filters in Jinjava 2.8.X would break them). This does not decrease the security of Jinjava 3.0 because I'm still not resolving the ____int3rpr3t3r____ variable ever, it is still resolved to null

The |reverse filter in Jinja returns an iterator, but Jinjava 2 returned
a list. The ReverseArrayIterator introduced in 3.0 breaks non-standard
usage like {{ (arr|reverse)[0] }}. This override (enabled in THREE_POINT_0)
keeps the iterator behavior; when disabled, the result is collected into
a list for backwards compatibility.

Also fixes Builder.from() which was missing keepNullableLoopValues, causing
it to silently reset to false when cloning a LegacyOverrides instance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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