some methods returning arrays marked notnull

This commit is contained in:
Alexey Kudravtsev
2017-03-15 13:36:23 +03:00
parent 242cfc263d
commit 2f9ac87d26
245 changed files with 410 additions and 45 deletions
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class RegExpBraceMatcher implements PairedBraceMatcher {
@NotNull
@Override
public BracePair[] getPairs() {
return new BracePair[]{
@@ -31,8 +31,10 @@ public abstract class GuessManager {
return ServiceManager.getService(project, GuessManager.class);
}
@NotNull
public abstract PsiType[] guessContainerElementType(PsiExpression containerExpr, TextRange rangeToIgnore);
@NotNull
public abstract PsiType[] guessTypeToCast(PsiExpression expr);
@NotNull
@@ -79,6 +79,7 @@ public class GuessManagerImpl extends GuessManager {
myProject = project;
}
@NotNull
@Override
public PsiType[] guessContainerElementType(PsiExpression containerExpr, TextRange rangeToIgnore) {
HashSet<PsiType> typesSet = new HashSet<>();
@@ -117,6 +118,7 @@ public class GuessManagerImpl extends GuessManager {
return null;
}
@NotNull
@Override
public PsiType[] guessTypeToCast(PsiExpression expr) { //TODO : make better guess based on control flow
LinkedHashSet<PsiType> types = new LinkedHashSet<>();
@@ -115,6 +115,7 @@ public class RedundantSuppressInspectionBase extends GlobalInspectionTool {
}
@NotNull
@Nullable
public ProblemDescriptor[] checkElement(@NotNull final PsiElement psiElement, @NotNull final InspectionManager manager) {
final Map<PsiElement, Collection<String>> suppressedScopes = new THashMap<>();
psiElement.accept(new JavaRecursiveElementWalkingVisitor() {
@@ -296,6 +297,7 @@ public class RedundantSuppressInspectionBase extends GlobalInspectionTool {
return new GlobalInspectionContextBase(file.getProject());
}
@NotNull
protected InspectionToolWrapper[] getInspectionTools(PsiElement psiElement, @NotNull InspectionManager manager) {
// todo for what we create modifiable model here?
return new InspectionProfileModifiableModel(InspectionProjectProfileManager.getInstance(manager.getProject()).getCurrentProfile()).getInspectionTools(psiElement);
@@ -18,6 +18,7 @@ package com.intellij.codeInspection.bytecodeAnalysis;
import com.intellij.codeInspection.bytecodeAnalysis.asm.AnalyzerExt;
import com.intellij.codeInspection.bytecodeAnalysis.asm.InterpreterExt;
import com.intellij.codeInspection.bytecodeAnalysis.asm.LiteAnalyzerExt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.org.objectweb.asm.Opcodes;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.tree.*;
@@ -165,6 +166,7 @@ class NullableMethodAnalysis {
return FinalBot;
}
@NotNull
private static int[] mapOrigins(boolean[] origins) {
int[] originsMapping = new int[origins.length];
int mapped = 0;
@@ -151,6 +151,7 @@ public class ProjectBytecodeAnalysis {
* @param methodAnnotations inferred annotations
* @return Psi annotations
*/
@NotNull
private PsiAnnotation[] toPsi(HKey primaryKey, MethodAnnotations methodAnnotations) {
boolean notNull = methodAnnotations.notNulls.contains(primaryKey);
boolean nullable = methodAnnotations.nullables.contains(primaryKey);
@@ -201,6 +202,7 @@ public class ProjectBytecodeAnalysis {
* @param parameterAnnotations inferred parameter annotations
* @return Psi annotations
*/
@NotNull
private PsiAnnotation[] toPsi(ParameterAnnotations parameterAnnotations) {
if (parameterAnnotations.notNull) {
return new PsiAnnotation[]{
@@ -61,6 +61,7 @@ public class UncheckedWarningLocalInspectionBase extends BaseJavaBatchLocalInspe
return uncheckedCb;
}
@NotNull
private static LocalQuickFix[] getChangeVariableTypeFixes(@NotNull PsiVariable parameter, @Nullable PsiType itemType, LocalQuickFix[] generifyFixes) {
if (itemType instanceof PsiMethodReferenceType) return generifyFixes;
LOG.assertTrue(parameter.isValid());
@@ -148,8 +149,9 @@ public class UncheckedWarningLocalInspectionBase extends BaseJavaBatchLocalInspe
};
}
@NotNull
protected LocalQuickFix[] createFixes() {
return null;
return LocalQuickFix.EMPTY_ARRAY;
}
private static String isMethodCalledOnRawType(PsiElement expression) {
@@ -223,7 +223,8 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
return null;
}
private static CommonProblemDescriptor[] createDescriptions(RefElement refElement, String access,
@NotNull
private static CommonProblemDescriptor[] createDescriptions(RefElement refElement, String access,
@NotNull InspectionManager manager,
@NotNull GlobalInspectionContext globalContext) {
final PsiElement element = refElement.getElement();
@@ -250,7 +251,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
new AcceptSuggestedAccess(globalContext.getRefManager(), access, quickFixName),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false)};
}
return null;
return CommonProblemDescriptor.EMPTY_ARRAY;
}
int getMinVisibilityLevel(PsiMember member) {
@@ -43,14 +43,14 @@ import java.util.*;
public class DuplicatesFinder {
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.util.duplicates.DuplicatesFinder");
public static final Key<Pair<PsiVariable, PsiType>> PARAMETER = Key.create("PARAMETER");
private final PsiElement[] myPattern;
@NotNull private final PsiElement[] myPattern;
private final InputVariables myParameters;
private final List<? extends PsiVariable> myOutputParameters;
private final List<PsiElement> myPatternAsList;
private boolean myMultipleExitPoints;
@Nullable private final ReturnValue myReturnValue;
public DuplicatesFinder(PsiElement[] pattern,
public DuplicatesFinder(@NotNull PsiElement[] pattern,
InputVariables parameters,
@Nullable ReturnValue returnValue,
@NotNull List<? extends PsiVariable> outputParameters
@@ -102,6 +102,7 @@ public class DuplicatesFinder {
return myParameters;
}
@NotNull
public PsiElement[] getPattern() {
return myPattern;
}
@@ -674,6 +675,7 @@ public class DuplicatesFinder {
return false;
}
@NotNull
public static PsiElement[] getFilteredChildren(PsiElement element1) {
PsiElement[] children1 = element1.getChildren();
ArrayList<PsiElement> array = new ArrayList<>();
@@ -15,6 +15,8 @@
*/
package org.jetbrains.java.generate.config;
import org.jetbrains.annotations.NotNull;
/**
* Options for the various policies.
*/
@@ -30,6 +32,7 @@ public class PolicyOptions {
* Gets the options for the the insert new method policy.
* @return the options for the the insert new method policy.
*/
@NotNull
public static InsertWhere[] getNewMethodOptions() {
return newMethodOptions;
}
@@ -38,6 +41,7 @@ public class PolicyOptions {
* Gets the options for the the conflict resolution policy.
* @return the options for the the conflict resolution policy.
*/
@NotNull
public static DuplicationPolicy[] getConflictOptions() {
return conflictOptions;
}
@@ -18,7 +18,6 @@ package org.jetbrains.java.generate.psi;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.projectRoots.JdkVersionUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
@@ -643,6 +642,7 @@ public class PsiAdapter {
* @param clazz the class
* @return the names.
*/
@NotNull
public static String[] getImplementsClassnames(PsiClass clazz) {
PsiClass[] interfaces = clazz.getInterfaces();
@@ -202,6 +202,7 @@ public class CodeInsightUtil {
};
}
@NotNull
public static PsiExpression[] findExpressionOccurrences(PsiElement scope, PsiExpression expr) {
List<PsiExpression> array = new ArrayList<>();
addExpressionOccurrences(RefactoringUtil.unparenthesizeExpression(expr), array, scope);
@@ -231,6 +232,7 @@ public class CodeInsightUtil {
}
}
@NotNull
public static PsiExpression[] findReferenceExpressions(PsiElement scope, PsiElement referee) {
ArrayList<PsiElement> array = new ArrayList<>();
if (scope != null) {
@@ -29,6 +29,7 @@ import java.util.*;
public class ExpectedTypeUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.ExpectedTypeUtil");
@NotNull
public static ExpectedTypeInfo[] intersect(List<ExpectedTypeInfo[]> typeInfos) {
if (typeInfos.isEmpty()) return ExpectedTypeInfo.EMPTY_ARRAY;
@@ -88,6 +89,7 @@ public class ExpectedTypeUtil {
return myInfos.iterator();
}
@NotNull
public ExpectedTypeInfo[] toArray() {
return myInfos.toArray(new ExpectedTypeInfo[myInfos.size()]);
}
@@ -155,6 +155,7 @@ public class ExpectedTypesProvider {
return visitor.getResult();
}
@NotNull
public static PsiType[] processExpectedTypes(@NotNull ExpectedTypeInfo[] infos,
@NotNull PsiTypeVisitor<PsiType> visitor, @NotNull Project project) {
LinkedHashSet<PsiType> set = new LinkedHashSet<>();
@@ -280,6 +280,7 @@ public class JavaTargetElementEvaluator extends TargetElementEvaluatorEx2 implem
return super.acceptImplementationForReference(reference, element);
}
@Nullable
private static PsiClass[] getClassesWithMember(final PsiReference reference, final PsiMember member) {
return ApplicationManager.getApplication().runReadAction(new Computable<PsiClass[]>() {
@Override
@@ -92,6 +92,7 @@ public class JavaCompletionSorting {
return result.withRelevanceSorter(sorter);
}
@NotNull
private static ExpectedTypeInfo[] getExpectedTypesWithDfa(CompletionParameters parameters, PsiElement position) {
if (psiElement().beforeLeaf(psiElement().withText(".")).accepts(position)) {
return ExpectedTypeInfo.EMPTY_ARRAY;
@@ -315,6 +315,7 @@ public class JavaLineMarkerProvider extends LineMarkerProviderDescriptor {
return "Java line markers";
}
@NotNull
@Override
public Option[] getOptions() {
return new Option[] {myLambdaOption, myOverriddenOption, myImplementedOption, myOverridingOption, myImplementingOption};
@@ -111,6 +111,7 @@ public class AddExceptionToThrowsFix extends BaseIntentionAction {
});
}
@NotNull
private static PsiMethod[] getSuperMethods(@NotNull PsiMethod targetMethod) {
List<PsiMethod> result = new ArrayList<>();
collectSuperMethods(targetMethod, result);
@@ -125,6 +125,7 @@ public class AddReturnFix implements IntentionAction {
return null;
}
@NotNull
private static PsiVariable[] getDeclaredVariables(PsiMethod method) {
List<PsiVariable> variables = new ArrayList<>();
PsiStatement[] statements = method.getBody().getStatements();
@@ -255,6 +255,7 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
return null;
}
@Nullable
protected ParameterInfoImpl[] getNewParametersInfo(PsiExpression[] expressions,
PsiMethod targetMethod,
PsiSubstitutor substitutor) {
@@ -263,6 +264,7 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
new HashSet<>());
}
@Nullable
private ParameterInfoImpl[] getNewParametersInfo(PsiExpression[] expressions,
PsiMethod targetMethod,
PsiSubstitutor substitutor,
@@ -509,6 +509,7 @@ public class CreateFromUsageUtils {
return result.toArray(new PsiReferenceExpression[result.size()]);
}
@NotNull
static PsiVariable[] guessMatchingVariables(final PsiExpression expression) {
List<ExpectedTypeInfo[]> typesList = new ArrayList<>();
List<String> expectedMethodNames = new ArrayList<>();
@@ -616,6 +617,7 @@ public class CreateFromUsageUtils {
return compareMembers(c1, c2, expression);
}
@NotNull
private static ExpectedTypeInfo[] equalsExpectedTypes(PsiMethodCallExpression methodCall) {
final PsiType[] argumentTypes = methodCall.getArgumentList().getExpressionTypes();
if (argumentTypes.length != 1) {
@@ -169,6 +169,7 @@ public class InitializeFinalFieldInConstructorFix implements IntentionAction {
return Collections.emptyList();
}
@NotNull
private static PsiMethodMember[] toPsiMethodMemberArray(@NotNull PsiMethod[] methods) {
final PsiMethodMember[] result = new PsiMethodMember[methods.length];
for (int i = 0; i < methods.length; i++) {
@@ -177,6 +178,7 @@ public class InitializeFinalFieldInConstructorFix implements IntentionAction {
return result;
}
@NotNull
private static PsiMethod[] toPsiMethodArray(@NotNull List<PsiMethodMember> methodMembers) {
final PsiMethod[] result = new PsiMethod[methodMembers.size()];
int i = 0;
@@ -191,6 +193,7 @@ public class InitializeFinalFieldInConstructorFix implements IntentionAction {
ApplicationManager.getApplication().runWriteAction(() -> defaultConstructorFix.invoke(project, editor, file));
}
@NotNull
private static PsiMethod[] filterIfFieldAlreadyAssigned(@NotNull PsiField field, @NotNull PsiMethod[] ctors) {
final List<PsiMethod> result = new ArrayList<>(Arrays.asList(ctors));
for (PsiReference reference : ReferencesSearch.search(field, new LocalSearchScope(ctors))) {
@@ -120,6 +120,7 @@ public class MethodParameterFix extends LocalQuickFixAndIntentionActionOnPsiElem
return false;
}
@NotNull
private ParameterInfoImpl[] getNewParametersInfo(PsiMethod method) throws IncorrectOperationException {
List<ParameterInfoImpl> result = new ArrayList<>();
PsiParameter[] parameters = method.getParameterList().getParameters();
@@ -88,6 +88,7 @@ public class RemoveUnusedParameterFix extends LocalQuickFixAndIntentionActionOnP
processor.run();
}
@NotNull
public static ParameterInfoImpl[] getNewParametersInfo(PsiMethod method, PsiParameter parameterToRemove) {
List<ParameterInfoImpl> result = new ArrayList<>();
PsiParameter[] parameters = method.getParameterList().getParameters();
@@ -88,6 +88,7 @@ public class RenameWrongRefFix implements IntentionAction {
return !CreateFromUsageUtils.isValidReference(myRefExpr, myUnresolvedOnly);
}
@NotNull
private LookupElement[] collectItems() {
Set<LookupElement> items = new LinkedHashSet<>();
boolean qualified = myRefExpr.getQualifierExpression() != null;
@@ -136,6 +136,7 @@ public abstract class CopyPasteReferenceProcessor<TRef extends PsiElement> exten
qClassName, staticMemberName));
}
@NotNull
protected abstract TRef[] findReferencesToRestore(PsiFile file,
RangeMarker bounds,
ReferenceData[] referenceData);
@@ -154,7 +155,7 @@ public abstract class CopyPasteReferenceProcessor<TRef extends PsiElement> exten
protected abstract void restoreReferences(ReferenceData[] referenceData,
TRef[] refs);
private static void askReferencesToRestore(Project project, PsiElement[] refs,
private static void askReferencesToRestore(Project project, @NotNull PsiElement[] refs,
ReferenceData[] referenceData) {
PsiManager manager = PsiManager.getInstance(project);
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@@ -59,6 +60,7 @@ public class JavaCopyPasteReferenceProcessor extends CopyPasteReferenceProcessor
}
@NotNull
@Override
protected PsiJavaCodeReferenceElement[] findReferencesToRestore(PsiFile file,
RangeMarker bounds,
@@ -15,6 +15,8 @@
*/
package com.intellij.codeInsight.editorActions;
import org.jetbrains.annotations.NotNull;
import java.awt.datatransfer.DataFlavor;
import java.io.Serializable;
@@ -24,7 +26,7 @@ import java.io.Serializable;
public class ReferenceTransferableData implements TextBlockTransferableData, Cloneable, Serializable {
private final ReferenceData[] myReferenceDatas;
public ReferenceTransferableData(final ReferenceData[] referenceDatas) {
public ReferenceTransferableData(@NotNull ReferenceData[] referenceDatas) {
myReferenceDatas = referenceDatas;
}
@@ -65,6 +67,7 @@ public class ReferenceTransferableData implements TextBlockTransferableData, Clo
return new ReferenceTransferableData(newReferenceData);
}
@NotNull
public ReferenceData[] getData() {
return myReferenceDatas;
}
@@ -27,6 +27,7 @@ import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBList;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
@@ -97,6 +98,7 @@ class RestoreReferencesDialog extends DialogWrapper {
return "#com.intellij.codeInsight.editorActions.RestoreReferencesDialog";
}
@NotNull
public Object[] getSelectedElements(){
return mySelectedElements;
}
@@ -35,6 +35,7 @@ public class JavaBraceMatcher implements PairedBraceMatcher {
new BracePair(JavaTokenType.LT, JavaTokenType.GT, false)
};
@NotNull
@Override
public BracePair[] getPairs() {
return pairs;
@@ -19,6 +19,7 @@ import com.intellij.codeInspection.ex.InspectionElementsMergerBase;
import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
import com.intellij.openapi.util.WriteExternalException;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
public class UnusedDeclarationInspectionMerger extends InspectionElementsMergerBase {
private static final String UNUSED_SYMBOL = "UNUSED_SYMBOL";
@@ -29,6 +30,7 @@ public class UnusedDeclarationInspectionMerger extends InspectionElementsMergerB
return UnusedDeclarationInspectionBase.SHORT_NAME;
}
@NotNull
@Override
public String[] getSourceToolNames() {
return new String[] {UNUSED_SYMBOL, UNUSED_DECLARATION};
@@ -59,6 +59,7 @@ import com.intellij.ui.TitledSeparator;
import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewUtil;
import com.intellij.usages.*;
import com.intellij.util.ObjectUtils;
import com.intellij.util.Processor;
import com.intellij.util.SequentialModalProgressTask;
import com.intellij.util.containers.ContainerUtil;
@@ -299,9 +300,10 @@ public class InferNullityAnnotationsAction extends BaseAnalysisAction {
@NotNull
private Factory<UsageSearcher> rerunFactory(@NotNull final Project project, @NotNull final AnalysisScope scope) {
return () -> new UsageInfoSearcherAdapter() {
@NotNull
@Override
protected UsageInfo[] findUsages() {
return InferNullityAnnotationsAction.this.findUsages(project, scope, scope.getFileCount());
return ObjectUtils.notNull(InferNullityAnnotationsAction.this.findUsages(project, scope, scope.getFileCount()), UsageInfo.EMPTY_ARRAY);
}
@Override
@@ -16,6 +16,7 @@
package com.intellij.codeInspection.java18api;
import com.intellij.codeInspection.ex.InspectionElementsMerger;
import org.jetbrains.annotations.NotNull;
public class Java8MapApiInspectionMerger extends InspectionElementsMerger {
private static final String COLLECTION_API_INSPECTION = "Java8CollectionsApi";
@@ -26,6 +27,7 @@ public class Java8MapApiInspectionMerger extends InspectionElementsMerger {
return Java8MapApiInspection.SHORT_NAME;
}
@NotNull
@Override
public String[] getSourceToolNames() {
return new String[] {COLLECTION_API_INSPECTION, REPLACE_MAP_GET_INSPECTION};
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.daemon.impl.quickfix.GenerifyFileFix;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.openapi.util.Pass;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
@@ -30,6 +31,7 @@ import java.awt.*;
*/
public class UncheckedWarningLocalInspection extends UncheckedWarningLocalInspectionBase {
@NotNull
@Override
protected LocalQuickFix[] createFixes() {
return new LocalQuickFix[]{new GenerifyFileFix()};
@@ -282,7 +282,8 @@ public class PackageUtil {
return psiDirectory;
}
private static PsiDirectory[] filterSourceDirectories(PsiDirectory baseDir, Project project, PsiDirectory[] moduleDirectories) {
@NotNull
private static PsiDirectory[] filterSourceDirectories(PsiDirectory baseDir, Project project, @NotNull PsiDirectory[] moduleDirectories) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (fileIndex.isInTestSourceContent(baseDir.getVirtualFile())) {
List<PsiDirectory> result = new ArrayList<>();
@@ -296,6 +297,7 @@ public class PackageUtil {
return moduleDirectories;
}
@NotNull
private static PsiDirectory[] getPackageDirectoriesInModule(PsiPackage rootPackage, Module module) {
return rootPackage.getDirectories(GlobalSearchScope.moduleScope(module));
}
@@ -40,11 +40,13 @@ public class ModulePackageIndexImpl extends ModulePackageIndex {
}
};
@NotNull
@Override
public Query<VirtualFile> getDirsByPackageName(@NotNull String packageName, boolean includeLibrarySources) {
return new FilteredQuery<>(myDirectoryIndex.getDirectoriesByPackageName(packageName, includeLibrarySources), myDirCondition);
}
@NotNull
@Override
public VirtualFile[] getDirectoriesByPackageName(@NotNull String packageName, boolean includeLibrarySources) {
return getDirsByPackageName(packageName, includeLibrarySources).toArray(VirtualFile.EMPTY_ARRAY);
@@ -64,6 +64,7 @@ public abstract class AbstractQualifiedReference<T extends AbstractQualifiedRefe
return this;
}
@NotNull
protected abstract ResolveResult[] resolveInner();
@Override
@@ -22,6 +22,7 @@ import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiType;
import com.intellij.psi.util.PsiTreeUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import java.util.Set;
@@ -34,6 +35,7 @@ import java.util.Set;
*/
public class ExpectedTypesGetter {
@NotNull
public static PsiType[] getExpectedTypes(final PsiElement context, boolean defaultTypes) {
PsiExpression expression = PsiTreeUtil.getContextOfType(context, PsiExpression.class, true);
if(expression == null) return PsiType.EMPTY_ARRAY;
@@ -41,6 +43,7 @@ public class ExpectedTypesGetter {
return extractTypes(ExpectedTypesProvider.getExpectedTypes(expression, true), defaultTypes);
}
@NotNull
public static PsiType[] extractTypes(ExpectedTypeInfo[] infos, boolean defaultTypes) {
Set<PsiType> result = new THashSet<>(infos.length);
for (ExpectedTypeInfo info : infos) {
@@ -18,6 +18,7 @@ package com.intellij.psi.filters.getters;
import com.intellij.psi.*;
import com.intellij.psi.filters.FilterUtil;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
/**
* Created by IntelliJ IDEA.
@@ -27,6 +28,7 @@ import com.intellij.psi.util.PsiTreeUtil;
* To change this template use Options | File Templates.
*/
public class InstanceOfLeftPartTypeGetter {
@NotNull
public static PsiType[] getLeftTypes(PsiElement context) {
if((context = FilterUtil.getPreviousElement(context, true)) == null) return PsiType.EMPTY_ARRAY;
if(!PsiKeyword.INSTANCEOF.equals(context.getText())) return PsiType.EMPTY_ARRAY;
@@ -89,6 +89,7 @@ public class BeanPropertyElement extends FakePsiElement implements PsiMetaOwner,
}
@NotNull
@Override
public Object[] getDependences() {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
@@ -19,6 +19,7 @@ import com.intellij.util.ArrayUtil;
import gnu.trove.TIntArrayList;
import gnu.trove.TIntIntHashMap;
import gnu.trove.TIntObjectHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -28,6 +29,7 @@ public class SmartIntToIntArrayMap {
@Nullable TIntObjectHashMap<TIntArrayList> myMultipleValuesMap;
TIntIntHashMap mySingleValueMap = new TIntIntHashMap(10, 0.9f);
@NotNull
public int[] keys() {
int[] multiKeys = myMultipleValuesMap != null ? myMultipleValuesMap.keys() : ArrayUtil.EMPTY_INT_ARRAY;
int[] singleKeys = mySingleValueMap.keys();
@@ -95,6 +97,7 @@ public class SmartIntToIntArrayMap {
}
}
@NotNull
public int[] get(int key) {
if (mySingleValueMap.containsKey(key)) {
int id = mySingleValueMap.get(key);
@@ -104,6 +107,7 @@ public class SmartIntToIntArrayMap {
return getFromMultimap(key);
}
@NotNull
private int[] getFromMultimap(int key) {
TIntArrayList res = myMultipleValuesMap != null ? myMultipleValuesMap.get(key) : null;
if (res == null) return ArrayUtil.EMPTY_INT_ARRAY;
@@ -127,6 +127,7 @@ public class MigrationClassImpl extends LightElement implements PsiClass{
.findClass(CommonClassNames.JAVA_LANG_OBJECT, GlobalSearchScope.allScope(myManager.getProject()));
}
@NotNull
@Override
public PsiClass[] getInterfaces() {
return PsiClass.EMPTY_ARRAY;
@@ -50,6 +50,7 @@ public class MigrationPackageImpl extends PsiPackageImpl implements PsiPackage {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public VirtualFile[] occursInPackagePrefixes() {
return VirtualFile.EMPTY_ARRAY;
@@ -30,7 +30,6 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.TextRange;
@@ -268,6 +267,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return context == null ? JavaPsiFacade.getInstance(getElement().getProject()).findPackage("") : context;
}
@Nullable
public String[] getExtendClassNames() {
return JavaClassReferenceProvider.EXTEND_CLASS_NAMES.getValue(getOptions());
}
@@ -115,6 +115,7 @@ public class JavaClassReferenceProvider extends GenericReferenceProvider impleme
return getReferencesByElement(element);
}
@NotNull
public PsiReference[] getReferencesByElement(@NotNull PsiElement element) {
final int offsetInElement = ElementManipulators.getOffsetInElement(element);
final String text = ElementManipulators.getValueText(element);
@@ -39,6 +39,7 @@ public class PathListReferenceProvider extends PsiReferenceProvider {
return true;
}
@NotNull
public PsiReference[] getReferencesByElement(@NotNull PsiElement element) {
PsiReference[] result = PsiReference.EMPTY_ARRAY;
@@ -75,6 +76,7 @@ public class PathListReferenceProvider extends PsiReferenceProvider {
return ',';
}
@NotNull
protected PsiReference[] createReferences(@NotNull PsiElement element, String s, int offset, final boolean soft) {
int contentOffset = StringUtil.findFirst(s, CharFilter.NOT_WHITESPACE_FILTER);
if (contentOffset >= 0) {
@@ -54,6 +54,7 @@ public class AnnotatedElementsSearch extends ExtensibleQueryFactory<PsiModifierL
return myScope;
}
@NotNull
public Class<? extends PsiModifierListOwner>[] getTypes() {
return myTypes;
}
@@ -27,11 +27,13 @@ public class ProjectPackageIndexImpl extends PackageIndex {
myDirectoryIndex = directoryIndex;
}
@NotNull
@Override
public VirtualFile[] getDirectoriesByPackageName(@NotNull String packageName, boolean includeLibrarySources) {
return getDirsByPackageName(packageName, includeLibrarySources).toArray(VirtualFile.EMPTY_ARRAY);
}
@NotNull
@Override
public Query<VirtualFile> getDirsByPackageName(@NotNull String packageName, boolean includeLibrarySources) {
return myDirectoryIndex.getDirectoriesByPackageName(packageName, includeLibrarySources);
@@ -37,6 +37,7 @@ public abstract class PackageIndex {
* @param includeLibrarySources if true, directories under library sources are included in the returned list.
* @return the list of directories.
*/
@NotNull
public abstract VirtualFile[] getDirectoriesByPackageName(@NotNull String packageName, boolean includeLibrarySources);
/**
@@ -47,5 +48,6 @@ public abstract class PackageIndex {
* @param includeLibrarySources if true, directories under library sources are included in the returned list.
* @return the query returning the list of directories.
*/
@NotNull
public abstract Query<VirtualFile> getDirsByPackageName(@NotNull String packageName, boolean includeLibrarySources);
}
@@ -33,6 +33,7 @@ public abstract class HierarchicalMethodSignature extends MethodSignatureBackedB
getParameterTypes(signature.getMethod()), signature.getTypeParameters());
}
@NotNull
private static PsiType[] getParameterTypes(PsiMethod method) {
final PsiParameter[] parameters = method.getParameterList().getParameters();
final PsiType[] paramTypes = PsiType.createArray(parameters.length);
@@ -554,6 +554,7 @@ public class LambdaUtil {
typeByExpression instanceof PsiLambdaParameterType;
}
@NotNull
public static PsiReturnStatement[] getReturnStatements(PsiLambdaExpression lambdaExpression) {
final PsiElement body = lambdaExpression.getBody();
return body instanceof PsiCodeBlock ? PsiUtil.findReturnStatements((PsiCodeBlock)body) : PsiReturnStatement.EMPTY_ARRAY;
@@ -116,6 +116,7 @@ public interface PsiClass
*
* @return the list of interfaces.
*/
@NotNull
PsiClass[] getInterfaces();
/**
@@ -124,7 +125,8 @@ public interface PsiClass
* @return the list of classes or interfaces. May return zero elements when jdk is
* not configured, so no java.lang.Object is found
*/
@NotNull PsiClass[] getSupers();
@NotNull
PsiClass[] getSupers();
/**
* Returns the list of class types for the classes and interfaces extended or
@@ -15,12 +15,10 @@
*/
package com.intellij.psi;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
@@ -50,7 +48,7 @@ public class PsiIntersectionType extends PsiType.Stub {
}
@NotNull
public static PsiType createIntersection(boolean flatten, PsiType... conjuncts) {
public static PsiType createIntersection(boolean flatten, @NotNull PsiType... conjuncts) {
assert conjuncts.length > 0;
if (flatten) {
conjuncts = flattenAndRemoveDuplicates(conjuncts);
@@ -59,7 +57,8 @@ public class PsiIntersectionType extends PsiType.Stub {
return new PsiIntersectionType(conjuncts);
}
private static PsiType[] flattenAndRemoveDuplicates(final PsiType[] conjuncts) {
@NotNull
private static PsiType[] flattenAndRemoveDuplicates(@NotNull PsiType[] conjuncts) {
try {
final Set<PsiType> flattenConjuncts = PsiCapturedWildcardType.guard.doPreventingRecursion(conjuncts, true, () -> flatten(conjuncts, ContainerUtil.<PsiType>newLinkedHashSet()));
if (flattenConjuncts == null) {
@@ -90,6 +90,7 @@ public interface PsiPackage extends PsiCheckedRenameElement, NavigationItem, Psi
*
* @since 14.1
*/
@NotNull
PsiFile[] getFiles(@NotNull GlobalSearchScope scope);
/**
@@ -114,6 +115,7 @@ public interface PsiPackage extends PsiCheckedRenameElement, NavigationItem, Psi
*
* @return the array of virtual files for the source roots.
*/
@NotNull
VirtualFile[] occursInPackagePrefixes();
@Override
@@ -15,6 +15,8 @@
*/
package com.intellij.psi;
import org.jetbrains.annotations.NotNull;
/**
* Represents a list of generic type parameters for a class or method.
*
@@ -26,6 +28,7 @@ public interface PsiTypeParameterList extends PsiElement {
*
* @return the array of type parameters.
*/
@NotNull
PsiTypeParameter[] getTypeParameters();
/**
@@ -436,6 +436,7 @@ public class MethodCandidateInfo extends CandidateInfo{
}
}
@Nullable
public PsiType[] getArgumentTypes() {
return myArgumentTypes;
}
@@ -47,6 +47,7 @@ public interface PsiDocTag extends PsiElement, PsiNamedElement {
/**
* Returns the list of all elements representing the contents of a tag.
*/
@NotNull
PsiElement[] getDataElements();
/**
@@ -334,8 +334,9 @@ public class PsiTypesUtil {
return parameterType;
}
@NotNull
public static PsiTypeParameter[] filterUnusedTypeParameters(final PsiType superReturnTypeInBaseClassType,
final PsiTypeParameter[] typeParameters) {
@NotNull PsiTypeParameter[] typeParameters) {
if (typeParameters.length == 0) return typeParameters;
final Set<PsiTypeParameter> usedParameters = new HashSet<>();
@@ -49,11 +49,13 @@ public class CorePackageIndex extends PackageIndex {
return result;
}
@NotNull
@Override
public VirtualFile[] getDirectoriesByPackageName(@NotNull String packageName, boolean includeLibrarySources) {
return getDirsByPackageName(packageName, includeLibrarySources).toArray(VirtualFile.EMPTY_ARRAY);
}
@NotNull
@Override
public Query<VirtualFile> getDirsByPackageName(@NotNull String packageName, boolean includeLibrarySources) {
return new CollectionQuery<>(findDirectoriesByPackageName(packageName));
@@ -409,6 +409,7 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
}
}
@NotNull
private static PsiTypeParameter[] getAllTypeParams(PsiTypeParameterListOwner listOwner, PsiClass containingClass) {
Set<PsiTypeParameter> params = new LinkedHashSet<>();
Collections.addAll(params, containingClass.getTypeParameters());
@@ -16,6 +16,8 @@
package com.intellij.psi.controlFlow;
import org.jetbrains.annotations.NotNull;
class CompositeInstructionClientVisitor extends InstructionClientVisitor<Object[]> {
private final InstructionClientVisitor[] myVisitors;
@@ -24,6 +26,7 @@ class CompositeInstructionClientVisitor extends InstructionClientVisitor<Object[
}
@Override
@NotNull
public Object[] getResult() {
Object[] result = new Object[myVisitors.length];
for (int i = 0; i < myVisitors.length; i++) {
@@ -343,6 +343,7 @@ public class ControlFlowUtil {
return array;
}
@NotNull
public static PsiVariable[] getOutputVariables(ControlFlow flow, int start, int end, int[] exitPoints) {
Collection<PsiVariable> writtenVariables = getWrittenVariables(flow, start, end, false);
ArrayList<PsiVariable> array = new ArrayList<>();
@@ -1008,6 +1009,7 @@ public class ControlFlowUtil {
return visitor.getResult().booleanValue();
}
@NotNull
public static Object[] getAllWorldProblemsAtOnce(final ControlFlow flow) {
InstructionClientVisitor[] visitors = {
new ReturnPresentClientVisitor(flow),
@@ -2044,6 +2046,7 @@ public class ControlFlowUtil {
}
}
@NotNull
int[] getNextOffsets(int offset) {
return nextOffsets[offset] != null ? nextOffsets[offset] : ArrayUtil.EMPTY_INT_ARRAY;
}
@@ -454,6 +454,7 @@ public class DefUseUtil {
}
@NotNull
private static IntArrayList[] getBackwardTraces(final List<Instruction> instructions) {
final IntArrayList[] states = new IntArrayList[instructions.size()];
for (int i = 0; i < states.length; i++) {
@@ -49,6 +49,7 @@ public class ReturnInstruction extends GoToInstruction {
}
}
@NotNull
public int[] getPossibleReturnOffsets() {
return offset == 0 ?
new int[]{
@@ -331,6 +331,7 @@ public class PsiImplUtil {
}
/** @deprecated use {@link AnnotationTargetUtil#getTargetsForLocation(PsiAnnotationOwner)} (to be removed ion IDEA 17) */
@NotNull
public static PsiAnnotation.TargetType[] getTargetsForLocation(@Nullable PsiAnnotationOwner owner) {
return AnnotationTargetUtil.getTargetsForLocation(owner);
}
@@ -560,6 +561,7 @@ public class PsiImplUtil {
return null;
}
@NotNull
public static PsiStatement[] getChildStatements(@NotNull CompositeElement psiCodeBlock) {
ApplicationManager.getApplication().assertReadAccessAllowed();
// no lock is needed because all chameleons are expanded already
@@ -713,6 +715,7 @@ public class PsiImplUtil {
return multiResolveImpl(manager.getProject(), psiFile, element, incompleteCode, resolver);
}
@NotNull
public static <T extends PsiJavaCodeReferenceElement> JavaResolveResult[] multiResolveImpl(@NotNull Project project,
@NotNull PsiFile psiFile,
@NotNull T element,
@@ -126,6 +126,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
return PsiClassImplUtil.getSuperClass(this);
}
@NotNull
@Override
public PsiClass[] getInterfaces() {
return PsiClassImplUtil.getInterfaces(this);
@@ -100,6 +100,7 @@ class ClsDocTagImpl extends ClsElementImpl implements PsiDocTag {
return myNameElement;
}
@NotNull
@Override
public PsiElement[] getDataElements() {
return PsiElement.EMPTY_ARRAY;
@@ -247,6 +247,7 @@ public class ClsTypeParameterImpl extends ClsRepositoryPsiElement<PsiTypeParamet
return PsiClassImplUtil.getSuperClass(this);
}
@NotNull
@Override
public PsiClass[] getInterfaces() {
return PsiClassImplUtil.getInterfaces(this);
@@ -61,6 +61,7 @@ public class ClsTypeParametersListImpl extends ClsRepositoryPsiElement<PsiTypePa
}
}
@NotNull
@Override
public PsiTypeParameter[] getTypeParameters() {
return getStub().getChildrenByType(JavaStubElementTypes.TYPE_PARAMETER, PsiTypeParameter.ARRAY_FACTORY);
@@ -101,6 +101,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
PsiPackageImplementationHelper.getInstance().handleQualifiedNameChange(this, newQualifiedName);
}
@NotNull
@Override
public VirtualFile[] occursInPackagePrefixes() {
return PsiPackageImplementationHelper.getInstance().occursInPackagePrefixes(this);
@@ -162,6 +163,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
return getFacade().getClasses(this, scope);
}
@NotNull
@Override
public PsiFile[] getFiles(@NotNull GlobalSearchScope scope) {
return getFacade().getPackageFiles(this, scope);
@@ -213,6 +215,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
return classes;
}
@NotNull
private PsiClass[] getCachedClassInDumbMode(final String name, GlobalSearchScope scope) {
Map<GlobalSearchScope, Map<String, PsiClass[]>> scopeMap = SoftReference.dereference(myDumbModeFullCache);
if (scopeMap == null) {
@@ -149,6 +149,7 @@ public abstract class AbstractLightClass extends LightElement implements PsiClas
return getDelegate().getSuperClass();
}
@NotNull
@Override
public PsiClass[] getInterfaces() {
return getDelegate().getInterfaces();
@@ -135,6 +135,7 @@ public class LightModifierList extends LightElement implements PsiModifierList {
return buffer.toString();
}
@NotNull
public String[] getModifiers() {
return ArrayUtil.toStringArray(myModifiers);
}
@@ -106,6 +106,7 @@ public abstract class LightPsiClassBase extends LightElement implements PsiClass
return PsiClassImplUtil.getSuperClass(this);
}
@NotNull
@Override
public PsiClass[] getInterfaces() {
return PsiClassImplUtil.getInterfaces(this);
@@ -48,6 +48,7 @@ public class LightTypeParameterListBuilder extends LightElement implements PsiTy
}
}
@NotNull
@Override
public PsiTypeParameter[] getTypeParameters() {
if (cached == null) {
@@ -44,6 +44,7 @@ public class ClassInnerStuffCache {
myClass = aClass;
}
@NotNull
private static <T> T[] copy(T[] value) {
return value.length == 0 ? value : value.clone();
}
@@ -218,6 +218,7 @@ public class PsiClassImpl extends JavaStubPsiElement<PsiClassStub<?>> implements
return PsiClassImplUtil.getSuperClass(this);
}
@NotNull
@Override
public PsiClass[] getInterfaces() {
return PsiClassImplUtil.getInterfaces(this);
@@ -53,6 +53,7 @@ public class PsiClassReferenceType extends PsiClassType.Stub {
myReference = reference;
}
@NotNull
private static PsiAnnotation[] collectAnnotations(PsiJavaCodeReferenceElement reference) {
List<PsiAnnotation> result = null;
for (PsiElement child = reference.getFirstChild(); child != null; child = child.getNextSibling()) {
@@ -135,12 +135,14 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
return null;
}
@NotNull
public static PsiVariable[] getAllVariables(PsiElement scope, PsiElement place) {
final SmartList<PsiVariable> result = new SmartList<>();
scope.processDeclarations(new FilterScopeProcessor<>(ElementClassFilter.VARIABLE, result), ResolveState.initial(), null, place);
return result.toArray(new PsiVariable[result.size()]);
}
@NotNull
public static PsiMethod[] getAllMethods(PsiElement scope, PsiElement place) {
final SmartList<PsiMethod> result = new SmartList<>();
scope.processDeclarations(new FilterScopeProcessor<>(ElementClassFilter.METHOD, result), ResolveState.initial(), null, place);
@@ -57,6 +57,7 @@ public class PsiDocTagImpl extends CompositePsiElement implements PsiDocTag, Con
return (PsiDocTagValue)findPsiChildByType(TAG_VALUE_BIT_SET);
}
@NotNull
@Override
public PsiElement[] getDataElements() {
return getChildrenAsPsiElements(VALUE_BIT_SET, PsiElement.ARRAY_FACTORY);
@@ -59,11 +59,13 @@ public class PsiInlineDocTagImpl extends CompositePsiElement implements PsiInlin
return findPsiChildByType(DOC_TAG_NAME);
}
@NotNull
@Override
public PsiElement[] getDataElements() {
return getChildrenAsPsiElements(VALUE_BIT_SET, PsiElement.ARRAY_FACTORY);
}
@NotNull
public PsiElement[] getDataElementsIgnoreWhitespaces() {
return getChildrenAsPsiElements(VALUE_NO_WHITESPACE_BIT_SET, PsiElement.ARRAY_FACTORY);
}
@@ -99,6 +99,7 @@ public class StaticImportResolveProcessor extends BaseScopeProcessor implements
return super.getHint(hintKey);
}
@NotNull
public JavaResolveResult[] getResults() {
if (myResults.size() + myFieldResults.size() + myClassResult.size() > 1) {
filterInvalid(myResults);
@@ -292,6 +292,7 @@ public class PsiTypeParameterImpl extends JavaStubPsiElement<PsiTypeParameterStu
return PsiClassImplUtil.getSuperClass(this);
}
@NotNull
@Override
public PsiClass[] getInterfaces() {
return PsiClassImplUtil.getInterfaces(this);
@@ -39,6 +39,7 @@ public class PsiTypeParameterListImpl extends JavaStubPsiElement<PsiTypeParamete
super(node);
}
@NotNull
@Override
public PsiTypeParameter[] getTypeParameters() {
return getStubOrPsiChildren(JavaStubElementTypes.TYPE_PARAMETER, PsiTypeParameter.ARRAY_FACTORY);
@@ -43,6 +43,7 @@ public class RedundantSuppressTest extends InspectionTestCase {
new GlobalInspectionToolWrapper(new UnusedDeclarationInspection())};
myWrapper = new GlobalInspectionToolWrapper(new RedundantSuppressInspection() {
@NotNull
@Override
protected InspectionToolWrapper[] getInspectionTools(PsiElement psiElement, @NotNull InspectionManager manager) {
return myInspectionToolWrappers;
@@ -16,6 +16,7 @@ public class JsonBraceMatcher implements PairedBraceMatcher {
new BracePair(JsonElementTypes.L_CURLY, JsonElementTypes.R_CURLY, true)
};
@NotNull
@Override
public BracePair[] getPairs() {
return PAIRS;
@@ -53,6 +53,9 @@
<item name='gnu.trove.TIntHashingStrategy'>
<annotation name='java.lang.FunctionalInterface'/>
</item>
<item name='gnu.trove.TIntObjectHashMap int[] keys()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='gnu.trove.TIntProcedure'>
<annotation name='java.lang.FunctionalInterface'/>
</item>
@@ -16,6 +16,7 @@
package com.intellij.codeInspection;
import com.intellij.openapi.extensions.ExtensionPointName;
import org.jetbrains.annotations.NotNull;
/**
* Plugin's ApplicationComponent or extension that implements this interface will be automatically queried for inspection tool classes.
@@ -27,5 +28,6 @@ public interface InspectionToolProvider {
* Query method for inspection tools provided by a plugin.
* @return classes that extend {@link InspectionProfileEntry}
*/
@NotNull
Class[] getInspectionClasses();
}
@@ -18,6 +18,7 @@ package com.intellij.codeInspection.ex;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.util.ArrayUtilRt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
@@ -49,6 +50,7 @@ public abstract class InspectionElementsMerger {
/**
* @return the shortNames of the merged inspections
*/
@NotNull
public abstract String[] getSourceToolNames();
/**
@@ -56,6 +58,7 @@ public abstract class InspectionElementsMerger {
* If this returns an empty string array, the result of getSourceToolNames() is used instead.
* @return the suppressIds of the merged inspections.
*/
@NotNull
public String[] getSuppressIds() {
return ArrayUtilRt.EMPTY_STRING_ARRAY;
}
@@ -81,6 +81,7 @@ public abstract class NamedScopesHolder implements PersistentStateComponent<Elem
return scopes.toArray(new NamedScope[scopes.size()]);
}
@NotNull
public NamedScope[] getEditableScopes(){
return myScopes.toArray(new NamedScope[myScopes.size()]);
}
@@ -42,6 +42,7 @@ public interface ExternalAnnotatorBatchInspection extends PairedUnfairLocalInspe
/**
* To be invoked during batch run
*/
@NotNull
default ProblemDescriptor[] checkFile(@NotNull PsiFile file,
@NotNull GlobalInspectionContext context,
@NotNull InspectionManager manager) {
@@ -19,6 +19,7 @@ import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.WriteExternalException;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -164,6 +165,7 @@ public abstract class InspectionElementsMergerBase extends InspectionElementsMer
return myMerger.getMergedToolName();
}
@NotNull
@Override
public String[] getSourceToolNames() {
return myMerger.getSourceToolNames();
@@ -594,6 +594,7 @@ public class InspectionProfileImpl extends NewInspectionProfile {
return merger.getMergedToolName();
}
@NotNull
@Override
public String[] getSourceToolNames() {
return merger.getSourceToolNames();
@@ -527,6 +527,7 @@ public class FileReference implements PsiFileReference, FileReferenceOwner, PsiP
}
}
@NotNull
protected static FileReferenceHelper[] getHelpers() {
return FileReferenceHelperRegistrar.getHelpers();
}
@@ -16,6 +16,7 @@
package com.intellij.psi.impl.source.resolve.reference.impl.providers;
import com.intellij.openapi.components.ServiceManager;
import org.jetbrains.annotations.NotNull;
/**
* @author yole
@@ -25,5 +26,6 @@ public abstract class FileReferenceCompletion {
return ServiceManager.getService(FileReferenceCompletion.class);
}
@NotNull
public abstract Object[] getFileReferenceCompletionVariants(FileReference reference);
}
@@ -17,7 +17,6 @@ package com.intellij.psi.impl.source.resolve.reference.impl.providers;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFileSystemItem;
import com.intellij.util.containers.ContainerUtil;
@@ -33,6 +32,7 @@ public class FileReferenceHelperRegistrar {
private FileReferenceHelperRegistrar() {
}
@NotNull
public static FileReferenceHelper[] getHelpers() {
return Extensions.getExtensions(FileReferenceHelper.EP_NAME);
}
@@ -116,6 +116,7 @@ public class PsiEquivalenceUtil {
return areElementsEquivalent(element1, element2, null, false);
}
@NotNull
public static PsiElement[] getFilteredChildren(@NotNull final PsiElement element,
@Nullable Condition<PsiElement> isElementSignificantCondition,
boolean areCommentsSignificant) {
@@ -15,9 +15,12 @@
*/
package com.intellij.codeInsight.controlflow;
import org.jetbrains.annotations.NotNull;
/**
* @author oleg
*/
public interface ControlFlow {
@NotNull
Instruction[] getInstructions();
}
@@ -47,6 +47,7 @@ public class CompositeLanguage extends Language {
return myFilters.remove(filter);
}
@NotNull
public Language[] getLanguageExtensionsForFile(final PsiFile psi) {
final List<Language> extensions = new ArrayList<>(1);
for (LanguageFilter filter : myFilters) {
@@ -32,6 +32,7 @@ public abstract class MetaLanguage extends Language {
super(ID);
}
@NotNull
public static MetaLanguage[] all() {
return Extensions.getExtensions(EP_NAME);
}
@@ -40,6 +40,7 @@ public abstract class FileTypeRegistry {
*
* @return The list of file types.
*/
@NotNull
public abstract FileType[] getRegisteredFileTypes();
/**

Some files were not shown because too many files have changed in this diff Show More