-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Affects PMD Version: 6.53.0
Rule: MissingOverride
Description:
When an application is extending standard JDK classes, then this rule might produce a false positive. Eg. in PMD 7, we extend java.lang.CharSequence
and add a method isEmpty
without @Override
, because this method doesn't exist in Java 8. But it has been added in Java 15.
The rule uses reflection to get the methods of the super class. This depends on the runtime JVM that is used when executing PMD.
In PMD 6, the rule directly uses reflection, so there is no way we could provide a different auxclasspath.
In PMD 7, the rule uses the new symbol API, which uses ASM to load the info from the class files. So we could potentially run PMD with an auxclasspath containing a different JDK classpath than the runtime JVM.
Code Sample demonstrating the issue:
public boolean isEmpty() { |
I found this problem when build PMD 7 with Java 17.
Expected outcome:
PMD reports a violation at line 71, but that's wrong. That's a false positive.
Running PMD through: Maven