mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] @Contract and @Nullable
This commit is contained in:
@@ -47,6 +47,7 @@ import com.intellij.util.containers.EmptyIterable;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -1069,12 +1070,14 @@ public final class PsiUtil extends PsiUtilCore {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Contract("null, _ -> null")
|
||||
@Nullable
|
||||
public static PsiType extractIterableTypeParameter(@Nullable PsiType psiType, final boolean eraseTypeParameter) {
|
||||
final PsiType type = substituteTypeParameter(psiType, CommonClassNames.JAVA_LANG_ITERABLE, 0, eraseTypeParameter);
|
||||
return type != null ? type : substituteTypeParameter(psiType, CommonClassNames.JAVA_UTIL_COLLECTION, 0, eraseTypeParameter);
|
||||
}
|
||||
|
||||
@Contract("null, _, _, _ -> null")
|
||||
@Nullable
|
||||
public static PsiType substituteTypeParameter(@Nullable final PsiType psiType, @NotNull final String superClass, final int typeParamIndex,
|
||||
final boolean eraseTypeParameter) {
|
||||
|
||||
+2
@@ -32,6 +32,7 @@ import com.intellij.util.containers.HashMap;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import gnu.trove.TObjectIntHashMap;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -634,6 +635,7 @@ public class TypesUtil {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Contract("null, _ -> false")
|
||||
public static boolean isClassType(@Nullable PsiType type, @NotNull String qName) {
|
||||
return qName.equals(getQualifiedName(type));
|
||||
}
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.containers.hash.HashMap;
|
||||
import com.intellij.util.containers.hash.HashSet;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
@@ -286,6 +287,8 @@ public class ClosureParameterEnhancer extends AbstractClosureParameterEnhancer {
|
||||
return PsiImplUtil.normalizeWildcardTypeByPosition(type, qualifier);
|
||||
}
|
||||
|
||||
@Contract("null,_ -> null")
|
||||
@Nullable
|
||||
public static PsiType findTypeForIteration(@Nullable PsiType type, @NotNull PsiElement context) {
|
||||
final PsiManager manager = context.getManager();
|
||||
final GlobalSearchScope resolveScope = context.getResolveScope();
|
||||
|
||||
Reference in New Issue
Block a user