-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
- assignee:
ifernandezcalvo
- status: Open
- priority: Minor
- component(s): trilead-api-plugin
- resolution: Unresolved
- votes: 1
- watchers: 3
- imported: 20251216-225446
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<br/>
Jenkins 2.492.2 LTS<br/>
OpenJDK 17<br/>
SSH Build Agents Plugin 3.1031.v72c6b_883b_869<br/>
SSH Credentials Plugin 355.v9b_e5b_cde5003<br/>
Development Environment: <br/>
Mac OS 15.3.2<br/>
Temurin JDK 21<br/>
IntelliJ Idea 2024.3.3