Repository navigation
Improved: Remove this-escape warnings in the Artifact Info factory and controller views (OFBIZ-13751) - #2504
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.