Skip to content

Conversation

@Legioth
Copy link
Member

@Legioth Legioth commented Feb 14, 2025

  • Rename TreeManipulator to ResultBuilder and use it only for multi-step commands and commands that affect multiple nodes
  • Explicitly return a result when handling a command instead of indirectly producing one
  • Transactions produce multiple results so they have custom top-level handling instead of following the general pattern
  • Handle errors caused by concurrent modifications by returning a Reject result instead of passing the error through an instance field

* Rename TreeManipulator to ResultBuilder and use it only for multi-step
commands and commands that affect multiple nodes
* Explicitly return a result when handling a command instead of
indirectly producing one
* Transactions produce multiple results so they have custom top-level
handling instead of following the general pattern
* Handle errors caused by concurrent modifications by returning a Reject
result instead of passing the error through an instance field
Comment on lines 211 to 213
if (mapUpdater.apply(map) instanceof Reject error) {
return error;
}
Copy link
Contributor

@taefi taefi Apr 24, 2025

Choose a reason for hiding this comment

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

Compiler complains about Java 17 compatibility of this expression, considering it to be an unconditional pattern matching instanceof which is supported in Java 21+:

/vaadin/flow/signals/src/main/java/com/vaadin/signals/impl/MutableTreeRevision.java:211:39
java: unconditional patterns in instanceof are not supported in -source 17
  (use -source 21 or higher to enable unconditional patterns in instanceof)

Same applies everywhere in this file where (... instanceof Reject error) is used.
Since the updater function is returning CommandResult.Reject, a null check is enough without instanceof.

Copy link
Member Author

Choose a reason for hiding this comment

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

Silly of Java to not realize that the expression isn't actually unconditional. Uglified to be compatible with ancient compilers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this refactoring going to be back ported to V24 branches, or could the original code with the cleaner instanceof syntax be back?

Copy link
Member

Choose a reason for hiding this comment

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

There is no need to backport

@sonarqubecloud
Copy link

@CLAassistant
Copy link

CLAassistant commented Oct 22, 2025

CLA assistant check
All committers have signed the CLA.

@Artur-
Copy link
Member

Artur- commented Jan 12, 2026

Are you working on this or should we close it?

@github-actions
Copy link

github-actions bot commented Jan 12, 2026

Test Results

1 310 files  1 310 suites   1h 14m 12s ⏱️
9 284 tests 9 216 ✅ 68 💤 0 ❌
9 734 runs  9 658 ✅ 76 💤 0 ❌

Results for commit 50ca9c6.

♻️ This comment has been updated with latest results.

@Legioth
Copy link
Member Author

Legioth commented Jan 12, 2026

I'm just waiting for someone to review it...

@vaadin-bot vaadin-bot added +1.0.0 and removed +0.0.1 labels Jan 12, 2026
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🔎Iteration reviews

Development

Successfully merging this pull request may close these issues.

7 participants