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
Bump PMD to version 7.0.0 #17717
base: master
Are you sure you want to change the base?
Bump PMD to version 7.0.0 #17717
Conversation
I've looked into this before, but decided to not update because they made the immutable field check no longer work with Lombok (I guess due to the new Java record types?). But since we use Lombok so heavily it is just a loss of functionality. I'd probably rather just remove the immutable field check than go around and annotate everything as PMD ignore though. I am not familiar with this pmd-compat6 dep, do you know what that is for? |
PMD's states their reasoning here. It's an unfortunate change considering use cases like Lombok. I'd be happy to modify this PR to remove that rule if there is still interest in the upgrade, though.
This was added specifically to support |
I guess I don't mind the update / I am sort of indifferent to it. I see you mentioned moving to Java 21, but to do that we first have to update the launcher to 21 and then push launcher updates out. Updating the launcher version is a pretty major thing, is somewhat irreversible, and tends to uncover obscure Java bugs and also break our code in places we are depend on 11 specific functionality. It is not something I want to sink a bunch of time in unless I have a compelling reason to update. |
pmd/pmd#4474 looks like they made it ignore fields annotated with |
Thanks for your thoughts on this. I mentioned it in this PR to gauge interest, and it is understandable that you would not want to push for the upgrade without a very good reason, which I admittedly do not have. I also see in the launcher that you are currently depending on JDKs with 32bit Windows support for which there does not seem to be a temurin offering at this time.
Ah, great catch. I was following their migration guide which suggested going to 6.55.0 first before 7.0.0, and I think as a result 6.55.0 reported these erroneously and I fixed them before bumping to 7.0.0. Let me redo the version bump in one go and see what changes that ends up requiring. |
I believe that is 27 less use cases of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also several // NOPMD in the code, some of them can be removed because they have been fixed upstream I think. Please check those.
@@ -56,7 +56,7 @@ private static final class Entry | |||
private String title; | |||
|
|||
@Getter | |||
private List<Entry> options = new ArrayList<>(); | |||
private final List<Entry> options = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are all of these types of changes (setting final on getter/setter fields) then also unnecessary? Ideally I'd like the minimum amount of change that keeps pmd happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe PMD is intentionally still flagging @Getter
only fields. I did a re-run from master with 7.0.0 and these are the changes it asked for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the ImmutableFieldRule flagging it? Since it really looks like it shouldn't pmd/pmd@66ddd56#diff-f0d84f4b43ab1c1e2fbc8b8ee09c4c0c3ee2c5a7b981d99fae749652821ec07aR64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, @Getter
was specifically removed a few days later per pmd/pmd@d9a98b9
runelite-client/pom.xml
Outdated
</dependency> | ||
<dependency> | ||
<groupId>net.sourceforge.pmd</groupId> | ||
<artifactId>pmd-javascript</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to comment or add more info in the commit message, but maven-pmd-plugin depends on these, and I think with the API changes from 6 to 7 pmd-compat6
needs all of these updated and available to work properly. Their docs for upgrading PMD at runtime also show upgrading these packages too.
runelite-client/pom.xml
Outdated
</dependency> | ||
<dependency> | ||
<groupId>net.sourceforge.pmd</groupId> | ||
<artifactId>pmd-jsp</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
6cd9ed8
to
530b436
Compare
I was able to remove a couple of |
@@ -1879,6 +1879,7 @@ public int[] getConfigKeys() | |||
return new int[]{text.hashCode()}; | |||
} | |||
|
|||
@SuppressWarnings("PMD.UnusedPrivateMethod") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly pmd/pmd#4861
This function is used, not sure why it caught
I've been playing around with upgrading RuneLite to Java 21. Part of that work would require upgrading PMD to version 7.0.0, which was a big enough change on its own that felt like it needed its own PR.