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

[JEP-228] Unforking XStream #4944

Merged
merged 32 commits into from
Nov 6, 2020
Merged

[JEP-228] Unforking XStream #4944

merged 32 commits into from
Nov 6, 2020

Conversation

jglick
Copy link
Member

@jglick jglick commented Sep 21, 2020

JEP-228

Proposed changelog entries

  • Jenkins now uses an updated version of the XStream serialization library without custom patches.

Proposed upgrade guidelines

https://www.jenkins.io/blog/2020/11/10/spring-xstream/

See the compatibility table.

Desired reviewers

@jenkinsci/core

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are correct
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@jglick
Copy link
Member Author

jglick commented Sep 21, 2020

Seems that the defense in #3248 is no longer necessary as of x-stream/xstream@d0ad410, though it is harmless to leave in.

@@ -82,8 +81,7 @@
/**
* {@link ToolProperty}s that are associated with this tool.
*/
@XStreamSerializable
private transient /*almost final*/ DescribableList<ToolProperty<?>,ToolPropertyDescriptor> properties
private /*almost final*/ DescribableList<ToolProperty<?>,ToolPropertyDescriptor> properties
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a problem. DescribableList is not Serializable so removing transient will prevent this class from being serialized over Remoting. Yet keeping transient will prevent tool installations from saving their properties in XML. I have not found any way to get the effect of XStreamSerializable without patching PureJavaReflectionProvider.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I am not sure why ToolInstallation was ever made Serializable to begin with. The normal usage is to have it define some PATH entry on the controller side, which does not require the ToolInstallation itself to ever be sent to the agent.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the current annotation was explicitly rejected upstream: x-stream/xstream#70 (comment)

return this;
}

protected Object writeReplace() throws Exception {
if (Channel.current() == null) { // XStream
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, not nice, but seems to work well enough. I am trying to fix popular plugins to not need this hack.

@jglick
Copy link
Member Author

jglick commented Oct 26, 2020

Would prefer to get at least the following released first:

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the pull request template. Changelog and upgrade guide drafts are required for this pull request

@jglick jglick changed the title Unforking XStream [JEP-228] Unforking XStream Oct 26, 2020
Copy link
Member

@jvz jvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, seems to work with random plugins I tried out. Read through the associated JEP-228 docs as well.

@jglick jglick removed the needs-more-reviews Complex change, which would benefit from more eyes label Oct 30, 2020
@timja
Copy link
Member

timja commented Nov 1, 2020

Is anyone else wanting to review this or should we ship in the next weekly?

@jglick jglick added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Nov 3, 2020
@timja
Copy link
Member

timja commented Nov 3, 2020

This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

pom.xml Outdated Show resolved Hide resolved
@daniel-beck
Copy link
Member

This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Given the PR size, might make sense to wait a few days longer, since the next weekly is still a week off anyway.

@jvz
Copy link
Member

jvz commented Nov 6, 2020

I'll be merging this after #4848 is merged.

jglick added a commit to jglick/jenkins.io that referenced this pull request Nov 6, 2020
@jvz jvz merged commit 77f24bf into jenkinsci:master Nov 6, 2020
@jglick jglick deleted the xstream branch November 6, 2020 21:04
@jglick
Copy link
Member Author

jglick commented Nov 6, 2020

Cleanup: INFRA-2794

@@ -132,7 +132,7 @@ public void setJobFilters(List<ViewJobFilter> jobFilters) throws IOException {
this.jobFilters.replaceBy(jobFilters);
}

private Object readResolve() {
protected Object readResolve() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this imply that all plugins must make the same change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the class is extended and the parent read resolve needs to be called

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I attempted to search for extant plugins using an incorrect private override, but I might have missed some of course.

sghill added a commit to sghill-rewrite/categorized-view-plugin that referenced this pull request Jul 11, 2023
Unforking XStream required the access level of this method to be
protected. Fortunately this means the super method can be called
directly instead of using reflection.

jenkinsci/jenkins#4944
basil pushed a commit to jenkinsci/categorized-view-plugin that referenced this pull request Jul 14, 2023
* refactor: Modernize to latest versions supported by Java 8

Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.jenkins.ModernizePluginForJava8?organizationId=SmVua2lucyBDSQ%3D%3D

Co-authored-by: Moderne <team@moderne.io>

* Raise access modifier of readResolve to protected

Unforking XStream required the access level of this method to be
protected. Fortunately this means the super method can be called
directly instead of using reflection.

jenkinsci/jenkins#4944

---------

Co-authored-by: Moderne <team@moderne.io>
Co-authored-by: Steve Hill <sghill.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file developer Changes which impact plugin developers major-rfe For changelog: Major enhancement. Will be highlighted on the top plugin-api-changes Changes the API of Jenkins available for use in plugins. ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback removed This PR removes a feature or a public API squash-merge-me Unclean or useless commit history, should be merged only with squash-merge upgrade-guide-needed This changes might be breaking in rare circumstances, an entry in the LTS upgrade guide is needed
Projects
None yet
9 participants