Skip to content

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Sep 30, 2025

Adds comprehensive support for Java collections (List, Set, etc.) in both
directions of executeJs communication:

  • Java collections → JavaScript arrays (serialization)
  • JavaScript arrays → Java collections (deserialization)

Features:

  • Collection serialization via Jackson's built-in support
  • Type-safe collection deserialization (e.g., List)
  • Unit tests for collection serialization/deserialization
  • Integration tests with live UI examples
  • Updated API documentation to mention collection support

Examples:

  • Send List to JavaScript as array of objects
  • Return JavaScript arrays that become List on Java side

Copy link

github-actions bot commented Sep 30, 2025

Test Results

1 058 files   -    27  1 058 suites   - 27   1h 2m 16s ⏱️ - 10m 55s
8 278 tests +1 617  8 232 ✅ +1 638  44 💤  - 22  2 ❌ +1 
8 718 runs  +1 614  8 662 ✅ +1 635  54 💤  - 22  2 ❌ +1 

For more details on these failures, see this check.

Results for commit ac46285. ± Comparison against base commit 3113fad.

This pull request removes 421 and adds 2038 tests. Note that renamed tests count towards both.
com.vaadin.flow.AssertionTest ‑ testAssertionsAreEnabled
com.vaadin.flow.ClientResourceIT ‑ clientResourcesAreNotExposed[any_Chrome_]
com.vaadin.flow.FaultyLocationIT ‑ changeOnClient[any_Chrome_]
com.vaadin.flow.InitialExtendedClientDetailsIT ‑ verifyClientDetails[any_Chrome_]
com.vaadin.flow.InvalidLocationIT ‑ invalidCharactersOnPath_UiNotServed[any_Chrome_]
com.vaadin.flow.ui.SerializationTest ‑ testViewsSerializable
com.vaadin.flow.ui.ToStringTest ‑ testViewsElementsStringable
com.vaadin.flow.uitest.ui.AllowInertSynchronizedPropertyIT ‑ modalDialogOpened_toggleNativeDetailsVisibility_allowInertSynchronizedPropertyShouldChange[any_Chrome_]
com.vaadin.flow.uitest.ui.AttachExistingElementIT ‑ attachExistingElement[any_Chrome_]
com.vaadin.flow.uitest.ui.AttachListenerIT ‑ firstAddedToLastOnFirstAttach[any_Chrome_]
…
com.vaadin.base.devserver.AbstractDevServerRunnerTest ‑ shouldPassEncodedUrlToDevServer
com.vaadin.base.devserver.AbstractDevServerRunnerTest ‑ updateServerStartupEnvironment_preferIpv4_LocalhostIpAddressAddedToProcessEnvironment
com.vaadin.base.devserver.AbstractDevServerRunnerTest ‑ updateServerStartupEnvironment_preferIpv6_LocalhostIpAddressAddedToProcessEnvironment
com.vaadin.base.devserver.BrowserLiveReloadAccessorImplTest ‑ getLiveReload_devMode_contextHasNoReloadInstance_instanceIsCreated
com.vaadin.base.devserver.BrowserLiveReloadAccessorImplTest ‑ getLiveReload_devMode_contextHasReloadInstance_instanceIsReturned
com.vaadin.base.devserver.BrowserLiveReloadAccessorImplTest ‑ getLiveReload_liveReloadDisabled_instanceIsCreated
com.vaadin.base.devserver.BrowserLiveReloadAccessorImplTest ‑ getLiveReload_productionMode_nullIsReturned
com.vaadin.base.devserver.DebugWindowConnectionLicenseCheckTest ‑ checkLicense_invalidLicense_sendLicenseCheckFailed
com.vaadin.base.devserver.DebugWindowConnectionLicenseCheckTest ‑ checkLicense_noLicenseKeys_sendLicenseCheckFailed
com.vaadin.base.devserver.DebugWindowConnectionLicenseCheckTest ‑ checkLicense_validLicense_sendLicenseOk
…
This pull request removes 23 skipped tests and adds 1 skipped test. Note that renamed tests count towards both.
com.vaadin.flow.uitest.ui.BrokenRouterLinkIT ‑ testRouterLink_linkIsBroken_urlIsUpdated[any_Chrome_]
com.vaadin.flow.uitest.ui.BrokenRouterLinkIT ‑ testRouterLink_visitBrokenLinkAndBack_scrollPositionIsRetained[any_Chrome_]
com.vaadin.flow.uitest.ui.CountUIsIT ‑ countUisNumer_onlyOneUIShouldBeInitiialized[any_Chrome_]
com.vaadin.flow.uitest.ui.DebounceSynchronizePropertyIT ‑ throttle[any_Chrome_]
com.vaadin.flow.uitest.ui.FragmentLinkIT ‑ testViewChangeWithFragment_scrollToPageAndHashChangeEventWorks[any_Chrome_]
com.vaadin.flow.uitest.ui.FragmentLinkIT ‑ testViewChangeWithFragment_serverOverridesLocation_noScrollOrHashChange[any_Chrome_]
com.vaadin.flow.uitest.ui.PageIT ‑ testOpenUrlInIFrame[any_Chrome_]
com.vaadin.flow.uitest.ui.PageIT ‑ testOpenUrlInNewTab[any_Chrome_]
com.vaadin.flow.uitest.ui.PageIT ‑ testSetLocation[any_Chrome_]
com.vaadin.flow.uitest.ui.RouteNotFoundProdModeIT ‑ Unknown test
…
com.vaadin.base.devserver.startup.DevModeInitializerClassLoaderTest ‑ should_loadResources_from_customClassLoader

♻️ This comment has been updated with latest results.

Artur- and others added 12 commits October 1, 2025 16:40
Replaces the array-based type encoding system [typeId, ...data] with a
universal @v object format {"@v": "type", ...} for Vaadin Flow's
client-server JSON communication.

Key changes:
- Server-side: JacksonCodec and JsonCodec now encode components as
  {"@v": "node", "id": nodeId} instead of [0, nodeId]
- Server-side: Return channels as {"@v": "return", "nodeId": x, "channelId": y}
  instead of [2, nodeId, channelId]
- Client-side: ClientJsonCodec updated to decode @v objects with proper timing
- Collections now use standard JSON arrays without problematic wrapping
- Removed legacy NODE_TYPE, ARRAY_TYPE, RETURN_CHANNEL_TYPE constants
- Updated all tests to expect @v format

Benefits:
- Fixes collection serialization issues that caused test failures
- Cleaner architecture with universal @v system instead of type constants
- Better extensibility for adding new @v types
- Preserved timing where elements are created before @v resolution
- Improved performance with simplified decoding logic

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace fully qualified class names with proper imports for better code readability:
- Add JsonObject import in ClientJsonCodec.java
- Add ObjectNode and NullNode imports in JacksonCodec.java
- Update all references to use imported class names

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove unnecessary native JavaScript methods for property access.
GWT's JsonObject methods already compile to efficient JavaScript.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace verbose object format with more compact representation:
- Nodes: {"@v": "node", "id": nodeId} → {"@v-node": nodeId}
- Return channels: {"@v": "return", "nodeId": x, "channelId": y} → {"@v-return": [x, y]}

This reduces network payload size for client-server communication
while maintaining the same functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Reject objects with unknown @V- prefixed properties to maintain
forward compatibility. This ensures that if new types are added
in the future, older clients will fail cleanly rather than
misinterpreting the data.

Added tests to verify the validation works correctly for both
decodeWithTypeInfo and decodeStateNode methods.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…lines

Remove "compact", "now", and "should now" references from comments
that described changes rather than current behavior. Comments should
describe how code works and why, not what has changed from previous
versions.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vaadin-bot
Copy link
Collaborator

vaadin-bot commented Oct 2, 2025

TC Format Checker Report - 12:04 - 02 - Oct

BLOCKER There are 1 files with format errors

  • To see a complete report of formatting issues, download the differences file

  • To fix the build, please run mvn formatter:format in your branch and commit the changes.

  • Optionally you might add the following line in your .git/hooks/pre-commit file:

    mvn formatter:format
    

Here is the list of files with format issues in your PR:

flow-server/src/test/java/com/vaadin/flow/internal/JacksonCodecTest.java

Artur- and others added 5 commits October 2, 2025 13:02
Add comprehensive recursive decoding functionality that processes nested
@v-node and @v-return references within JSON objects and arrays. The
implementation uses WidgetUtil.crazyJsCast for seamless GWT integration
and in-place modification of JSON structures for efficiency.

Key changes:
- Recursive processing of nested objects and arrays containing @v references
- Simplified @V-Type validation without redundant prefix checks
- Comprehensive test coverage for complex nested structures
- Moved tests to GWT environment (test-gwt) for proper execution context
- Removed test-specific workarounds from production code

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove confusing comment that mentions "custom serializers" handling
component references, as there are currently no such custom serializers
in the standard Jackson serialization path.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Improve error handling in ClientJsonCodec by throwing descriptive
IllegalArgumentExceptions instead of silently ignoring malformed data:

- @v-node values must be numbers, not other JSON types
- @v-return values must be arrays with at least 2 elements
- Error messages include the actual type/length and full JSON context

This makes the code more resilient and easier to debug when encountering
malformed JSON with invalid @V-Type structures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Extends existing collection serialization support with comprehensive tests
for collection of complex objects (beans) in both directions.

Changes:
- Added unit tests for List<SimpleBean> and Set<SimpleBean> serialization/deserialization
- Added integration tests with UI examples demonstrating List<Bean> usage
- Verified collection of beans work with existing Jackson serialization

Tests verify:
- List<Bean>/Set<Bean> → JSON arrays of objects (serialization)
- JSON arrays → List<Bean>/Set<Bean> (deserialization)
- Live browser integration with collection parameters and return values

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

sonarqubecloud bot commented Oct 2, 2025

@Artur- Artur- changed the title feat: Add collection support for executeJs parameters and return values test: Add tests for collection serialization Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants