Skip to content

Fix typo serialization key in AbstractCinematicEven (Issue #2449)#2668

Merged
riccardobl merged 2 commits intojMonkeyEngine:masterfrom
mondogo24:fix/typo-cinematic-key
Mar 30, 2026
Merged

Fix typo serialization key in AbstractCinematicEven (Issue #2449)#2668
riccardobl merged 2 commits intojMonkeyEngine:masterfrom
mondogo24:fix/typo-cinematic-key

Conversation

@mondogo24
Copy link
Copy Markdown
Contributor

As the issue #2449 stated. The serialization key, for the class's field initialDuration, should has been initialDuration but initalDuration was written. To fix it and, at the same time, avoid the backward incompatibility:

  • In the write function: The key is always correctly setted as initialDuration.
  • In the read function: First, it checks for initialDuration key, if not found, it uses the default value to indicate that it was not found. Then, the same it does with initalDuration. If none is found the class field initialDuration is set with the original default value, which is 10. I thought about using the value -1 as indicator of not finding the key since it shouldn't make sense negative temporal units for this field. Also added a commentary to indicate why a double check was occurring for future readers.

close #2449

)

The serialization key, for the class's field `initialDuration`, should has been `initialDuration` but
`initalDuration` was written.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request corrects a typo in the serialization key for 'initialDuration' and implements backward compatibility to support the previous misspelled key 'initalDuration'. The review feedback suggests simplifying the fallback logic by nesting the read calls, which removes the need for magic numbers and improves code readability.

Simplifies the previous code in the `read(...)` function on class `AbstractCinematicEvent`.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Member

@riccardobl riccardobl left a comment

Choose a reason for hiding this comment

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

thank you!

@riccardobl riccardobl merged commit 3162259 into jMonkeyEngine:master Mar 30, 2026
17 of 18 checks passed
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.

Typo: "initalDuration" key used for serialization in AbstractCinematicEvent

2 participants