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.