Make UI.wrapperElement non-public by adding private field and public getter
The wrapperElement field in the UI class was incorrectly declared as public, which violates encapsulation principles and exposes internal implementation details.
This PR addresses the issue by:
-
Making the field private: Changed
public Element wrapperElement;toprivate Element wrapperElement; -
Adding a public getter: Created
public Element getWrapperElement()method with proper JavaDoc documentation - Updating all external usages: Modified external classes to use the getter method instead of direct field access
Changes Made
- UI.java: Field made private and getter method added
-
UIInternalUpdater.java: Updated to use
ui.getWrapperElement() - BeforeLeaveEvent.java: Updated 4 usages to use the getter method
- JavaScriptBootstrapUITest.java: Updated 26 test usages to use the getter method
Benefits
- Proper encapsulation: The field is now private with controlled access
- API compatibility: External code can still access the wrapper element via the public getter
- Internal consistency: UI class internal usage remains unchanged
- Zero breaking changes: All existing functionality is preserved
The wrapperElement is used as a container for route components when client-side routing is enabled, and this refactoring ensures it follows proper object-oriented design principles while maintaining full backward compatibility.
Fixes #22008.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
maven.vaadin.com
- Triggering command:
/usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.11/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.11/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.11 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.11/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/flow/flow org.codehaus.plexus.classworlds.launcher.Launcher compile -q(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
π¬ Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
@mshabarov π This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.
I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.
Format Checker Report
There are 2 files with format errors
-
To see a complete report of formatting issues, download the differences artifact
-
To fix the build, please run
mvn spotless:applyin your branch and commit the changes. -
Optionally you might add the following line in your
.git/hooks/pre-commitfile:mvn spotless:apply
Here is the list of files with format issues in your PR:
flow-server/src/main/java/com/vaadin/flow/component/UI.java
flow-server/src/test/java/com/vaadin/flow/component/internal/JavaScriptBootstrapUITest.java
Quality Gate passed
Issues
4 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Test Results
1β306 filesβ Β±β0ββ1β306 suitesβ Β±0βββ1h 15m 5s β±οΈ - 1m 39s 9β171 tests Β±β0ββ9β104 β Β±β0ββ67 π€ Β±0ββ0 β Β±0β 9β598 runsβ β-β35ββ9β524 β β-β34ββ74 π€ β-β1ββ0 β Β±0β
Results for commit baf1578d.βΒ± Comparison against base commit 61ea69f1.