mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
notnull
This commit is contained in:
@@ -58,17 +58,17 @@ public class ExpectedTypeUtil {
|
||||
private static class ExpectedTypeInfos {
|
||||
List<ExpectedTypeInfo> myInfos;
|
||||
|
||||
public ExpectedTypeInfos() {
|
||||
myInfos = new ArrayList<ExpectedTypeInfo>();
|
||||
ExpectedTypeInfos() {
|
||||
myInfos = new ArrayList<>();
|
||||
}
|
||||
|
||||
public ExpectedTypeInfos(ExpectedTypeInfo[] infos) {
|
||||
myInfos = new ArrayList<ExpectedTypeInfo>(Arrays.asList(infos));
|
||||
ExpectedTypeInfos(ExpectedTypeInfo[] infos) {
|
||||
myInfos = new ArrayList<>(Arrays.asList(infos));
|
||||
}
|
||||
|
||||
public void clear () { myInfos.clear(); }
|
||||
|
||||
public void addInfo (ExpectedTypeInfo info) {
|
||||
void addInfo(ExpectedTypeInfo info) {
|
||||
for (Iterator<ExpectedTypeInfo> iterator = myInfos.iterator(); iterator.hasNext();) {
|
||||
ExpectedTypeInfo sub = iterator.next();
|
||||
int cmp = contains(sub, info);
|
||||
@@ -105,17 +105,18 @@ public class ExpectedTypeUtil {
|
||||
if (matchesStrictly(info1.getType(), info2)) return -1;
|
||||
if (matchesStrictly(info2.getType(), info1)) return 1;
|
||||
return 0;
|
||||
} else if (kind1 == ExpectedTypeInfo.TYPE_STRICTLY) {
|
||||
}
|
||||
if (kind1 == ExpectedTypeInfo.TYPE_STRICTLY) {
|
||||
return matches(info1.getType(), info2) ? -1 : 0;
|
||||
} else if (kind2 == ExpectedTypeInfo.TYPE_STRICTLY) {
|
||||
}
|
||||
if (kind2 == ExpectedTypeInfo.TYPE_STRICTLY) {
|
||||
return matches(info2.getType(), info1) ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static boolean matchesStrictly (PsiType type, ExpectedTypeInfo info) {
|
||||
if ((type instanceof PsiPrimitiveType) != (info.getType() instanceof PsiPrimitiveType)) return false;
|
||||
return matches(type, info);
|
||||
return type instanceof PsiPrimitiveType == info.getType() instanceof PsiPrimitiveType && matches(type, info);
|
||||
}
|
||||
|
||||
public static boolean matches (PsiType type, ExpectedTypeInfo info) {
|
||||
@@ -144,9 +145,10 @@ public class ExpectedTypeUtil {
|
||||
myOccurrenceClasses = occurrenceClasses;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiField[] findDeclaredFields(final PsiManager manager, String name) {
|
||||
List<PsiField> fields = new ArrayList<PsiField>();
|
||||
public PsiField[] findDeclaredFields(@NotNull final PsiManager manager, @NotNull String name) {
|
||||
List<PsiField> fields = new ArrayList<>();
|
||||
for (PsiClass aClass : myOccurrenceClasses) {
|
||||
final PsiField field = aClass.findFieldByName(name, true);
|
||||
if (field != null) fields.add(field);
|
||||
@@ -154,9 +156,10 @@ public class ExpectedTypeUtil {
|
||||
return fields.toArray(new PsiField[fields.size()]);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiMethod[] findDeclaredMethods(final PsiManager manager, String name) {
|
||||
List<PsiMethod> methods = new ArrayList<PsiMethod>();
|
||||
public PsiMethod[] findDeclaredMethods(@NotNull final PsiManager manager, @NotNull String name) {
|
||||
List<PsiMethod> methods = new ArrayList<>();
|
||||
for (PsiClass aClass : myOccurrenceClasses) {
|
||||
final PsiMethod[] occMethod = aClass.findMethodsByName(name, true);
|
||||
ContainerUtil.addAll(methods, occMethod);
|
||||
|
||||
Reference in New Issue
Block a user