Repository navigation
#9037 Calculator: restore -1 default for value_length/value_precision on legacy loads - #9038
Merged
mattcasters merged 1 commit intoOct 21, 2026
Conversation
…ion on legacy loads CalculatorMetaFunction lost its legacy -1 default for valueLength/valuePrecision when PR apache#795 (HOP-2849) replaced the hand-written XML loader with HopMetadataProperty-based automatic (de)serialization. A plain `int valueLength;` now deserializes to Java's 0 when the tag is absent, whereas the old loader defaulted to -1 (the sentinel for "unspecified length/precision" used by CalculatorMeta.getValueMeta() and by CalculatorDialog, which reads blank cells back as -1 and only shows a length >= 0). Initialize both fields to -1 so a legacy restore keeps the sentinel instead of collapsing it to 0. Add two tests to CalculatorMetaFunctionTest: one restoring a legacy XML without value_length/value_precision (asserts -1; fails before the fix with expected:<-1> but was:<0>), and one restoring XML with explicit values (asserts they are preserved and not clobbered by the default). Fixes apache#9037
Contributor
|
Thanks @rmannibucau. Built the PR and ran the calculator tests (86/86 green); with the two field initialisers reverted, |
bamaer
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #9037
Change description
CalculatorMetaFunctionlost its legacy-1default forvalueLength/valuePrecisionwhen PR #795 (HOP-2849) replaced the hand-written XML loader with@HopMetadataProperty-based automatic (de)serialization. A plainprivate int valueLength;/private int valuePrecision;now deserialize to Java's default0when the tag is absent, whereas the old loader defaulted to-1— the sentinel for "unspecified length/precision" used byCalculatorMeta.getValueMeta()and byCalculatorDialog(which reads blank cells back as-1and only shows a length>= 0).This PR initializes both fields to
-1so a legacy restore keeps the sentinel instead of collapsing it to0.Tests
Regression tests added in
CalculatorMetaFunctionTest:<value_length>/<value_precision>now asserts-1(this test fails on currentmainwithexpected: <-1> but was: <0>).value_length/value_precisionasserts the values are preserved (and not clobbered by the-1default).Verification
mvn -pl plugins/transforms/calculator test(module calculator):CalculatorMetaFunctionTest4/4 green with the fix; the legacy-restore test fails without it.apache-rat:checkon the module: 0 unapproved licences.spotless:check: OK.Notes
Build verified against the repo's pinned JDK 21 (
21.0.12-tem); the default JDK 26 in this environment breaksspotless/google-java-format(NoSuchMethodErrorinjavac).