UseConcurrentHashMap false positive (with documentation example)
A source code analyzer
Brought to you by:
adangel,
juansotuyo
If we declare an map with the interface Map by instantiate it with ConcurrentHashMap (such as the PMD documentation example), an "Use Concurrent Hash Map" error occurs.
:::xml
<test-code>
<description><![CDATA
UseConcurrentHashMap false positive (with documentation example)
]></description>
<expected-problems>0</expected-problems>
<![CDATA[
public class ConcurrentApp {
public void getMyInstance() {
Map map2 = new ConcurrentHashMap(); // preferred for use with multiple threads
}
}
]]>
</test-code>
Thanks!
This will be fixed with PMD 5.3.2 and later.
Commit: https://github.com/pmd/pmd/commit/857ae074e19d9344a18f874226ff545d015b711f