javac ast indices: cleanup, dead code

This commit is contained in:
Dmitry Batkovich
2017-04-04 16:00:47 +03:00
parent b1bfd41de6
commit 525a42d851
3 changed files with 6 additions and 17 deletions
@@ -32,7 +32,7 @@ public abstract class CompilerReferenceServiceEx extends CompilerReferenceServic
}
@NotNull
public abstract SortedSet<OccurrencesAware<MethodIncompleteSignature>> findMethodReferenceOccurrences(@NotNull String rawReturnType, boolean onlyStatic)
public abstract SortedSet<OccurrencesAware<MethodIncompleteSignature>> findMethodReferenceOccurrences(@NotNull String rawReturnType)
throws ReferenceIndexUnavailableException;
public abstract boolean mayHappen(@NotNull LightRef ref1, @NotNull LightRef ref2, int correlationThreshold)
@@ -222,17 +222,14 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceServiceEx imp
@NotNull
@Override
public SortedSet<OccurrencesAware<MethodIncompleteSignature>> findMethodReferenceOccurrences(@NotNull String rawReturnType, boolean onlyStatic) {
public SortedSet<OccurrencesAware<MethodIncompleteSignature>> findMethodReferenceOccurrences(@NotNull String rawReturnType) {
try {
myReadDataLock.lock();
if (myReader == null) throw new ReferenceIndexUnavailableException();
try {
final int type = myReader.getNameEnumerator().tryEnumerate(rawReturnType);
Stream.Builder<SignatureData> builder = Stream.<SignatureData>builder().add(new SignatureData(type, true));
if (!onlyStatic) {
builder.accept(new SignatureData(type, false));
}
return builder.build()
if (type == 0) return Collections.emptySortedSet();
return Stream.of(new SignatureData(type, true), new SignatureData(type, false))
.flatMap(sd -> myReader.getMembersFor(sd)
.stream()
.filter(r -> r instanceof LightRef.JavaLightMethodRef)
@@ -56,7 +56,7 @@ public class ChainsSearcher {
private static SearchInitializer createInitializer(TargetType target,
CompilerReferenceServiceEx compilerReferenceServiceEx,
ChainCompletionContext context) {
SortedSet<OccurrencesAware<MethodIncompleteSignature>> methods = compilerReferenceServiceEx.findMethodReferenceOccurrences(target.getClassQName(), false);
SortedSet<OccurrencesAware<MethodIncompleteSignature>> methods = compilerReferenceServiceEx.findMethodReferenceOccurrences(target.getClassQName());
return new SearchInitializer(methods, context);
}
@@ -80,14 +80,6 @@ public class ChainsSearcher {
.filter(Objects::nonNull)
.collect(Collectors.toCollection(LinkedList::new));
int maxWeight = 0;
for (MethodsChain methodsChain : knownDistance.values()) {
if (methodsChain.getChainWeight() > maxWeight) {
maxWeight = methodsChain.getChainWeight();
}
}
ResultHolder result = new ResultHolder(context.getPsiManager());
while (!q.isEmpty()) {
ProgressManager.checkCanceled();
@@ -104,7 +96,7 @@ public class ChainsSearcher {
continue;
}
String currentReturnType = headSignature.getOwner();
SortedSet<OccurrencesAware<MethodIncompleteSignature>> nextMethods = indexReader.findMethodReferenceOccurrences(currentReturnType, false);
SortedSet<OccurrencesAware<MethodIncompleteSignature>> nextMethods = indexReader.findMethodReferenceOccurrences(currentReturnType);
MaxSizeTreeSet<OccurrencesAware<MethodIncompleteSignature>> currentSignatures =
new MaxSizeTreeSet<>(maxResultSize);
for (OccurrencesAware<MethodIncompleteSignature> indexValue : nextMethods) {