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

Code cleanup #124

Merged
merged 13 commits into from
Dec 26, 2018
Merged

Code cleanup #124

merged 13 commits into from
Dec 26, 2018

Conversation

darxriggs
Copy link
Contributor

@darxriggs darxriggs commented Oct 21, 2018

The deprecated classes/methods have been found by https://ci.jenkins.io/job/Infra/job/deprecated-usage-in-plugins/job/master/lastSuccessfulBuild/artifact/output/usage-by-plugin.html.

I suggest to review the changes commit by commit.

@darxriggs
Copy link
Contributor Author

Hi @fcojfernandez and @oleg-nenashev, as some time already passed since this pull-request was created, I just wanted to check if it can be merged?

@oleg-nenashev
Copy link
Member

I am not sure who maintains this plugin nowadays

@oleg-nenashev
Copy link
Member

Will check

@fcojfernandez fcojfernandez self-requested a review November 5, 2018 08:26
Copy link
Member

@fcojfernandez fcojfernandez left a comment

Choose a reason for hiding this comment

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

Code looks good to me, but after checking the summary of deprecated methods I see that the following methods are still in use:

  • "hudson/model/View#getOwnerItemGroup()Lhudson/model/ItemGroup;"
  • "hudson/model/View#onJobRenamed(Lhudson/model/Item;Ljava/lang/String;Ljava/lang/String;)V"

Is there any reason to keep those deprecated method?

@darxriggs
Copy link
Contributor Author

I added another commit to replace View#getOwnerItemGroup.

@darxriggs
Copy link
Contributor Author

darxriggs commented Nov 5, 2018

About View#onJobRenamed I am not sure. Therefore leaving it untouched.

There are already @SuppressWarnings("deprecation") annotations on the methods where it is used. The codes mixes items & views. I am not familiar enough with the code to tackle this.

Usages:

According to the Javadoc, since Java 6 TimeUnit contains all required units.
The newer methods Jenkins#get and Jenkings#getInstanceOrNull make it more
clear by name and annotation if null may be returned or not.
According to the Javadoc, ACL#as should be used in combination
with a try-with-resources statement.
According to the Javadoc, SubTask#getOwnerTask should be called directly.
According to the Javadoc, it should not be used anymore due to risk for file leak.
According to the Javadoc, ViewGroup#getItemGroup should be called
directly on the owner.
@darxriggs
Copy link
Contributor Author

Hi @fcojfernandez, I now rebased on master and resolved the merge conflict.

@fcojfernandez
Copy link
Member

fcojfernandez commented Dec 19, 2018

@darxriggs I think I will be able to work on this next week. Thanks a lot!

@fcojfernandez fcojfernandez merged commit 86c638f into jenkinsci:master Dec 26, 2018
@darxriggs darxriggs deleted the code-cleanup branch December 26, 2018 15:28
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.

3 participants