mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
@NotNull location in weigher
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class NameEndMatchingDegreeWeigher extends CompletionWeigher {
|
||||
|
||||
public Integer weigh(@NotNull final LookupElement element, @Nullable final CompletionLocation location) {
|
||||
public Integer weigh(@NotNull final LookupElement element, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,15 +18,14 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class PreferAbstractWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
if (location == null || location.getCompletionType() != CompletionType.SMART) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location.getCompletionType() != CompletionType.SMART) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PreferAccessibleWeigher extends CompletionWeigher {
|
||||
|
||||
public MyEnum weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public MyEnum weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class PreferDefaultTypeWeigher extends CompletionWeigher {
|
||||
expectedNoSelect
|
||||
}
|
||||
|
||||
public MyResult weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public MyResult weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PreferEnumConstantsWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class PreferExpectedTypeWeigher extends CompletionWeigher {
|
||||
ofDefaultType,
|
||||
}
|
||||
|
||||
public MyResult weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public MyResult weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PreferFieldsAndGettersWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PreferLessParametersWeigher extends CompletionWeigher {
|
||||
@Override
|
||||
public Integer weigh(@NotNull LookupElement element, @Nullable CompletionLocation location) {
|
||||
public Integer weigh(@NotNull LookupElement element, @NotNull CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class PreferLocalVariablesLiteralsAndAnnoMethodsWeigher extends Completio
|
||||
annoMethod,
|
||||
}
|
||||
|
||||
public MyResult weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public MyResult weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PreferNonGenericWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PreferShorterWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PreferSimpleWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RecursionWeigher extends CompletionWeigher {
|
||||
delegation,
|
||||
}
|
||||
|
||||
public Result weigh(@NotNull final LookupElement element, @Nullable final CompletionLocation location) {
|
||||
public Result weigh(@NotNull final LookupElement element, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
*/
|
||||
public class SameWordsWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @author peter
|
||||
*/
|
||||
public class StaticMembersWeigher extends CompletionWeigher {
|
||||
public Comparable weigh(@NotNull LookupElement element, @Nullable CompletionLocation loc) {
|
||||
public Comparable weigh(@NotNull LookupElement element, @NotNull CompletionLocation loc) {
|
||||
if (loc == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ExplicitlyImportedWeigher extends ProximityWeigher {
|
||||
}
|
||||
});
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
final PsiElement position = location.getPosition();
|
||||
if (position == null){
|
||||
return null;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class JavaInheritanceWeigher extends ProximityWeigher {
|
||||
}
|
||||
});
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
if (location.getPosition() == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class KnownPackageWeigher extends ProximityWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
if (element instanceof PsiClass) {
|
||||
@NonNls final String qname = ((PsiClass)element).getQualifiedName();
|
||||
if (qname != null) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SamePsiMemberWeigher extends ProximityWeigher {
|
||||
}
|
||||
});
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
if (location.getPosition() == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -24,5 +24,5 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public abstract class CompletionWeigher extends Weigher<LookupElement, CompletionLocation> {
|
||||
|
||||
public abstract Comparable weigh(@NotNull final LookupElement element, final CompletionLocation location);
|
||||
public abstract Comparable weigh(@NotNull final LookupElement element, @NotNull final CompletionLocation location);
|
||||
}
|
||||
|
||||
@@ -42,5 +42,5 @@ public abstract class Weigher<T, Location> {
|
||||
return myDebugName == null ? super.toString() : myDebugName;
|
||||
}
|
||||
|
||||
@Nullable public abstract Comparable weigh(@NotNull T element, @Nullable Location location);
|
||||
@Nullable public abstract Comparable weigh(@NotNull T element, @NotNull Location location);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class GroupingWeigher extends CompletionWeigher {
|
||||
@Override
|
||||
public Integer weigh(@NotNull LookupElement element, @Nullable CompletionLocation location) {
|
||||
public Integer weigh(@NotNull LookupElement element, @NotNull CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class LookupElementProximityWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class LookupStringWeigher extends CompletionWeigher {
|
||||
@Override
|
||||
public String weigh(@NotNull LookupElement element, @Nullable CompletionLocation location) {
|
||||
public String weigh(@NotNull LookupElement element, @NotNull CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class NegativeStatisticsWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PrefixMatchingWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class PriorityWeigher extends CompletionWeigher {
|
||||
@Override
|
||||
public Double weigh(@NotNull LookupElement element, @Nullable CompletionLocation location) {
|
||||
public Double weigh(@NotNull LookupElement element, @NotNull CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class StatisticsWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @Nullable final CompletionLocation location) {
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class OpenedInEditorWeigher extends ProximityWeigher {
|
||||
}
|
||||
});
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
if (location.getProject() == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public abstract class ProximityWeigher extends Weigher<PsiElement, ProximityLocation> {
|
||||
|
||||
public abstract Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location);
|
||||
public abstract Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SameDirectoryWeigher extends ProximityWeigher {
|
||||
}
|
||||
});
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
if (location.getPosition() == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SameLogicalRootWeigher extends ProximityWeigher {
|
||||
}
|
||||
});
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
if (location.getPosition() == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class SameModuleWeigher extends ProximityWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
return location.getPositionModule() == ModuleUtil.findModuleForPsiElement(element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
*/
|
||||
public class SdkOrLibraryWeigher extends ProximityWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final PsiElement element, final ProximityLocation location) {
|
||||
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
|
||||
if (location.getProject() == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user