jenkinsci / jenkinsci/trilead-api-plugin
[JENKINS-75490] Source Code Migration to Java 17
- Dominant language
- No language data
- Stars
- 1
- Forks
- 17
- Avg merge
- 21h 21m
- Merged PRs (30d)
- 1
Description
Update trilead ssh api plugin (/jenkinsci/trilead-ssh2 library) source code to Java 17.
This should make it easier for this very old library to be maintained by developers, as the current one is difficult to maintain / enhance features.
Since the new JVM recommendation for Jenkins is 17/21, I believe updating the source compatibility to Java 17 is reasonable and enables some new language features which help the developer experience.
The following changes will be implemented:
pom.xml: Source and Target set to 17 (currently unset)PR-226Generic types parameterized to the best of the ability (I came across one that I am not sure on how to proceed, but the code builds and current tests still pass, so I left it alone)PR-226- Use lamda-style sytnax for classes such as Java Runnable
- Improve for loops to safer (X element : collection) from (for int x=0; x < collection.length; x++) syntax where possible
- Use new improve switch-statement syntax
- Add @Deprectated annotations to deprecated methods
Add @Override annotations to implementations for interface methodsPR-226- Add @Serial annotation to serialVersionUIDs
- Use try-with-resources blocks for closeable resources
- Make private class methods final
- Make private unchanging variables final where necessary
Remove unnecessary type-castsPR-226- Use static-method reference in streams, where appropriate
Use class references instead of "strings" of class names (looking specifically at com.trilead.ssh2.crypto.cipher.BlockCipherFactory ciphers list)PR-226Instantiate classes with getDeclaredConstructor().newInstance() instead of the deprecated newInstance() methodPR-226Remove unnecessary methods from child classes that have the same exact values / content as parent classes (com.trilead.ssh2.crypto.cipherDES getBlockSize() is an example)PR-226Fix case in Long variables (lowercase "l" -> uppercase "L")PR-226- Use https where possible for XML files and for git clone (in the Dockerfile)
I have already done the changes above and am opening this ticket so I can submit a PR.
The original PR for this was.... very large, so I am breaking up the work into PRs, from most important to least.
---
Originally reported by speedythesnail, imported from: Source Code Migration to Java 17
ifernandezcalvo
Raw content of original issue
Update trilead ssh api plugin (/jenkinsci/trilead-ssh2 library) source code to Java 17.
This should make it easier for this very old library to be maintained by developers, as the current one is difficult to maintain / enhance features.
Since the new JVM recommendation for Jenkins is 17/21, I believe updating the source compatibility to Java 17 is reasonable and enables some new language features which help the developer experience.
The following changes will be implemented:
pom.xml: Source and Target set to 17 (currently unset)PR-226Generic types parameterized to the best of the ability (I came across one that I am not sure on how to proceed, but the code builds and current tests still pass, so I left it alone)PR-226- Use lamda-style sytnax for classes such as Java Runnable
- Improve for loops to safer (X element : collection) from (for int x=0; x < collection.length; x++) syntax where possible
- Use new improve switch-statement syntax
- Add @Deprectated annotations to deprecated methods
Add @Override annotations to implementations for interface methodsPR-226- Add @Serial annotation to serialVersionUIDs
- Use try-with-resources blocks for closeable resources
- Make private class methods final
- Make private unchanging variables final where necessary
Remove unnecessary type-castsPR-226- Use static-method reference in streams, where appropriate
Use class references instead of "strings" of class names (looking specifically at com.trilead.ssh2.crypto.cipher.BlockCipherFactory ciphers list)PR-226Instantiate classes with getDeclaredConstructor().newInstance() instead of the deprecated newInstance() methodPR-226Remove unnecessary methods from child classes that have the same exact values / content as parent classes (com.trilead.ssh2.crypto.cipherDES getBlockSize() is an example)PR-226Fix case in Long variables (lowercase "l" -> uppercase "L")PR-226- Use https where possible for XML files and for git clone (in the Dockerfile)
I have already done the changes above and am opening this ticket so I can submit a PR.
The original PR for this was.... very large, so I am breaking up the work into PRs, from most important to least.
environment
```
RHEL 9.5
Jenkins 2.492.2 LTS
OpenJDK 17
SSH Build Agents Plugin 3.1031.v72c6b_883b_869
SSH Credentials Plugin 355.v9b_e5b_cde5003
Development Environment:
Mac OS 15.3.2
Temurin JDK 21
IntelliJ Idea 2024.3.3
```
Contributor guide
Research direction
Review PR-226 first to separate completed migration work from the remaining items in this issue. Then inspect the trilead SSH library source, pom.xml, Dockerfile, and the listed Java constructs; done means the remaining modernization changes are applied and the existing tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- networking
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100