Skip to content

Commit

Permalink
Modernize to latest versions supported by Java 8 (#34)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Steve Hill <[email protected]>
  • Loading branch information
3 people authored Jul 14, 2023
1 parent 4974cdb commit 475c23f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.7</version>
<version>4.51</version>
<relativePath />
</parent>

<properties>
<jenkins.version>2.249.1</jenkins.version>
<java.level>8</java.level>
<jenkins.version>2.346.3</jenkins.version>
</properties>

<artifactId>categorized-view</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;
Expand Down Expand Up @@ -47,14 +46,8 @@ public CategorizedJobsView(final String name, final ViewGroup owner) {
super(name, owner);
}

private Object readResolve() {
try {
Method readResolve = ListView.class.getDeclaredMethod("readResolve");
readResolve.setAccessible(true);
readResolve.invoke(this);
} catch (Exception e) {
e.printStackTrace();
}
protected Object readResolve() {
super.readResolve();
try {
Field field = ListView.class.getDeclaredField("jobNames");
field.setAccessible(true);
Expand Down

0 comments on commit 475c23f

Please sign in to comment.