From d52e33b6e01df5651da5e99eb11a7e7408350da2 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 1 Jun 2018 16:00:29 +0300 Subject: [PATCH] cleanup --- .../psi/impl/search/LazyConcurrentCollection.java | 15 ++++++++------- .../src/com/intellij/psi/PsiSubstitutor.java | 2 +- .../intellij/psi/util/CachedValuesManager.java | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/LazyConcurrentCollection.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/LazyConcurrentCollection.java index a76ff20ce19c..4064f2f5d9bf 100644 --- a/java/java-indexing-impl/src/com/intellij/psi/impl/search/LazyConcurrentCollection.java +++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/LazyConcurrentCollection.java @@ -53,8 +53,8 @@ class LazyConcurrentCollection implements Iterable { // If more elements requested for this iterator, the processMoreSubclasses() is called which tries to populate 'subClasses' with more inheritors. private final HashSetQueue subClasses; // guarded by lock private final Object lock = new Object(); // MUST NOT acquire read action inside this lock - @NotNull private final Function myAnchorToValueConvertor; - @NotNull private final MoreElementsGenerator myGenerator; + @NotNull private final Function myAnchorToValueConvertor; + @NotNull private final MoreElementsGenerator myGenerator; @NotNull private final Predicate myApplicableForGenerationFilter; private final Semaphore currentlyProcessingClasses = new Semaphore(); @@ -66,9 +66,9 @@ class LazyConcurrentCollection implements Iterable { private final Set classesProcessed = new THashSet<>(); // guarded by lock LazyConcurrentCollection(@NotNull T seedElement, - @NotNull Function convertor, + @NotNull Function convertor, @NotNull Predicate applicableForGenerationFilter, - @NotNull MoreElementsGenerator generator) { + @NotNull MoreElementsGenerator generator) { subClasses = new HashSetQueue<>(); subClasses.add(seedElement); myAnchorToValueConvertor = convertor; @@ -116,8 +116,9 @@ class LazyConcurrentCollection implements Iterable { }; } - // polls 'subClasses' for more sub classes and call DirectClassInheritorsSearch for them - // returns true if some classes were found + // polls 'subClasses' for more sub classes and call generator.generateMoreElementsFor() on them + // adds found classes to "subClasses" queue + // returns as soon as something was added private void processMoreSubclasses(@NotNull Iterator subClassIterator) { while (true) { ProgressManager.checkCanceled(); @@ -231,7 +232,7 @@ class LazyConcurrentCollection implements Iterable { } // under lock - private Pair.NonNull findNextClassInQueue(@NotNull HashSetQueue.PositionalIterator.IteratorPosition position) { + private Pair.NonNull findNextClassInQueue(@NotNull HashSetQueue.PositionalIterator.IteratorPosition position) { // find the first class suitable for analyzing inheritors of (not anonymous and not final and retrievable from PsiAnchor) and not already processed or being processed (by other thread) // couldn't call iterator.next() until class is processed, so use position.peek()/position.next() which don't advance iterator while (position != null) { diff --git a/java/java-psi-api/src/com/intellij/psi/PsiSubstitutor.java b/java/java-psi-api/src/com/intellij/psi/PsiSubstitutor.java index 69c370d2f22e..2b8817632f1e 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiSubstitutor.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiSubstitutor.java @@ -54,7 +54,7 @@ public interface PsiSubstitutor { /** * Substitutes type parameters occurring in {@code type} with their values. - * If value for type parameter is null, appropriate erasure is returned. + * If value for type parameter is {@code null}, appropriate erasure is returned. * * @param type the type to substitute the type parameters for. * @return the result of the substitution. diff --git a/platform/core-api/src/com/intellij/psi/util/CachedValuesManager.java b/platform/core-api/src/com/intellij/psi/util/CachedValuesManager.java index 5ce1981e2800..f43f3a2a581f 100644 --- a/platform/core-api/src/com/intellij/psi/util/CachedValuesManager.java +++ b/platform/core-api/src/com/intellij/psi/util/CachedValuesManager.java @@ -123,7 +123,7 @@ public abstract class CachedValuesManager { * @return The cached value */ public static T getCachedValue(@NotNull final PsiElement psi, @NotNull final CachedValueProvider provider) { - return getCachedValue(psi, CachedValuesManager.getKeyForClass(provider.getClass(), globalKeyForProvider), provider); + return getCachedValue(psi, getKeyForClass(provider.getClass(), globalKeyForProvider), provider); } /**