openhab / static-code-analysis

Maven tooling for static code analysis
https://www.openhab.org/
Other
32 stars 21 forks source link

Upgrade PMD to 7.0.0 #462

Closed holgerfriedrich closed 7 months ago

holgerfriedrich commented 7 months ago

Add support for Java 21.

https://docs.pmd-code.org/pmd-doc-7.0.0-rc4/pmd_release_notes.html


Update to PMD7 gives me some headache, as AST has changed. See migration guide, https://docs.pmd-code.org/pmd-doc-7.0.0-rc4/pmd_release_notes.html#migration-guide-for-pmd-7

Still struggling to get custom test to work properly (UseSLF4JLoggerRule.java).

@wborn Could use some help, just in case you know the details of AST parsing.....

wborn commented 7 months ago

I had a look and after setting a break point I could check the objects and see where all the required data is stored nowadays. Then I could get it working again with the changes in https://github.com/holgerfriedrich/static-code-analysis/pull/1.

holgerfriedrich commented 7 months ago

for a benchmark see https://github.com/openhab/static-code-analysis/pull/463#issuecomment-1975116887

holgerfriedrich commented 7 months ago

benchmark looks good, removed label WIP

holgerfriedrich commented 7 months ago

Hello @openhab/sat-maintainers , kindly asking to review/merge this PR. We need this as one of the last pieces towards a Java21 build. Thanks!

See the comparison of 0.15 and 0.16-SNAPSHOT: https://github.com/openhab/static-code-analysis/pull/463#issuecomment-1975116887

See comments above:

btw: Once we get https://github.com/openhab/static-code-analysis/pull/462 and https://github.com/openhab/static-code-analysis/pull/463, we should release. The benefit it support for Java 21 (i.e. support for running SAT checks on class files generated with Java 21).

holgerfriedrich commented 7 months ago

@kaikreuzer When I checked a few days ago, it was still -rc4 :-) I will quickly check if there is a functional difference and pull the final version in.

holgerfriedrich commented 7 months ago

A lot of changes between rc4 and final, I had to adapt a few files. Though, now the PR is reworked and seems to work fine with the final release.

@wborn do you want to give it a try as well?

btw: The new dependency pmd-compat6 is still needed until maven-pmd-plugin gets updated.

holgerfriedrich commented 7 months ago

@kaikreuzer thanks, could you please trigger the release of 0.16? Not sure how this works and how this gets published on the typical mvn repos....

kaikreuzer commented 7 months ago

@holgerfriedrich Will do. Is there any special reason why the build asks for Java 11? Or is it safe to change the constraint and build with with Java 17 instead (which seems to work well)?

holgerfriedrich commented 7 months ago

@holgerfriedrich Will do. Is there any special reason why the build asks for Java 11? Or is it safe to change the constraint and build with with Java 17 instead (which seems to work well)?

@kaikreuzer I typically build with newer versions on my local machine. However, the last time we tried to upgrade to 17, we have broken the release build, see #451. Something releated to the unleash plugin.

kaikreuzer commented 7 months ago

@holgerfriedrich Many thanks for the reminder! I've built it with Java11 again and here we are: https://github.com/openhab/static-code-analysis/releases/tag/0.16.0

holgerfriedrich commented 7 months ago

@holgerfriedrich Many thanks for the reminder! I've built it with Java11 again and here we are: https://github.com/openhab/static-code-analysis/releases/tag/0.16.0

Thanks a lot, @kaikreuzer 🚀