Affects PMD Version: 6.4.0+
Rule:
UnnecessaryFullyQualifiedName
Description:
A false positive in UnnecessaryFullyQualifiedName. If the code has an enum "Float" defined, java.lang.Float cannot be referenced anymore without fully qualifying it. PMD warns about the usage of java.lang.Float.floatToIntBits because it doesn't understand this.
Code Sample demonstrating the issue:
public enum DataType {
Float(Float.class) {
@Override
public String toString(final Object value) {
if (value == null) {
return null;
}
final int bits = java.lang.Float.floatToIntBits((java.lang.Float) value); // false-positive
return "";
}
};
private Class<?> dataClass;
private DataType(Class<?> dataClass) {
this.dataClass = dataClass;
}
@Override
public Class<?> getDataClass() {
return dataClass;
}
}
Running PMD through: Maven
Output:
[INFO] PMD Failure: com.DataType:100 Rule:UnnecessaryFullyQualifiedName Priority:4 Unnecessary use of fully qualified name 'java.lang.Float' due to existing implicit import 'java.lang.*'.
Based on release notes and searching issues the false positive was introduced in one of these:
https://github.com/pmd/pmd/pull/1141/files
https://github.com/pmd/pmd/pull/1220/files
Affects PMD Version: 6.4.0+
Rule:
UnnecessaryFullyQualifiedName
Description:
A false positive in UnnecessaryFullyQualifiedName. If the code has an enum "Float" defined, java.lang.Float cannot be referenced anymore without fully qualifying it. PMD warns about the usage of java.lang.Float.floatToIntBits because it doesn't understand this.
Code Sample demonstrating the issue:
Running PMD through: Maven
Output:
[INFO] PMD Failure: com.DataType:100 Rule:UnnecessaryFullyQualifiedName Priority:4 Unnecessary use of fully qualified name 'java.lang.Float' due to existing implicit import 'java.lang.*'.
Based on release notes and searching issues the false positive was introduced in one of these:
https://github.com/pmd/pmd/pull/1141/files
https://github.com/pmd/pmd/pull/1220/files