cleanup. Convert empty arrays to constants (new T[0] -> T.EMPTY)

This commit is contained in:
Konstantin Bulenkov
2016-07-07 22:52:00 +02:00
parent 7b54ca9cf4
commit cd8cf62a19
83 changed files with 285 additions and 215 deletions
@@ -466,14 +466,14 @@ final class ImageEditorUI extends JPanel implements DataProvider, CopyProvider,
} else if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) {
return editor != null ? editor.getFile() : null;
} else if (CommonDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) {
return editor != null ? new VirtualFile[]{editor.getFile()} : new VirtualFile[]{};
return editor != null ? new VirtualFile[]{editor.getFile()} : VirtualFile.EMPTY_ARRAY;
} else if (CommonDataKeys.PSI_FILE.is(dataId)) {
return getData(CommonDataKeys.PSI_ELEMENT.getName());
} else if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
VirtualFile file = editor != null ? editor.getFile() : null;
return file != null && file.isValid() ? PsiManager.getInstance(editor.getProject()).findFile(file) : null;
} else if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
return editor != null ? new PsiElement[]{(PsiElement)getData(CommonDataKeys.PSI_ELEMENT.getName())} : new PsiElement[]{} ;
return editor != null ? new PsiElement[]{(PsiElement)getData(CommonDataKeys.PSI_ELEMENT.getName())} : PsiElement.EMPTY_ARRAY;
} else if (PlatformDataKeys.COPY_PROVIDER.is(dataId) && copyPasteSupport != null) {
return this;
} else if (PlatformDataKeys.CUT_PROVIDER.is(dataId) && copyPasteSupport != null) {
@@ -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.
@@ -31,7 +31,6 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.search.PsiElementProcessor;
@@ -176,7 +175,7 @@ public abstract class AbstractPatternBasedConfigurationProducer<T extends Module
ContainerUtil.addIfNotNull(methods, PsiTreeUtil.getParentOfType(editorFile.findElementAt(caret.getOffset()), PsiMethod.class));
}
if (!methods.isEmpty()) {
return collectTestMembers(methods.toArray(new PsiElement[0]), checkAbstract, checkIsTest, processor, classes);
return collectTestMembers(methods.toArray(PsiElement.EMPTY_ARRAY), checkAbstract, checkIsTest, processor, classes);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 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.
@@ -35,11 +35,9 @@ import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.text.UniqueNameGenerator;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -55,7 +53,7 @@ import java.util.List;
*/
public class LibrariesContainerFactory {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory");
private static final Library[] EMPTY_LIBRARIES_ARRAY = new Library[0];
private static final Library[] EMPTY_LIBRARIES_ARRAY = Library.EMPTY_ARRAY;
private LibrariesContainerFactory() {
}
@@ -227,7 +227,7 @@ public class RedundantSuppressInspectionBase extends GlobalInspectionTool {
@Nullable
@Override
public CommonProblemDescriptor[] getDescriptions(@NotNull RefEntity refEntity) {
return new CommonProblemDescriptor[0];
return CommonProblemDescriptor.EMPTY_ARRAY;
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 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.
@@ -80,7 +80,7 @@ public class FunctionalExpressionCompletionProvider extends CompletionProvider<C
final PsiType functionalInterfaceType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(defaultType);
final PsiMethod functionalInterfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(functionalInterfaceType);
if (functionalInterfaceMethod != null) {
PsiParameter[] params = new PsiParameter[0];
PsiParameter[] params = PsiParameter.EMPTY_ARRAY;
final PsiElement originalPosition = parameters.getPosition();
final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(functionalInterfaceMethod, PsiUtil.resolveGenericsClassInType(functionalInterfaceType));
if (!functionalInterfaceMethod.hasTypeParameters()) {
@@ -906,7 +906,7 @@ public class JavaDocInfoGenerator {
generateAnnotations(buffer, owner, ownerModifierList.getAnnotations(), false, generateLink, splitAnnotations, useShortNames);
PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotations(owner);
if (externalAnnotations == null) {
externalAnnotations = new PsiAnnotation[]{};
externalAnnotations = PsiAnnotation.EMPTY_ARRAY;
}
PsiAnnotation[] inferredAnnotations = InferredAnnotationsManager.getInstance(owner.getProject()).findInferredAnnotations(owner);
externalAnnotations = ArrayUtil.mergeArrays(externalAnnotations, inferredAnnotations, PsiAnnotation.ARRAY_FACTORY);
@@ -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.
@@ -33,7 +33,6 @@ import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.usageView.UsageInfo;
import com.intellij.usages.*;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;
public class StaticIconFieldsAction extends AnAction {
@@ -45,7 +44,7 @@ public class StaticIconFieldsAction extends AnAction {
final UsageViewPresentation presentation = new UsageViewPresentation();
presentation.setTabName("Statics");
presentation.setTabText("Statitcs");
final UsageView view = UsageViewManager.getInstance(project).showUsages(UsageTarget.EMPTY_ARRAY, new Usage[0], presentation);
final UsageView view = UsageViewManager.getInstance(project).showUsages(UsageTarget.EMPTY_ARRAY, Usage.EMPTY_ARRAY, presentation);
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Searching icons usages") {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -101,7 +101,7 @@ public class ConvertToInstanceMethodProcessor extends BaseRefactoringProcessor {
final Project project = myMethod.getProject();
final PsiReference[] methodReferences =
ReferencesSearch.search(myMethod, GlobalSearchScope.projectScope(project), false).toArray(new PsiReference[0]);
ReferencesSearch.search(myMethod, GlobalSearchScope.projectScope(project), false).toArray(PsiReference.EMPTY_ARRAY);
List<UsageInfo> result = new ArrayList<UsageInfo>();
for (final PsiReference ref : methodReferences) {
final PsiElement element = ref.getElement();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -104,7 +104,8 @@ public abstract class ExtractSuperBaseProcessor extends TurnRefsToSuperProcessor
@NotNull
protected UsageInfo[] findUsages() {
PsiReference[] refs = ReferencesSearch.search(myClass, GlobalSearchScope.projectScope(myProject), false).toArray(new PsiReference[0]);
PsiReference[] refs = ReferencesSearch.search(myClass, GlobalSearchScope.projectScope(myProject), false).toArray(
PsiReference.EMPTY_ARRAY);
final ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();
detectTurnToSuperRefs(refs, result);
final PsiPackage originalPackage = JavaDirectoryService.getInstance().getPackage(myClass.getContainingFile().getContainingDirectory());
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -55,7 +55,6 @@ import com.intellij.refactoring.rename.RenameJavaVariableProcessor;
import com.intellij.refactoring.util.*;
import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewDescriptor;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.MultiMap;
@@ -1108,7 +1107,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
if (isAccessedForWriting) {
if (refVar.hasModifierProperty(PsiModifier.FINAL) || shouldBeFinal) return false;
PsiReference[] refs =
ReferencesSearch.search(refVar, GlobalSearchScope.projectScope(myProject), false).toArray(new PsiReference[0]);
ReferencesSearch.search(refVar, GlobalSearchScope.projectScope(myProject), false).toArray(PsiReference.EMPTY_ARRAY);
return refs.length == 1; //TODO: control flow
}
else {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -31,6 +31,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.FileTypeUtils;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.HelpID;
import com.intellij.refactoring.RefactoringBundle;
@@ -40,7 +41,6 @@ import com.intellij.refactoring.util.EnumConstantsUtil;
import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.VisibilityUtil;
import com.intellij.psi.util.FileTypeUtils;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -295,7 +295,7 @@ public abstract class LocalToFieldHandler {
final boolean rebindNeeded2 = !myVariableName.equals(myFieldName) || myRebindNeeded;
final PsiReference[] refs;
if (rebindNeeded2) {
refs = ReferencesSearch.search(myLocal, GlobalSearchScope.projectScope(myProject), false).toArray(new PsiReference[0]);
refs = ReferencesSearch.search(myLocal, GlobalSearchScope.projectScope(myProject), false).toArray(PsiReference.EMPTY_ARRAY);
}
else {
refs = null;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -35,7 +35,6 @@ import com.intellij.refactoring.util.CanonicalTypes;
import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.refactoring.util.javadoc.MethodJavaDocHelper;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.Consumer;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.VisibilityUtil;
import com.intellij.util.containers.MultiMap;
@@ -304,7 +303,7 @@ public class MakeMethodStaticProcessor extends MakeMethodOrClassStaticProcessor<
PsiElement anchor = null;
PsiExpressionList argList = null;
PsiExpression[] exprs = new PsiExpression[0];
PsiExpression[] exprs = PsiExpression.EMPTY_ARRAY;
if (parent instanceof PsiMethodCallExpression) {
argList = ((PsiMethodCallExpression)parent).getArgumentList();
exprs = argList.getExpressions();
@@ -22,7 +22,6 @@ import com.intellij.codeInsight.intention.AddAnnotationFix;
import com.intellij.lang.Language;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Key;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettings;
@@ -552,7 +551,7 @@ public class JavaPullUpHelper implements PullUpHelper<MemberInfo> {
}
if (doLookup) {
final PsiReference[] references =
ReferencesSearch.search(field, new LocalSearchScope(statement), false).toArray(new PsiReference[0]);
ReferencesSearch.search(field, new LocalSearchScope(statement), false).toArray(PsiReference.EMPTY_ARRAY);
if (commonInitializerCandidate == null && references.length > 0) {
return null;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -155,7 +155,7 @@ public class PullUpConflictsUtil {
ContainerUtil.addIfNotNull(checkModuleConflictsList, method.getTypeParameterList());
}
RefactoringConflictsUtil.analyzeModuleConflicts(subclass.getProject(), checkModuleConflictsList,
new UsageInfo[0], targetRepresentativeElement, conflicts);
UsageInfo.EMPTY_ARRAY, targetRepresentativeElement, conflicts);
final PsiFile psiFile = PsiTreeUtil.getParentOfType(subclass, PsiClassOwner.class);
final boolean toDifferentPackage = !Comparing.strEqual(targetPackage.getQualifiedName(),
@@ -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.
@@ -211,7 +211,7 @@ public class JavaMoveClassesOrPackagesHandler extends MoveHandlerDelegate {
return;
}
final MoveClassesOrPackagesToNewDirectoryDialog dlg =
new MoveClassesOrPackagesToNewDirectoryDialog(directories[0], new PsiElement[0], false, callback) {
new MoveClassesOrPackagesToNewDirectoryDialog(directories[0], PsiElement.EMPTY_ARRAY, false, callback) {
@Override
protected BaseRefactoringProcessor createRefactoringProcessor(Project project,
final PsiDirectory targetDirectory,
@@ -31,7 +31,7 @@ public class SearchUtils{
public static Iterable<PsiReference> findAllReferences(PsiElement element, SearchScope scope){
return new ArrayIterable<PsiReference>(ReferencesSearch.search(element, scope, true).toArray(new PsiReference[0]));
return new ArrayIterable<PsiReference>(ReferencesSearch.search(element, scope, true).toArray(PsiReference.EMPTY_ARRAY));
/*
try {
Class<?> searchClass = Class.forName("com.intellij.psi.search.searches.ReferencesSearch");
@@ -59,12 +59,12 @@ public class SearchUtils{
}
public static Iterable<PsiMethod> findOverridingMethods(PsiMethod method){
return new ArrayIterable<PsiMethod>(OverridingMethodsSearch.search(method).toArray(new PsiMethod[0]));
return new ArrayIterable<PsiMethod>(OverridingMethodsSearch.search(method).toArray(PsiMethod.EMPTY_ARRAY));
// return OverridingMethodsSearch.search(method, method.getUseScope(), true).findAll();
}
public static Iterable<PsiClass> findClassInheritors(PsiClass aClass, boolean deep){
return new ArrayIterable<PsiClass>(ClassInheritorsSearch.search(aClass, deep).toArray(new PsiClass[0]));
return new ArrayIterable<PsiClass>(ClassInheritorsSearch.search(aClass, deep).toArray(PsiClass.EMPTY_ARRAY));
// return ClassInheritorsSearch.search(aClass, deep);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -28,7 +28,7 @@ public class ReplaceConstructorWithBuilderViewDescriptor extends UsageViewDescri
@NotNull
public PsiElement[] getElements() {
return new PsiElement[0];
return PsiElement.EMPTY_ARRAY;
}
public String getProcessedElementsHeader() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -79,7 +79,8 @@ public class TempWithQueryHandler implements RefactoringActionHandler {
return;
}
final PsiReference[] refs = ReferencesSearch.search(local, GlobalSearchScope.projectScope(project), false).toArray(new PsiReference[0]);
final PsiReference[] refs = ReferencesSearch.search(local, GlobalSearchScope.projectScope(project), false).toArray(
PsiReference.EMPTY_ARRAY);
if (refs.length == 0) {
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("variable.is.never.used", localName));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -68,7 +68,8 @@ public class TurnRefsToSuperProcessor extends TurnRefsToSuperProcessorBase {
@NotNull
protected UsageInfo[] findUsages() {
final PsiReference[] refs = ReferencesSearch.search(myClass, GlobalSearchScope.projectScope(myProject), false).toArray(new PsiReference[0]);
final PsiReference[] refs = ReferencesSearch.search(myClass, GlobalSearchScope.projectScope(myProject), false).toArray(
PsiReference.EMPTY_ARRAY);
final ArrayList<UsageInfo> result = detectTurnToSuperRefs(refs, new ArrayList<UsageInfo>());
@@ -823,7 +823,8 @@ public class TypeMigrationLabeler {
}
public PsiReference[] markRootUsages(final PsiElement element, final PsiType migrationType) {
return markRootUsages(element, migrationType, ReferencesSearch.search(element, myRules.getSearchScope(), false).toArray(new PsiReference[0]));
return markRootUsages(element, migrationType, ReferencesSearch.search(element, myRules.getSearchScope(), false).toArray(
PsiReference.EMPTY_ARRAY));
}
PsiReference[] markRootUsages(final PsiElement element, final PsiType migrationType, final PsiReference[] refs) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -30,7 +30,7 @@ public class ClassReferenceSearchingScanner extends ClassReferenceScanner {
public PsiReference[] findReferences() {
GlobalSearchScope projectScope = GlobalSearchScope.projectScope(myClass.getProject());
return ReferencesSearch.search(myClass, projectScope, false).toArray(new PsiReference[0]);
return ReferencesSearch.search(myClass, projectScope, false).toArray(PsiReference.EMPTY_ARRAY);
}
}
@@ -440,7 +440,7 @@ class SliceUtil {
// for erased method calls for which we cannot determine target substitutor,
// rely on call argument types. I.e. new Pair(1,2) -> Pair<Integer, Integer>
if (element instanceof PsiTypeParameterListOwner && PsiUtil.isRawSubstitutor((PsiTypeParameterListOwner)element, substitutor)) {
PsiTypeParameter[] typeParameters = substitutor.getSubstitutionMap().keySet().toArray(new PsiTypeParameter[0]);
PsiTypeParameter[] typeParameters = substitutor.getSubstitutionMap().keySet().toArray(PsiTypeParameter.EMPTY_ARRAY);
PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(project).getResolveHelper();
substitutor = resolveHelper.inferTypeArguments(typeParameters, actualParameters, expressions, parentSubstitutor, argumentList,
@@ -32,7 +32,7 @@ public class PsiImportListImpl extends JavaStubPsiElement<PsiImportListStub> imp
private volatile Map<String,PsiImportStatement> myClassNameToImportMap;
private volatile Map<String,PsiImportStatement> myPackageNameToImportMap;
private volatile Map<String,PsiImportStatementBase> myNameToSingleImportMap;
private static final PsiImportStatementBase[] EMPTY_ARRAY = new PsiImportStatementBase[0];
private static final PsiImportStatementBase[] EMPTY_ARRAY = PsiImportStatementBase.EMPTY_ARRAY;
private static final ArrayFactory<PsiImportStatementBase> ARRAY_FACTORY = new ArrayFactory<PsiImportStatementBase>() {
@NotNull
@Override
@@ -771,7 +771,7 @@ public class InferenceSession {
restParamSubstitution = restParamSubstitution.put(typeParameters[i], parameter);
}
}
return initBounds(null, restParamSubstitution, capturedParams.toArray(new PsiTypeParameter[0]));
return initBounds(null, restParamSubstitution, capturedParams.toArray(PsiTypeParameter.EMPTY_ARRAY));
}
return initBounds(null, typeParameters);
}
@@ -1,3 +1,18 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight;
import com.intellij.codeInsight.generation.EqualsHashCodeTemplatesManager;
@@ -13,12 +28,12 @@ public class GenerateEquals15Test extends GenerateEqualsTestCase {
}
public void testDifferentTypes() throws Exception {
doTest(Function.ID, Function.ID, fields -> new PsiField[0], true
doTest(Function.ID, Function.ID, fields -> PsiField.EMPTY_ARRAY, true
);
}
public void testDifferentTypesGetters() throws Exception {
doTest(Function.ID, Function.ID, fields -> new PsiField[0], true, true);
doTest(Function.ID, Function.ID, fields -> PsiField.EMPTY_ARRAY, true, true);
}
public void testDifferentTypesAllNotNull() throws Exception {
@@ -1,3 +1,18 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.find.findUsages;
import com.intellij.psi.*;
@@ -25,7 +40,7 @@ public class FindParameterTest extends PsiTestCase {
final PsiMethod methodFromText = elementFactory.createMethodFromText(text, null);
final PsiParameter[] parameters = methodFromText.getParameterList().getParameters();
final PsiReference[] references =
ReferencesSearch.search(parameters[0], new LocalSearchScope(methodFromText), false).toArray(new PsiReference[0]);
ReferencesSearch.search(parameters[0], new LocalSearchScope(methodFromText), false).toArray(PsiReference.EMPTY_ARRAY);
Assert.assertEquals(references.length, 2);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 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.
@@ -16,7 +16,6 @@
package com.intellij.psi.search;
import com.intellij.JavaTestUtil;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
@@ -47,12 +46,12 @@ public class FindUsages15Test extends PsiTestCase{
PsiMethod[] constructors = enumClass.getConstructors();
assertEquals(2, constructors.length);
PsiReference[] references0 =
ReferencesSearch.search(constructors[0], GlobalSearchScope.moduleScope(myModule), false).toArray(new PsiReference[0]);
ReferencesSearch.search(constructors[0], GlobalSearchScope.moduleScope(myModule), false).toArray(PsiReference.EMPTY_ARRAY);
assertEquals(2, references0.length);
assertTrue(references0[0].getElement() instanceof PsiEnumConstant);
assertTrue(references0[1].getElement() instanceof PsiEnumConstant);
PsiReference[] references1 =
ReferencesSearch.search(constructors[1], GlobalSearchScope.moduleScope(myModule), false).toArray(new PsiReference[0]);
ReferencesSearch.search(constructors[1], GlobalSearchScope.moduleScope(myModule), false).toArray(PsiReference.EMPTY_ARRAY);
assertEquals(1, references1.length);
assertTrue(references1[0].getElement() instanceof PsiEnumConstant);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -148,7 +148,7 @@ public class SearchInLibsTest extends PsiTestCase {
final PsiClass aClass = myJavaFacade.findClass(classNameToSearch);
assertNotNull(aClass);
PsiReference[] refs = ReferencesSearch.search(aClass, scope, false).toArray(new PsiReference[0]);
PsiReference[] refs = ReferencesSearch.search(aClass, scope, false).toArray(PsiReference.EMPTY_ARRAY);
ArrayList<PsiFile> files = new ArrayList<>();
for (PsiReference ref : refs) {
@@ -45,13 +45,15 @@ import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.PsiTestCase;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Processor;
import com.intellij.util.indexing.FileBasedIndex;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@PlatformTestCase.WrapInCommand
public class UpdateCacheTest extends PsiTestCase {
@@ -406,7 +408,8 @@ public class UpdateCacheTest extends PsiTestCase {
}
private void checkUsages(PsiElement element, @NonNls String[] expectedFiles){
PsiReference[] refs = ReferencesSearch.search(element, GlobalSearchScope.projectScope(myProject), false).toArray(new PsiReference[0]);
PsiReference[] refs = ReferencesSearch.search(element, GlobalSearchScope.projectScope(myProject), false).toArray(
PsiReference.EMPTY_ARRAY);
List<PsiFile> files = new ArrayList<PsiFile>();
for (PsiReference ref : refs) {
@@ -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.
@@ -86,7 +86,7 @@ public class MockFileDocumentManagerImpl extends FileDocumentManager {
@Override
@NotNull
public Document[] getUnsavedDocuments() {
return new Document[0];
return Document.EMPTY_ARRAY;
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -268,7 +268,7 @@ public class FoldingUpdate {
", PSI element range: " + psiElement.getTextRange() + "; " + DebugUtil.diagnosePsiDocumentInconsistency(psiElement, document);
LOG.error(message, ApplicationManager.getApplication().isInternal()
? new Attachment[]{AttachmentFactory.createAttachment(document), new Attachment("psiTree.txt", DebugUtil.psiToString(file, false, true))}
: new Attachment[0]);
: Attachment.EMPTY_ARRAY);
}
public static class FoldingMap extends MultiMap<PsiElement, FoldingDescriptor>{
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -153,7 +153,7 @@ public class ShowImplementationsAction extends AnAction implements PopupAction {
}
String text = "";
PsiElement[] impls = new PsiElement[0];
PsiElement[] impls = PsiElement.EMPTY_ARRAY;
if (element != null) {
//if (element instanceof PsiPackage) return;
@@ -736,7 +736,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
@Nullable
@Override
public CommonProblemDescriptor[] getDescriptions(@NotNull RefEntity refEntity) {
return new CommonProblemDescriptor[0];
return CommonProblemDescriptor.EMPTY_ARRAY;
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -415,7 +415,7 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
public void ignoreCurrentElementProblem(RefEntity refEntity, CommonProblemDescriptor descriptor) {
CommonProblemDescriptor[] descriptors = getIgnoredElements().get(refEntity);
if (descriptors == null) {
descriptors = new CommonProblemDescriptor[0];
descriptors = CommonProblemDescriptor.EMPTY_ARRAY;
}
getIgnoredElements().put(refEntity, ArrayUtil.append(descriptors, descriptor));
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -243,7 +243,7 @@ public class DefaultLanguageColorsPage implements ColorSettingsPage, DisplayPrio
@NotNull
@Override
public ColorDescriptor[] getColorDescriptors() {
return new ColorDescriptor[0];
return ColorDescriptor.EMPTY_ARRAY;
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -80,7 +80,7 @@ public class FindDependencyUtil {
}
}
deps.retainAll(searchIn);
if (deps.isEmpty()) return new UsageInfo[0];
if (deps.isEmpty()) return UsageInfo.EMPTY_ARRAY;
int totalCount = deps.size();
int count = 0;
@@ -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.
@@ -32,9 +32,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.Consumer;
import javax.swing.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -68,7 +66,7 @@ public class DependenciesUsagesPanel extends UsagesPanel {
myCurrentProgress = progress;
ProgressManager.getInstance().runProcess(() -> {
ApplicationManager.getApplication().runReadAction(() -> {
UsageInfo[] usages = new UsageInfo[0];
UsageInfo[] usages = UsageInfo.EMPTY_ARRAY;
Set<PsiFile> elementsToSearch = null;
try {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -144,7 +144,7 @@ public class DummyProject extends UserDataHolderBase implements Project {
@NotNull
public ComponentConfig[] getComponentConfigurations() {
return new ComponentConfig[0];
return ComponentConfig.EMPTY_ARRAY;
}
@Nullable
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -89,7 +89,7 @@ public class KeymapImpl extends ExternalizableSchemeAdapter implements Keymap {
private Map<MouseShortcut, List<String>> myMouseShortcut2ListOfIds = null;
// TODO[vova,anton] it should be final member
private static final Shortcut[] ourEmptyShortcutsArray = new Shortcut[0];
private static final Shortcut[] ourEmptyShortcutsArray = Shortcut.EMPTY_ARRAY;
private final List<Listener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
private KeymapManagerEx myKeymapManager;
@@ -58,7 +58,7 @@ public class SchemeImportUtil {
preselectFiles[0] = preselect;
}
else {
preselectFiles = new VirtualFile[0];
preselectFiles = VirtualFile.EMPTY_ARRAY;
}
final VirtualFile[] virtualFiles = fileChooser.choose(null, preselectFiles);
//CodeStyleSchemesUIConfiguration.Util.getRecentImportFile());
@@ -26,12 +26,14 @@ import com.intellij.psi.PsiLanguageInjectionHost;
import com.intellij.psi.impl.source.tree.CompositeElement;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
import com.intellij.util.ThrowableRunnable;
import com.intellij.util.containers.HashSet;
import gnu.trove.THashMap;
import gnu.trove.TObjectIntHashMap;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
/**
* @author gregsh
@@ -149,7 +151,7 @@ public class IElementTypeTest extends LightPlatformCodeInsightFixtureTestCase {
public void testInitialRegisterPerformance() {
PlatformTestUtil.startPerformanceTest("IElementType add", 100, () -> {
Language language = Language.ANY;
IElementType[] old = IElementType.push(new IElementType[0]);
IElementType[] old = IElementType.push(IElementType.EMPTY_ARRAY);
try {
for (short i = 0; i < 15000; i++) {
IElementType type = new IElementType("i " + i, language);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 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,7 +22,6 @@ import com.intellij.testFramework.LightPlatformTestCase;
import com.intellij.usages.*;
import com.intellij.usages.rules.UsageFilteringRule;
import com.intellij.usages.rules.UsageGroupingRule;
import com.intellij.util.Consumer;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -261,7 +260,7 @@ public class UsageNodeTreeBuilderTest extends LightPlatformTestCase {
@Override
@NotNull
public TextChunk[] getText() {
return new TextChunk[0];
return TextChunk.EMPTY_ARRAY;
}
@Override
@@ -256,7 +256,7 @@ public class Mock {
@Override
@NotNull
public VirtualFile[] getSiblings(@NotNull VirtualFile file) {
return new VirtualFile[0];
return VirtualFile.EMPTY_ARRAY;
}
@Override
@@ -352,13 +352,13 @@ public class Mock {
@Override
@NotNull
public VirtualFile[] getOpenFiles() {
return new VirtualFile[0];
return VirtualFile.EMPTY_ARRAY;
}
@Override
@NotNull
public VirtualFile[] getSelectedFiles() {
return new VirtualFile[0];
return VirtualFile.EMPTY_ARRAY;
}
@Override
@@ -484,7 +484,7 @@ public class Mock {
@Override
public VirtualFile[] getChildren() {
return new VirtualFile[0];
return VirtualFile.EMPTY_ARRAY;
}
@NotNull
@@ -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.
@@ -59,7 +59,7 @@ public class ProjectViewTestUtil {
return result;
}
}
return new VirtualFile[0];
return VirtualFile.EMPTY_ARRAY;
}
public static void collect(AbstractTreeNode node,
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -65,7 +65,7 @@ public class GitHistoryProvider implements VcsHistoryProviderEx, VcsCacheableHis
}
public VcsDependentHistoryComponents getUICustomization(final VcsHistorySession session, JComponent forShortcutRegistration) {
return VcsDependentHistoryComponents.createOnlyColumns(new ColumnInfo[0]);
return VcsDependentHistoryComponents.createOnlyColumns(ColumnInfo.EMPTY_ARRAY);
}
public AnAction[] getAdditionalActions(Runnable refresher) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 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.
@@ -110,7 +110,7 @@ public class GithubCreateGistContentTest extends GithubCreateGistContentTestBase
public void testCreateFromEmptyFiles() throws Throwable {
List<FileContent> expected = new ArrayList<FileContent>();
VirtualFile[] files = new VirtualFile[0];
VirtualFile[] files = VirtualFile.EMPTY_ARRAY;
List<FileContent> actual = GithubCreateGistAction.collectContents(myProject, null, null, files);
@@ -59,7 +59,7 @@ public class GradleRerunFailedTestsAction extends JavaRerunFailedTestsAction {
@NotNull
@Override
public Module[] getModules() {
return new Module[0];
return Module.EMPTY_ARRAY;
}
@Nullable
@@ -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.
@@ -140,7 +140,7 @@ public abstract class AbstractConfigUtils {
}
public Library[] getProjectSDKLibraries(Project project) {
if (project == null || project.isDisposed()) return new Library[0];
if (project == null || project.isDisposed()) return Library.EMPTY_ARRAY;
final LibraryTable table = ProjectLibraryTable.getInstance(project);
final List<Library> all = ContainerUtil.findAll(table.getLibraries(), LIB_SEARCH_CONDITION);
return all.toArray(new Library[all.size()]);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -108,7 +108,7 @@ public class GrDocFieldReferenceImpl extends GrDocMemberReferenceImpl implements
}
return candidates;
}
return new ResolveResult[0];
return ResolveResult.EMPTY_ARRAY;
}
}
@@ -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.
@@ -118,7 +118,7 @@ public class GrDocMethodReferenceImpl extends GrDocMemberReferenceImpl implement
resolved.processDeclarations(constructorProcessor, ResolveState.initial(), resolved, this);
return ArrayUtil.mergeArrays(processor.getCandidates(), constructorProcessor.getCandidates());
}
return new ResolveResult[0];
return ResolveResult.EMPTY_ARRAY;
}
@Override
@@ -317,7 +317,7 @@ public class PsiUtil {
if (namedArgs.length > 0) {
GrNamedArgument context = namedArgs[0];
result.add(GrMapType.createFromNamedArgs(context, byShape ? new GrNamedArgument[0] : namedArgs));
result.add(GrMapType.createFromNamedArgs(context, byShape ? GrNamedArgument.EMPTY_ARRAY : namedArgs));
}
for (GrExpression expression : expressions) {
@@ -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.
@@ -39,7 +39,6 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -55,7 +54,7 @@ public class LibrariesUtil {
}
public static Library[] getLibrariesByCondition(final Module module, final Condition<Library> condition) {
if (module == null) return new Library[0];
if (module == null) return Library.EMPTY_ARRAY;
final ArrayList<Library> libraries = new ArrayList<Library>();
AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
@@ -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.
@@ -113,7 +113,7 @@ public class GrDynamicMethodImpl extends LightElement implements GrMethod {
@Override
@NotNull
public PsiMethod[] findDeepestSuperMethods() {
return new PsiMethod[0];
return PsiMethod.EMPTY_ARRAY;
}
@Override
@@ -123,7 +123,7 @@ public class GrDynamicMethodImpl extends LightElement implements GrMethod {
@Override
public GrMember[] getMembers() {
return new GrMember[0];
return GrMember.EMPTY_ARRAY;
}
@Override
@@ -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.
@@ -137,7 +137,7 @@ public abstract class CreateClassFix {
method = (GrMethod)targetClass.addBefore(method, null);
final PsiElement context = PsiTreeUtil.getParentOfType(refElement, PsiMethod.class, PsiClass.class, PsiFile.class);
IntentionUtils.createTemplateForMethod(argTypes, paramTypesExpressions, method, targetClass, new TypeConstraint[0], true, context);
IntentionUtils.createTemplateForMethod(argTypes, paramTypesExpressions, method, targetClass, TypeConstraint.EMPTY_ARRAY, true, context);
}
finally {
writeLock.finish();
@@ -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.
@@ -94,7 +94,7 @@ public class GroovyColorsAndFontsPage implements ColorSettingsPage {
@Override
@NotNull
public ColorDescriptor[] getColorDescriptors() {
return new ColorDescriptor[0];
return ColorDescriptor.EMPTY_ARRAY;
}
@Override
@@ -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.
@@ -194,7 +194,7 @@ public class GroovySmartEnterProcessor extends SmartEnterProcessorWithFixers {
private static PsiElement[] getChildren(PsiElement element) {
PsiElement psiChild = element.getFirstChild();
if (psiChild == null) return new PsiElement[0];
if (psiChild == null) return PsiElement.EMPTY_ARRAY;
List<PsiElement> result = new ArrayList<PsiElement>();
while (psiChild != null) {
@@ -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.
@@ -144,7 +144,7 @@ public class GrPullUpConflictsUtil {
ContainerUtil.addIfNotNull(checkModuleConflictsList, method.getReturnTypeElement());
ContainerUtil.addIfNotNull(checkModuleConflictsList, method.getTypeParameterList());
}
GrRefactoringConflictsUtil.analyzeModuleConflicts(subclass.getProject(), checkModuleConflictsList, new UsageInfo[0], targetRepresentativeElement, conflicts);
GrRefactoringConflictsUtil.analyzeModuleConflicts(subclass.getProject(), checkModuleConflictsList, UsageInfo.EMPTY_ARRAY, targetRepresentativeElement, conflicts);
final String fqName = subclass.getQualifiedName();
final String packageName;
if (fqName != null) {
@@ -57,7 +57,7 @@ public class HgHistoryProvider implements VcsHistoryProvider {
public VcsDependentHistoryComponents getUICustomization(VcsHistorySession session,
JComponent forShortcutRegistration) {
return VcsDependentHistoryComponents.createOnlyColumns(new ColumnInfo[0]);
return VcsDependentHistoryComponents.createOnlyColumns(ColumnInfo.EMPTY_ARRAY);
}
public AnAction[] getAdditionalActions(Runnable runnable) {
@@ -11,7 +11,6 @@ import com.intellij.psi.xml.XmlDocument;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Processor;
import com.intellij.xml.XmlElementDescriptor;
import com.intellij.xml.XmlNSDescriptor;
import org.jetbrains.annotations.NotNull;
@@ -59,7 +58,7 @@ public class JavaFxNamespaceDescriptor implements XmlNSDescriptor, Validator<Xml
return result.toArray(new XmlElementDescriptor[result.size()]);
}
}
return new XmlElementDescriptor[0];
return XmlElementDescriptor.EMPTY_ARRAY;
}
@Nullable
@@ -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.
@@ -223,7 +223,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
final Runnable callCleanupWorker = new Runnable() {
public void run() {
if (myProject.isDisposed()) return;
new CleanupWorker(new VirtualFile[]{}, myProject, "action.Subversion.cleanup.progress.title") {
new CleanupWorker(VirtualFile.EMPTY_ARRAY, myProject, "action.Subversion.cleanup.progress.title") {
@Override
protected void chanceToFillRoots() {
final List<WCInfo> infos = getAllWcInfos();
@@ -1,3 +1,18 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.idea.svn;
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
@@ -78,7 +93,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -104,7 +119,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s1.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -129,7 +144,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s1.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -161,7 +176,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s2.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -197,7 +212,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
Assert.assertEquals(SubTree.ourS1Contents, text.toString());
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -220,7 +235,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.myRootDir, "target");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
for (VirtualFile file : files) {
Assert.assertTrue(file.getPath(), clManager.isUnversioned(file));
@@ -263,7 +278,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.myTargetDir, "t15.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Nullable
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 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.
@@ -86,7 +86,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn17TestCase {
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -112,7 +112,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s1.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -137,7 +137,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s1.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -169,7 +169,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s2.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -205,7 +205,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn17TestCase {
Assert.assertEquals(SubTree.ourS1Contents, text.toString());
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -228,7 +228,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn17TestCase {
assertVF(subTree.myRootDir, "target");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
for (VirtualFile file : files) {
Assert.assertTrue(file.getPath(), clManager.isUnversioned(file));
@@ -271,7 +271,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn17TestCase {
assertVF(subTree.myTargetDir, "t15.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Nullable
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 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.
@@ -93,7 +93,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -119,7 +119,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s1.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -144,7 +144,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s1.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -176,7 +176,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.mySourceDir, "s2.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -212,7 +212,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
Assert.assertEquals(SubTree.ourS1Contents, text.toString());
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -235,7 +235,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.myRootDir, "target");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
for (VirtualFile file : files) {
Assert.assertTrue(file.getPath(), clManager.isUnversioned(file));
@@ -278,7 +278,7 @@ public class SvnChangesCorrectlyRefreshedNativeTest extends Svn17TestCase {
assertVF(subTree.myTargetDir, "t15.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Nullable
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 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.
@@ -112,7 +112,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn16TestCase {
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -138,7 +138,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn16TestCase {
assertVF(subTree.mySourceDir, "s1.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -163,7 +163,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn16TestCase {
assertVF(subTree.mySourceDir, "s1.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -195,7 +195,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn16TestCase {
assertVF(subTree.mySourceDir, "s2.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -231,7 +231,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn16TestCase {
Assert.assertEquals(SubTree.ourS1Contents, text.toString());
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Test
@@ -254,7 +254,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn16TestCase {
assertVF(subTree.myRootDir, "target");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
for (VirtualFile file : files) {
Assert.assertTrue(file.getPath(), clManager.isUnversioned(file));
@@ -297,7 +297,7 @@ public class SvnChangesCorrectlyRefreshedTest extends Svn16TestCase {
assertVF(subTree.myTargetDir, "t15.txt");
clManager.ensureUpToDate(false);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] {}, clManager.getDefaultListName(), clManager);
DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
@Nullable
@@ -1,17 +1,17 @@
/*
* Copyright 2000-2009 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.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.tasks.impl;
@@ -47,7 +47,7 @@ public class LocalTaskImpl extends LocalTask {
private String myId = "";
private String mySummary = "";
private String myDescription = null;
private Comment[] myComments = new Comment[0];
private Comment[] myComments = Comment.EMPTY_ARRAY;
private boolean myClosed = false;
private Date myCreated;
private Date myUpdated;
@@ -1,3 +1,18 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.tasks.lighthouse;
import com.intellij.openapi.diagnostic.Logger;
@@ -158,7 +173,7 @@ public class LighthouseRepository extends BaseRepositoryImpl {
@NotNull
@Override
public Comment[] getComments() {
return new Comment[0];
return Comment.EMPTY_ARRAY;
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -148,7 +148,7 @@ public class TracRepository extends BaseRepositoryImpl {
@NotNull
@Override
public Comment[] getComments() {
return new Comment[0];
return Comment.EMPTY_ARRAY;
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -425,7 +425,7 @@ public class TaskVcsTest extends CodeInsightFixtureTestCase {
@NotNull
@Override
public Comment[] getComments() {
return new Comment[0];
return Comment.EMPTY_ARRAY;
}
@NotNull
@@ -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.
@@ -142,7 +142,7 @@ public class DependsOnGroupsInspection extends BaseJavaLocalInspectionTool {
}
}
}
return problemDescriptors.toArray(new ProblemDescriptor[]{});
return problemDescriptors.toArray(ProblemDescriptor.EMPTY_ARRAY);
}
private class GroupNameQuickFix implements LocalQuickFix {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 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.
@@ -76,7 +76,7 @@ public class EmptyXmlTag implements XmlTag {
@NotNull
@Override
public XmlAttribute[] getAttributes() {
return new XmlAttribute[0];
return XmlAttribute.EMPTY_ARRAY;
}
@Override
@@ -125,19 +125,19 @@ public class EmptyXmlTag implements XmlTag {
@NotNull
@Override
public XmlTag[] getSubTags() {
return new XmlTag[0];
return XmlTag.EMPTY;
}
@NotNull
@Override
public XmlTag[] findSubTags(@NonNls String qname) {
return new XmlTag[0];
return XmlTag.EMPTY;
}
@NotNull
@Override
public XmlTag[] findSubTags(@NonNls String localName, @NonNls String namespace) {
return new XmlTag[0];
return XmlTag.EMPTY;
}
@Override
@@ -185,13 +185,13 @@ public class EmptyXmlTag implements XmlTag {
@NotNull
@Override
public XmlTagChild[] getChildren() {
return new XmlTagChild[0];
return XmlTagChild.EMPTY_ARRAY;
}
@NotNull
@Override
public XmlText[] getTextElements() {
return new XmlText[0];
return XmlText.EMPTY_ARRAY;
}
@NotNull
@@ -287,7 +287,7 @@ public class EmptyXmlTag implements XmlTag {
@NotNull
@Override
public PsiElement[] getChildren() {
return new PsiElement[0];
return PsiElement.EMPTY_ARRAY;
}
@Override
@@ -475,7 +475,7 @@ public class EmptyXmlTag implements XmlTag {
@NotNull
@Override
public PsiReference[] getReferences() {
return new PsiReference[0];
return PsiReference.EMPTY_ARRAY;
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -65,7 +65,7 @@ public class XPathColorSettingsPage implements ColorSettingsPage {
@NotNull
public ColorDescriptor[] getColorDescriptors() {
return new ColorDescriptor[0];
return ColorDescriptor.EMPTY_ARRAY;
}
@NotNull
@@ -1,3 +1,18 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.yaml;
import com.intellij.icons.AllIcons;
@@ -46,7 +61,7 @@ public class YAMLColorsPage implements ColorSettingsPage {
// Empty still
private static final Map<String, TextAttributesKey> ADDITIONAL_HIGHLIGHT_DESCRIPTORS = new HashMap<String, TextAttributesKey>();
private static final ColorDescriptor[] COLORS = new ColorDescriptor[0];
private static final ColorDescriptor[] COLORS = ColorDescriptor.EMPTY_ARRAY;
@Nullable
public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -56,6 +56,6 @@ public class PyDirectoryIndexExcludePolicy implements DirectoryIndexExcludePolic
public VirtualFilePointer[] getExcludeRootsForModule(@NotNull ModuleRootModel rootModel) {
return new VirtualFilePointer[0];
return VirtualFilePointer.EMPTY_ARRAY;
}
}
@@ -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.
@@ -41,7 +41,8 @@ public class PyStringLiteralFileReferenceSet extends RootFileReferenceSet {
}
public PyStringLiteralFileReferenceSet(@NotNull PyStringLiteralExpression element, boolean caseSensitive) {
this(element.getStringValue(), element, element.getStringValueTextRange().getStartOffset(), null, caseSensitive, true, new FileType[0]);
this(element.getStringValue(), element, element.getStringValueTextRange().getStartOffset(), null, caseSensitive, true,
FileType.EMPTY_ARRAY);
}
public PyStringLiteralFileReferenceSet(@NotNull String str,
@@ -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.
@@ -47,7 +47,6 @@ import com.intellij.remote.RemoteSdkAdditionalData;
import com.intellij.ui.*;
import com.intellij.ui.components.JBList;
import com.intellij.util.NullableConsumer;
import com.intellij.util.NullableFunction;
import com.intellij.util.PathMappingSettings;
import com.intellij.util.containers.FactoryMap;
import com.jetbrains.python.PyBundle;
@@ -564,7 +563,7 @@ public class PythonSdkDetailsDialog extends DialogWrapper {
catch (Exception e) {
LOG.error(e);
}
return new VirtualFile[0];
return VirtualFile.EMPTY_ARRAY;
}
@Override
@@ -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.
@@ -59,7 +59,7 @@ public class PydevConsoleReference extends PsiPolyVariantReferenceBase<PyReferen
@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
return new ResolveResult[0];
return ResolveResult.EMPTY_ARRAY;
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 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.
@@ -112,7 +112,7 @@ public class DocStringTypeReference extends PsiPolyVariantReferenceBase<PsiEleme
results.poke(result, RatedResolveResult.RATE_NORMAL);
}
}
return results.toArray(new ResolveResult[0]);
return results.toArray(ResolveResult.EMPTY_ARRAY);
}
@NotNull
@@ -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.
@@ -87,7 +87,7 @@ public class AddMethodQuickFix implements LocalQuickFix {
PyFunctionBuilder builder = new PyFunctionBuilder(myIdentifier, cls);
PsiElement pe = problemElement.getParent();
String decoratorName = null; // set to non-null to add a decorator
PyExpression[] args = new PyExpression[0];
PyExpression[] args = PyExpression.EMPTY_ARRAY;
if (pe instanceof PyCallExpression) {
PyArgumentList arglist = ((PyCallExpression)pe).getArgumentList();
if (arglist == null) return;
@@ -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.
@@ -21,13 +21,12 @@ import com.intellij.codeInsight.controlflow.ControlFlowUtil;
import com.intellij.codeInsight.controlflow.Instruction;
import com.intellij.openapi.util.Comparing;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.intellij.psi.util.QualifiedName;
import com.jetbrains.python.codeInsight.controlflow.ControlFlowCache;
import com.jetbrains.python.codeInsight.controlflow.ReadWriteInstruction;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyAugAssignmentStatementNavigator;
import com.intellij.psi.util.QualifiedName;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -112,7 +111,7 @@ public class PyDefUseUtil {
final Instruction[] instructions = controlFlow.getInstructions();
final int instr = ControlFlowUtil.findInstructionNumberByElement(instructions, anchor);
if (instr < 0) {
return new PyElement[0];
return PyElement.EMPTY_ARRAY;
}
final boolean[] visited = new boolean[instructions.length];
final Collection<PyElement> result = Sets.newHashSet();
@@ -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.
@@ -233,7 +233,7 @@ public class DomHighlightingLiteTest extends DomTestCase {
public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
final boolean isOnTheFly) {
myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
return new ProblemDescriptor[0];
return ProblemDescriptor.EMPTY_ARRAY;
}
@Override
@@ -266,7 +266,7 @@ public class DomHighlightingLiteTest extends DomTestCase {
public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
final boolean isOnTheFly) {
myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
return new ProblemDescriptor[0];
return ProblemDescriptor.EMPTY_ARRAY;
}
@Override
@@ -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.
@@ -232,7 +232,7 @@ public abstract class AbstractXmlBlock extends AbstractBlock {
return collectSubTags((XmlElement)myNode.getPsi());
}
else {
return new XmlTag[0];
return XmlTag.EMPTY;
}
}
@@ -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.
@@ -98,7 +98,7 @@ public class AnyXmlElementDescriptor implements XmlElementDescriptor {
@Override
public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
return new XmlAttributeDescriptor[0];
return XmlAttributeDescriptor.EMPTY;
}
@Override
@@ -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.
@@ -51,7 +51,7 @@ public class NullElementDescriptor implements XmlElementDescriptor {
//todo: refactor to support full DTD spec
@Override
public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
return new XmlElementDescriptor[0];
return XmlElementDescriptor.EMPTY_ARRAY;
}
@Override
@@ -61,7 +61,7 @@ public class NullElementDescriptor implements XmlElementDescriptor {
@Override
public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
return new XmlAttributeDescriptor[0];
return XmlAttributeDescriptor.EMPTY;
}
@Override