Using a variable name that clashes with the package name triggers the
UnnecessaryFullyQualifiedName rule because of implicit import * for package classes.
Affects PMD Version:
6.16
Rule:
UnnecessaryFullyQualifiedName
Description:
Usage of attribute length for variable threads triggers the UnnecessaryFullyQualifiedName rule.
Code Sample demonstrating the issue:
package threads; public enum FQNTest { ; public static void main(String[] args) { Thread[] threads = new Thread[5]; for (int i = 0; i < threads.length; i++) { threads[i] = new Thread(new Runnable() { @Override public void run() { for (int j = 0; j < 10_000; j++) { try { Thread.sleep(1); } catch (InterruptedException e) { System.err.println(e); } } } }, "thread-" + i); threads[i].start(); } try { for (Thread thread: threads) { thread.join(); } } catch (InterruptedException ex) { System.err.println(ex); } System.out.println("[" + Thread.currentThread().getName() + "] All threads have finished."); } }
Running PMD through: *
[CLI | Ant]
Openjdk on Arch Linux, version 10 compiling for 8.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4