forked from phoedos/pmd
Merge branch 'pr-1041'
This commit is contained in:
@ -61,6 +61,7 @@ we have measured up to 10% improvements during Type Resolution, Symbol Table ana
|
||||
* java
|
||||
* [#894](https://github.com/pmd/pmd/issues/894): \[java] Maven PMD plugin fails to process some files without any explanation
|
||||
* [#899](https://github.com/pmd/pmd/issues/899): \[java] JavaTypeDefinitionSimple.toString can cause NPEs
|
||||
* [#1020](https://github.com/pmd/pmd/issues/1020): \[java] The CyclomaticComplexity rule runs forever in 6.2.0
|
||||
* [#1030](https://github.com/pmd/pmd/pull/1030): \[java] NoClassDefFoundError when analyzing PMD with PMD
|
||||
* java-bestpractices
|
||||
* [#370](https://github.com/pmd/pmd/issues/370): \[java] GuardLogStatementJavaUtil not considering lambdas
|
||||
@ -88,4 +89,5 @@ we have measured up to 10% improvements during Type Resolution, Symbol Table ana
|
||||
* [#1010](https://github.com/pmd/pmd/pull/1010): \[java] UnnecessaryConstructor triggered on required empty constructor (Dagger @Inject) - [BBG](https://github.com/djydewang)
|
||||
* [#1012](https://github.com/pmd/pmd/pull/1012): \[java] JUnitAssertionsShouldIncludeMessage - False positive with assertEquals and JUnit5 - [BBG](https://github.com/djydewang)
|
||||
* [#1024](https://github.com/pmd/pmd/pull/1024): \[java]Issue 558: Properlogger for enums - [Utku Cuhadaroglu](https://github.com/utkuc)
|
||||
* [#1041](https://github.com/pmd/pmd/pull/1041): \[java] Make BasicProjectMemoizer thread safe. - [bergander](https://github.com/bergander)
|
||||
|
||||
|
@ -28,6 +28,8 @@ public abstract class BasicProjectMemoizer<T extends QualifiableNode, O extends
|
||||
private Map<QualifiedName, MetricMemoizer<T>> classes = new WeakHashMap<>();
|
||||
private Map<QualifiedName, MetricMemoizer<O>> operations = new WeakHashMap<>();
|
||||
|
||||
private final Object classesSynchronizer = new Object();
|
||||
private final Object operationsSynchronizer = new Object();
|
||||
|
||||
/** Clears all memoizers. Used for tests. */
|
||||
public void reset() {
|
||||
@ -38,8 +40,10 @@ public abstract class BasicProjectMemoizer<T extends QualifiableNode, O extends
|
||||
|
||||
@Override
|
||||
public MetricMemoizer<O> getOperationMemoizer(QualifiedName qname) {
|
||||
if (!operations.containsKey(qname)) {
|
||||
operations.put(qname, new BasicMetricMemoizer<O>());
|
||||
synchronized (operationsSynchronizer) {
|
||||
if (!operations.containsKey(qname)) {
|
||||
operations.put(qname, new BasicMetricMemoizer<O>());
|
||||
}
|
||||
}
|
||||
|
||||
return operations.get(qname);
|
||||
@ -48,8 +52,10 @@ public abstract class BasicProjectMemoizer<T extends QualifiableNode, O extends
|
||||
|
||||
@Override
|
||||
public MetricMemoizer<T> getClassMemoizer(QualifiedName qname) {
|
||||
if (!classes.containsKey(qname)) {
|
||||
classes.put(qname, new BasicMetricMemoizer<T>());
|
||||
synchronized (classesSynchronizer) {
|
||||
if (!classes.containsKey(qname)) {
|
||||
classes.put(qname, new BasicMetricMemoizer<T>());
|
||||
}
|
||||
}
|
||||
|
||||
return classes.get(qname);
|
||||
|
Reference in New Issue
Block a user