This commit is contained in:
Alexey Kudravtsev
2014-06-12 15:22:47 +04:00
parent 46b87bf115
commit ca357269d6
3 changed files with 17 additions and 6 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
import com.intellij.psi.util.MethodSignatureUtil;
import com.intellij.util.Query;
import com.intellij.util.QueryExecutor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -38,8 +39,8 @@ public class SuperMethodsSearch extends ExtensibleQueryFactory<MethodSignatureBa
private final boolean myCheckBases;
private final boolean myAllowStaticMethod;
public SearchParameters(final PsiMethod method,
@Nullable final PsiClass aClass,
public SearchParameters(@NotNull PsiMethod method,
@Nullable PsiClass aClass,
final boolean checkBases,
final boolean allowStaticMethod) {
myCheckBases = checkBases;
@@ -52,6 +53,7 @@ public class SuperMethodsSearch extends ExtensibleQueryFactory<MethodSignatureBa
return myCheckBases;
}
@NotNull
public final PsiMethod getMethod() {
return myMethod;
}
@@ -69,7 +71,11 @@ public class SuperMethodsSearch extends ExtensibleQueryFactory<MethodSignatureBa
private SuperMethodsSearch() {
}
public static Query<MethodSignatureBackedByPsiMethod> search(final PsiMethod derivedMethod, @Nullable final PsiClass psiClass, boolean checkBases, boolean allowStaticMethod) {
@NotNull
public static Query<MethodSignatureBackedByPsiMethod> search(@NotNull PsiMethod derivedMethod,
@Nullable final PsiClass psiClass,
boolean checkBases,
boolean allowStaticMethod) {
final SearchParameters parameters = new SearchParameters(derivedMethod, psiClass, checkBases, allowStaticMethod);
return SUPER_METHODS_SEARCH_INSTANCE.createUniqueResultsQuery(parameters, MethodSignatureUtil.METHOD_BASED_HASHING_STRATEGY);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,10 +66,12 @@ public class MethodSignatureBackedByPsiMethod extends MethodSignatureBase {
return myMethod;
}
@NotNull
public static MethodSignatureBackedByPsiMethod create(@NotNull PsiMethod method, @NotNull PsiSubstitutor substitutor) {
return create(method, substitutor, PsiUtil.isRawSubstitutor(method, substitutor));
}
@NotNull
public static MethodSignatureBackedByPsiMethod create(@NotNull PsiMethod method, @NotNull PsiSubstitutor substitutor, boolean isRaw) {
PsiTypeParameter[] methodTypeParameters = method.getTypeParameters();
if (isRaw) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,6 +57,7 @@ public class QueryFactory<Result, Parameters> {
* @param parameters of the search
* @return query to perform the search. Obtained results are automatically filtered wrt. equals() relation.
*/
@NotNull
public final Query<Result> createUniqueResultsQuery(@NotNull Parameters parameters) {
return new UniqueResultsQuery<Result, Result>(createQuery(parameters));
}
@@ -66,6 +67,7 @@ public class QueryFactory<Result, Parameters> {
* @param hashingStrategy strategy to factor results
* @return query to perform the search. Obtained results are automatically filtered wrt. equals() relation.
*/
@NotNull
public final Query<Result> createUniqueResultsQuery(@NotNull Parameters parameters,
@NotNull TObjectHashingStrategy<Result> hashingStrategy) {
return new UniqueResultsQuery<Result, Result>(createQuery(parameters), hashingStrategy);
@@ -78,6 +80,7 @@ public class QueryFactory<Result, Parameters> {
* @return query to perform the search. Obtained results are mapped to whatever objects that are automatically filtered wrt. equals()
* relation. Storing mapped objects instead of original elements may be wise wrt to memory consumption.
*/
@NotNull
public final <T> Query<Result> createUniqueResultsQuery(@NotNull Parameters parameters,
@NotNull TObjectHashingStrategy<T> hashingStrategy,
@NotNull Function<Result, T> mapper) {