Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WW-3714 Deprecate and repackage common APIs part 2 #1081

Merged
merged 3 commits into from
Oct 22, 2024
Merged

Conversation

kusalk
Copy link
Member

@kusalk kusalk commented Oct 17, 2024

WW-3714

This PR deprecates and provides repackaged replacements for the following APIs, ahead of their permanent migration in Struts 7.0:

  • com.opensymphony.xwork2.ActionInvocation
  • com.opensymphony.xwork2.interceptor.PreResultListener

Full backwards compatibility with the deprecated types are retained - I achieved this by doing the following:

  1. Move 'old' class to new package
  2. Update any imports in this moved class to replacement types if applicable/available
  3. Create a class in the old package (where the original class was) which extends the new updated one
  4. Add back any APIs/methods which are not inherited due to updated imports from (2)
  5. Provide default implementations for inherited APIs/methods which were not present in the 'old' class, delegating to the APIs added back in (4)
  6. Create internal adapter classes as necessary to achieve (5)

Another variation of this approach that is sometimes employed is to have the new class extend the deprecated one instead. I deliberately avoided this as it pollutes the new/replacement class with compatibility code and references to deprecated types. I'd prefer compatibility code to appear in the deprecated class instead, to avoid confusion for anyone inspecting the bytecode/source of the APIs.

Additionally, this approach usually facilitates much more straightforward deletion of the deprecated classes when ready. However, in this case, this point is moot as the deletion PR for Struts 7.0 has already been prepared. We can simply discard all changes in my series of deprecation PRs when we merge them forward from master to release/struts-7-0-x.

@kusalk kusalk force-pushed the kusal-depr-apis-3 branch from 352c2e9 to 272c2e7 Compare October 17, 2024 04:05
@kusalk kusalk changed the title WW-3714 Deprecate and migrate ActionInvocation WW-3714 Deprecate and repackage common APIs part 2 Oct 17, 2024
@kusalk kusalk force-pushed the kusal-depr-apis-3 branch from 64799b1 to e3fbe88 Compare October 17, 2024 06:32
Copy link

sonarcloud bot commented Oct 17, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Base automatically changed from kusal-depr-apis to master October 21, 2024 23:53
@kusalk kusalk marked this pull request as ready for review October 22, 2024 00:54
@kusalk kusalk merged commit b488c80 into master Oct 22, 2024
8 of 9 checks passed
@kusalk kusalk deleted the kusal-depr-apis-3 branch October 22, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants