Skip to content

Improved: Remove this-escape warnings in the Artifact Info factory and controller views (OFBIZ-13751) - #2504

Merged
mridulpathak merged 1 commit into
apache:trunkfrom
mridulpathak:OFBIZ-13751
Oct 30, 2026
Merged

mridulpathak merged 1 commit into
apache:trunkfrom
mridulpathak:OFBIZ-13751

Conversation

@mridulpathak

Copy link
Copy Markdown
Contributor

ArtifactInfoFactory built the whole artifact graph from its constructor through the public prepareAll method, and ControllerViewArtifactInfo resolved its screen and added itself to the factory's reverse references from its constructor, before the factory had registered it. javac reports both as this-escape because a subclass could see the object before its constructor finished, and a view reached again through its own screen while it was still being constructed was created a second time. ArtifactInfoFactory is now final with a private constructor that only assigns its fields, and getArtifactInfoFactory builds the graph with the now private prepareAll before it publishes the factory. ControllerViewArtifactInfo links itself in a new populateAll method that the factory calls once the view is registered, as it already does for the other artifact types. Nothing in the framework, applications, themes or plugins subclasses ArtifactInfoFactory or calls its constructor or prepareAll, so they are changed directly rather than deprecated. This removes the this-escape warnings for the artifactinfo package under JDK 25.

…er views

ArtifactInfoFactory built the whole artifact graph from its constructor through the public prepareAll method, and ControllerViewArtifactInfo resolved its screen and added itself to the factory's reverse references from its constructor, before the factory had registered it. A view reached again through its own screen while it was still being constructed was then created a second time.

ArtifactInfoFactory is now final with a private constructor that only assigns its fields; getArtifactInfoFactory builds the graph with the now private prepareAll before publishing the factory. ControllerViewArtifactInfo links itself in a new populateAll method that the factory calls once the view is registered, as it already does for the other artifact types.
@mridulpathak mridulpathak added the api-change Changes or removes a public API label Oct 30, 2026
@mridulpathak
mridulpathak merged commit 0fc76c0 into apache:trunk Oct 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change Changes or removes a public API enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant