ArrayUtil API cleanup

This commit is contained in:
Roman Shevchenko
2011-09-15 12:54:14 +02:00
parent c6d73caa6b
commit e2a5241604
44 changed files with 145 additions and 107 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -115,7 +115,7 @@ public class PackagingElementFactoryImpl extends PackagingElementFactory {
@Override
public PackagingElementType[] getAllElementTypes() {
final PackagingElementType[] types = Extensions.getExtensions(PackagingElementType.EP_NAME);
return ArrayUtil.mergeArrays(STANDARD_TYPES, types, PackagingElementType.class);
return ArrayUtil.mergeArrays(STANDARD_TYPES, types);
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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,11 +140,11 @@ public class LibrariesContainerFactory {
Library[] libraries = getLibraries(LibraryLevel.GLOBAL);
Library[] projectLibraries = getLibraries(LibraryLevel.PROJECT);
if (projectLibraries.length > 0) {
libraries = ArrayUtil.mergeArrays(libraries, projectLibraries, Library.class);
libraries = ArrayUtil.mergeArrays(libraries, projectLibraries);
}
Library[] moduleLibraries = getLibraries(LibraryLevel.MODULE);
if (moduleLibraries.length > 0) {
libraries = ArrayUtil.mergeArrays(libraries, moduleLibraries, Library.class);
libraries = ArrayUtil.mergeArrays(libraries, moduleLibraries);
}
return libraries;
}
@@ -530,7 +530,7 @@ public class OverrideImplementUtil {
if (candidates.isEmpty() && secondary.isEmpty()) return null;
final PsiMethodMember[] onlyPrimary = convertToMethodMembers(candidates);
final PsiMethodMember[] all = ArrayUtil.mergeArrays(onlyPrimary, convertToMethodMembers(secondary), PsiMethodMember.class);
final PsiMethodMember[] all = ArrayUtil.mergeArrays(onlyPrimary, convertToMethodMembers(secondary));
final String toMerge = PropertiesComponent.getInstance(project).getValue(PROP_COMBINED_OVERRIDE_IMPLEMENT);
final Ref<Boolean> merge = Ref.create(!"false".equals(toMerge));
@@ -1289,7 +1289,7 @@ public class JavaDocInfoGenerator {
PsiDocTag[] tags1 = comment.findTagsByName(THROWS_KEYWORD);
PsiDocTag[] tags2 = comment.findTagsByName("exception");
return ArrayUtil.mergeArrays(tags1, tags2, PsiDocTag.class);
return ArrayUtil.mergeArrays(tags1, tags2);
}
private static boolean areWeakEqual(String one, String two) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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 JavaModuleType extends ModuleType<JavaModuleBuilder> {
steps.add(supportForFrameworksStep);
}
final ModuleWizardStep[] wizardSteps = steps.toArray(new ModuleWizardStep[steps.size()]);
return ArrayUtil.mergeArrays(wizardSteps, super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider), ModuleWizardStep.class);
return ArrayUtil.mergeArrays(wizardSteps, super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider));
}
private static class IconHolder {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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,6 +39,7 @@ import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.StubElement;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class JavaStubPsiElement<T extends StubElement> extends StubBasedPsiElementBase<T> implements StubBasedPsiElement<T> {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.JavaStubPsiElement");
@@ -84,7 +85,7 @@ public abstract class JavaStubPsiElement<T extends StubElement> extends StubBase
return SourceTreeToPsiMap.treeElementToPsi(elementCopy);
}
public PsiElement addAfter(@NotNull PsiElement element, PsiElement anchor) throws IncorrectOperationException {
public PsiElement addAfter(@NotNull PsiElement element, @Nullable PsiElement anchor) throws IncorrectOperationException {
CheckUtil.checkWritable(this);
TreeElement elementCopy = ChangeUtil.copyToElement(element);
calcTreeElement().addInternal(elementCopy, elementCopy, SourceTreeToPsiMap.psiElementToTree(anchor), Boolean.FALSE);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -673,7 +673,7 @@ public class ImportHelper{
final JspFile jspFile = JspPsiUtil.getJspFile(file);
collectNamesToImport(names, comments, file, jspFile);
if (jspFile != null) {
PsiFile[] files = ArrayUtil.mergeArrays(JspSpiUtil.getIncludingFiles(jspFile), JspSpiUtil.getIncludedFiles(jspFile), PsiFile.class);
PsiFile[] files = ArrayUtil.mergeArrays(JspSpiUtil.getIncludingFiles(jspFile), JspSpiUtil.getIncludedFiles(jspFile));
for (PsiFile includingFile : files) {
final PsiFile javaRoot = includingFile.getViewProvider().getPsi(StdLanguages.JAVA);
if (javaRoot instanceof PsiJavaFile && file != javaRoot) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -723,7 +723,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
if (SET_PREFIX.equals(firstWord)) {
final String propertyName = methodName.substring(firstWord.length());
final String[] setterNames = getSuggestionsByName(propertyName, variableKind, false, correctKeywords);
names = ArrayUtil.mergeArrays(names, setterNames, String.class);
names = ArrayUtil.mergeArrays(names, setterNames);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -231,7 +231,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
final PsiClass aClass = (PsiClass)context;
if (myInStaticImport) {
return ArrayUtil.mergeArrays(aClass.getInnerClasses(), aClass.getFields(), Object.class);
return ArrayUtil.mergeArrays(aClass.getInnerClasses(), aClass.getFields());
}
else if (isDefinitelyStatic()) {
final PsiClass[] psiClasses = aClass.getInnerClasses();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -208,7 +208,7 @@ public class JavaClassReferenceSet {
JavaClassReference[] result = myReferences;
if (myNestedGenericParameterReferences != null) {
for(JavaClassReferenceSet set:myNestedGenericParameterReferences) {
result = ArrayUtil.mergeArrays(result, set.getAllReferences(),JavaClassReference.class);
result = ArrayUtil.mergeArrays(result, set.getAllReferences());
}
}
return result;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -60,13 +60,13 @@ public class PathListReferenceProvider extends PsiReferenceProviderBase {
if (nextPos == -1) {
PsiReference[] refs =
createReferences(element, s.substring(pos + 1), pos + offset + 1, false);
result = ArrayUtil.mergeArrays(result, refs, PsiReference.class);
result = ArrayUtil.mergeArrays(result, refs);
break;
}
else {
PsiReference[] refs =
createReferences(element, s.substring(pos + 1, nextPos), pos + offset + 1, false);
result = ArrayUtil.mergeArrays(result, refs, PsiReference.class);
result = ArrayUtil.mergeArrays(result, refs);
pos = nextPos;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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 CanonicalPsiTypeConverterImpl extends CanonicalPsiTypeConverter imp
public Object[] getVariants() {
final Object[] variants = super.getVariants();
if (myIndex == 0) {
return ArrayUtil.mergeArrays(variants, PRIMITIVES, Object.class);
return ArrayUtil.mergeArrays(variants, PRIMITIVES);
}
return variants;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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 abstract class GlobalSearchScope extends SearchScope implements ProjectAw
if (scope instanceof FileTypeRestrictionScope) {
FileTypeRestrictionScope restrict = (FileTypeRestrictionScope)scope;
if (restrict.myBaseScope == myBaseScope) {
return new FileTypeRestrictionScope(myBaseScope, ArrayUtil.mergeArrays(myFileTypes, restrict.myFileTypes, FileType.class));
return new FileTypeRestrictionScope(myBaseScope, ArrayUtil.mergeArrays(myFileTypes, restrict.myFileTypes));
}
}
return super.uniteWith(scope);
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2011 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.generation;
import com.intellij.openapi.actionSystem.AnAction;
@@ -26,7 +41,7 @@ public class GenerateByPatternAction extends AnAction {
PatternProvider[] extensions = Extensions.getExtensions(PatternProvider.EXTENSION_POINT_NAME);
for (PatternProvider extension : extensions) {
if (extension.isAvailable(e.getDataContext())) {
patterns = ArrayUtil.mergeArrays(patterns, extension.getDescriptors(), PatternDescriptor.class);
patterns = ArrayUtil.mergeArrays(patterns, extension.getDescriptors());
}
}
GenerateByPatternDialog dialog = new GenerateByPatternDialog(e.getProject(), patterns, e.getDataContext());
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -73,7 +73,7 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem
problems = descriptions;
}
else {
problems = ArrayUtil.mergeArrays(problems, descriptions, CommonProblemDescriptor.class);
problems = ArrayUtil.mergeArrays(problems, descriptions);
}
getProblemElements().put(refElement, problems);
for (CommonProblemDescriptor description : descriptions) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -37,7 +37,6 @@ import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -457,7 +456,7 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable {
myInternalTemplateNames.add(((FileTemplateBase)internalTemplate).getQualifiedName());
}
myTemplatesList.init(ArrayUtil.mergeArrays(internalTemplates, templateManager.getAllTemplates(), FileTemplate.class));
myTemplatesList.init(ArrayUtil.mergeArrays(internalTemplates, templateManager.getAllTemplates()));
myIncludesList.init(templateManager.getAllPatterns());
myCodeTemplatesList.init(templateManager.getAllCodeTemplates());
if (myJ2eeTemplatesList != null) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -46,7 +46,7 @@ public class ScopePaneSelectInTarget extends ProjectViewSelectInTarget {
PsiFile file = (PsiFile) fileSystemItem;
NamedScopesHolder scopesHolder = DependencyValidationManager.getInstance(myProject);
NamedScope[] allScopes = scopesHolder.getScopes();
allScopes = ArrayUtil.mergeArrays(allScopes, NamedScopeManager.getInstance(myProject).getScopes(), NamedScope.class);
allScopes = ArrayUtil.mergeArrays(allScopes, NamedScopeManager.getInstance(myProject).getScopes());
for (NamedScope scope : allScopes) {
PackageSet packageSet = scope.getValue();
if (packageSet != null && packageSet.contains(file, scopesHolder)) return true;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -125,7 +125,7 @@ public class ScopeViewPane extends AbstractProjectViewPane {
@NotNull
public String[] getSubIds() {
NamedScope[] scopes = myDependencyValidationManager.getScopes();
scopes = ArrayUtil.mergeArrays(scopes, myNamedScopeManager.getScopes(), NamedScope.class);
scopes = ArrayUtil.mergeArrays(scopes, myNamedScopeManager.getScopes());
String[] ids = new String[scopes.length];
for (int i = 0; i < scopes.length; i++) {
final NamedScope scope = scopes[i];
@@ -382,11 +382,11 @@ public abstract class DialogWrapper {
if (okNdx >= 0 && okNdx != actions.length - 1) {
actions = ArrayUtil.append(ArrayUtil.remove(actions, getOKAction()), getOKAction());
}
// move cancel action to the left
int cancelNdx = ArrayUtil.indexOf(actions, getCancelAction());
if (cancelNdx > 0) {
actions = ArrayUtil.join(new Action[] {getCancelAction()}, ArrayUtil.remove(actions, getCancelAction()));
actions = ArrayUtil.mergeArrays(new Action[] {getCancelAction()}, ArrayUtil.remove(actions, getCancelAction()));
}
if (!hasFocusedAction(actions)) {
@@ -396,7 +396,7 @@ public abstract class DialogWrapper {
}
}
}
JPanel buttonsPanel = createButtons(actions, buttons);
lrButtonsPanel.add(buttonsPanel,
new GridBagConstraints(gridx++, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, insets, 0,
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -557,7 +557,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
} else if (second == null) {
return first;
} else {
return ArrayUtil.mergeArrays(first, second, ComponentConfig.class);
return ArrayUtil.mergeArrays(first, second);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -189,7 +189,7 @@ public final class DesktopLayout implements JDOMExternalizable {
WindowInfoImpl[] getAllInfos() {
final WindowInfoImpl[] registeredInfos = getInfos();
final WindowInfoImpl[] unregisteredInfos = getUnregisteredInfos();
myAllInfos = ArrayUtil.mergeArrays(registeredInfos, unregisteredInfos, WindowInfoImpl.class);
myAllInfos = ArrayUtil.mergeArrays(registeredInfos, unregisteredInfos);
return myAllInfos;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -754,7 +754,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
final CommonProcessors.CollectProcessor<UsageInfo> processor = new CommonProcessors.CollectProcessor<UsageInfo>();
assert handler != null : "Cannot find handler for: " + targetElement;
final PsiElement[] psiElements = ArrayUtil.mergeArrays(handler.getPrimaryElements(), handler.getSecondaryElements(), PsiElement.class);
final PsiElement[] psiElements = ArrayUtil.mergeArrays(handler.getPrimaryElements(), handler.getSecondaryElements());
final FindUsagesOptions options = handler.getFindUsagesOptions();
for (PsiElement psiElement : psiElements) {
handler.processElementUsages(psiElement, processor, options);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -44,13 +44,16 @@ public class ArrayUtil {
public static final Collection[] EMPTY_COLLECTION_ARRAY = new Collection[0];
public static final CharSequence EMPTY_CHAR_SEQUENCE = new CharArrayCharSequence(EMPTY_CHAR_ARRAY);
public static final File[] EMPTY_FILE_ARRAY = new File[0];
public static final Runnable[] EMPTY_RUNNABLE_ARRAY = new Runnable[0];
public static final ArrayFactory<String> STRING_ARRAY_FACTORY = new ArrayFactory<String>() {
@Override
public String[] create(int count) {
return newStringArray(count);
}
};
public static final Runnable[] EMPTY_RUNNABLE_ARRAY = new Runnable[0];
private ArrayUtil() { }
@NotNull
public static byte[] realloc(@NotNull byte[] array, final int newSize) {
@@ -143,15 +146,21 @@ public class ArrayUtil {
return ret;
}
/** @deprecated use {@linkplain #mergeArrays(Object[], Object[])} (to remove in IDEA 13) */
@NotNull
public static <T> T[] mergeArrays(@NotNull T[] a1, @NotNull T[] a2, @NotNull Class<T> aClass) {
return mergeArrays(a1, a2);
}
@NotNull
public static <T> T[] mergeArrays(@NotNull T[] a1, @NotNull T[] a2) {
if (a1.length == 0) {
return a2;
}
if (a2.length == 0) {
return a1;
}
T[] result = (T[])Array.newInstance(aClass, a1.length + a2.length);
@SuppressWarnings("unchecked") T[] result = (T[])Array.newInstance(a1.getClass().getComponentType(), a1.length + a2.length);
System.arraycopy(a1, 0, result, 0, a1.length);
System.arraycopy(a2, 0, result, a1.length, a2.length);
return result;
@@ -176,7 +185,6 @@ public class ArrayUtil {
return mergeArrays(a1, a2, STRING_ARRAY_FACTORY);
}
@NotNull
public static int[] mergeArrays(@NotNull int[] a1, @NotNull int[] a2) {
if (a1.length == 0) {
@@ -185,15 +193,10 @@ public class ArrayUtil {
if (a2.length == 0) {
return a1;
}
int[] a = new int[a1.length + a2.length];
int idx = 0;
for (int i : a1) {
a[idx++] = i;
}
for (int i : a2) {
a[idx++] = i;
}
return a;
int[] result = new int[a1.length + a2.length];
System.arraycopy(a1, 0, result, 0, a1.length);
System.arraycopy(a2, 0, result, a1.length, a2.length);
return result;
}
/**
@@ -617,10 +620,8 @@ public class ArrayUtil {
return array.length > 0 ? array[array.length - 1] : null;
}
/** @deprecated use {@linkplain #mergeArrays(Object[], Object[])} (to remove in IDEA 12) */
public static <T> T[] join(T[] array1, T[] array2) {
final T[] newArray = (T[])Array.newInstance(array1.getClass().getComponentType(), array1.length + array2.length);
System.arraycopy(array1, 0, newArray, 0, array1.length);
System.arraycopy(array2, 0, newArray, array1.length, array2.length);
return newArray;
return mergeArrays(array1, array2);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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,7 @@ public class DevKitInspectionToolProvider implements InspectionToolProvider {
InspectionDescriptionNotFoundInspection.class,
IntentionDescriptionNotFoundInspection.class,
};
return ArrayUtil.mergeArrays(result, InternalInspectionToolsProvider.getPublicClasses(), Class.class);
return ArrayUtil.mergeArrays(result, InternalInspectionToolsProvider.getPublicClasses());
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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 PluginModuleType extends ModuleType<PluginModuleBuilder> {
}
}, ADD_PLUGIN_MODULE_ICON, "reference.dialogs.new.project.fromScratch.sdk"));
final ModuleWizardStep[] wizardSteps = steps.toArray(new ModuleWizardStep[steps.size()]);
return ArrayUtil.mergeArrays(wizardSteps, super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider), ModuleWizardStep.class);
return ArrayUtil.mergeArrays(wizardSteps, super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider));
}
public PluginModuleBuilder createModuleBuilder() {
@@ -48,7 +48,7 @@ public class GitTestRunEnv {
* @return
*/
public String run(@NotNull String command, String... params) throws IOException {
String[] arguments = (String[])ArrayUtil.join(new String[]{gitExecutable, command}, params);
String[] arguments = ArrayUtil.mergeArrays(new String[]{gitExecutable, command}, params);
log("# " + StringUtil.join(arguments, " "));
final ProcessBuilder builder = new ProcessBuilder().command(arguments);
builder.directory(myRootDir);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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,7 +32,6 @@ import org.jetbrains.plugins.groovy.util.LibrariesUtil;
import java.io.File;
import java.io.InputStream;
import java.util.Collection;
import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
@@ -143,7 +142,7 @@ public abstract class AbstractConfigUtils {
}
public Library[] getAllSDKLibraries(@Nullable Project project) {
return ArrayUtil.mergeArrays(getGlobalSDKLibraries(), getProjectSDKLibraries(project), Library.class);
return ArrayUtil.mergeArrays(getGlobalSDKLibraries(), getProjectSDKLibraries(project));
}
public Library[] getGlobalSDKLibraries() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -97,7 +97,7 @@ public class GrDocFieldReferenceImpl extends GrDocMemberReferenceImpl implements
MethodResolverProcessor constructorProcessor = new MethodResolverProcessor(name, this, true, thisType, null, PsiType.EMPTY_ARRAY);
resolved.processDeclarations(methodProcessor, ResolveState.initial(), resolved, this);
resolved.processDeclarations(constructorProcessor, ResolveState.initial(), resolved, this);
candidates = ArrayUtil.mergeArrays(methodProcessor.getCandidates(), constructorProcessor.getCandidates(), GroovyResolveResult.class);
candidates = ArrayUtil.mergeArrays(methodProcessor.getCandidates(), constructorProcessor.getCandidates());
if (candidates.length > 0) {
candidates = new GroovyResolveResult[]{candidates[0]};
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -184,7 +184,7 @@ public abstract class GrDocMemberReferenceImpl extends GroovyDocPsiElementImpl i
PsiElement[] methodCandidates = ResolveUtil.mapToElements(methodProcessor.getCandidates());
PsiElement[] elements = ArrayUtil.mergeArrays(propertyCandidates, methodCandidates, PsiElement.class);
PsiElement[] elements = ArrayUtil.mergeArrays(propertyCandidates, methodCandidates);
return ContainerUtil.map2Array(elements, new Function<PsiElement, Object>() {
public Object fun(PsiElement psiElement) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -27,7 +27,6 @@ import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocMethodParams;
import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocMethodReference;
import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocReferenceElement;
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
import org.jetbrains.plugins.groovy.lang.resolve.processors.MethodResolverProcessor;
@@ -103,7 +102,7 @@ public class GrDocMethodReferenceImpl extends GrDocMemberReferenceImpl implement
MethodResolverProcessor constructorProcessor = new MethodResolverProcessor(name, this, true, thisType, parameterTypes, PsiType.EMPTY_ARRAY);
resolved.processDeclarations(processor, ResolveState.initial(), resolved, this);
resolved.processDeclarations(constructorProcessor, ResolveState.initial(), resolved, this);
return ArrayUtil.mergeArrays(processor.getCandidates(), constructorProcessor.getCandidates(), GroovyResolveResult.class);
return ArrayUtil.mergeArrays(processor.getCandidates(), constructorProcessor.getCandidates());
}
return new ResolveResult[0];
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -105,7 +105,7 @@ public class GrEnumTypeDefinitionImpl extends GrTypeDefinitionImpl implements Gr
GrEnumConstant[] enumConstants = getEnumConstants();
if (bodyFields.length == 0) return enumConstants;
if (enumConstants.length == 0) return bodyFields;
return ArrayUtil.mergeArrays(bodyFields, enumConstants, GrField.class);
return ArrayUtil.mergeArrays(bodyFields, enumConstants);
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -97,7 +97,7 @@ public class I18nInspection extends BaseLocalInspectionTool {
if (myCachedNonNlsPattern != null) {
actions = new SuppressIntentionAction[]{new SuppressByCommentOutAction(nonNlsCommentPattern)};
}
return ArrayUtil.mergeArrays(actions, super.getSuppressActions(element), SuppressIntentionAction.class);
return ArrayUtil.mergeArrays(actions, super.getSuppressActions(element));
}
public void readSettings(Element node) throws InvalidDataException {
@@ -213,7 +213,7 @@ public class XsltSymbolIndex extends FileBasedIndexExtension<String, XsltSymbolI
final XmlTag[] v = root.findSubTags("variable", XsltSupport.XSLT_NS);
final XmlTag[] p = root.findSubTags("param", XsltSupport.XSLT_NS);
final XmlTag[] t = root.findSubTags("template", XsltSupport.XSLT_NS);
tags = ArrayUtil.mergeArrays(ArrayUtil.mergeArrays(v, p, XmlTag.class), t, XmlTag.class);
tags = ArrayUtil.mergeArrays(ArrayUtil.mergeArrays(v, p), t);
} else {
tags = root.findSubTags(kind.name().toLowerCase(), XsltSupport.XSLT_NS);
}
@@ -285,7 +285,7 @@ class XsltRunSettingsEditor extends SettingsEditor<XsltRunConfiguration> {
});
final Module[] modules = ModuleManager.getInstance(project).getModules();
myModule.setModel(new DefaultComboBoxModel(ArrayUtil.mergeArrays(new Object[]{"<default>"}, modules, Object.class)));
myModule.setModel(new DefaultComboBoxModel(ArrayUtil.mergeArrays(new Object[]{"<default>"}, modules)));
myModule.setRenderer(new ListCellRendererWrapper(myModule) {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -48,8 +48,7 @@ public class RelaxedHtmlFromSchemaElementDescriptor extends XmlElementDescriptor
public XmlElementDescriptor[] getElementsDescriptors(final XmlTag context) {
return ArrayUtil.mergeArrays(
super.getElementsDescriptors(context),
HtmlUtil.getCustomTagDescriptors(context),
XmlElementDescriptor.class
HtmlUtil.getCustomTagDescriptors(context)
);
}
@@ -75,7 +74,7 @@ public class RelaxedHtmlFromSchemaElementDescriptor extends XmlElementDescriptor
return descriptors;
}
for (XmlAttributeDescriptorsProvider provider: Extensions.getExtensions(XmlAttributeDescriptorsProvider.EP_NAME)) {
descriptors = ArrayUtil.mergeArrays(descriptors, provider.getAttributeDescriptors(context), XmlAttributeDescriptor.class);
descriptors = ArrayUtil.mergeArrays(descriptors, provider.getAttributeDescriptors(context));
}
return descriptors;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -49,6 +49,6 @@ public class RelaxedHtmlFromSchemaNSDescriptor extends XmlNSDescriptorImpl imple
@NotNull
public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument doc) {
return ArrayUtil.mergeArrays(super.getRootElementsDescriptors(doc), HtmlUtil.getCustomTagDescriptors(doc), XmlElementDescriptor.class);
return ArrayUtil.mergeArrays(super.getRootElementsDescriptors(doc), HtmlUtil.getCustomTagDescriptors(doc));
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -240,8 +240,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype {
return ArrayUtil.mergeArrays(
uriRefs != null? uriRefs: PsiReference.EMPTY_ARRAY,
referencesFromProviders,
PsiReference.class
referencesFromProviders
);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -67,7 +67,7 @@ public interface XmlChildRole {
{
final StartTagEndTokenProvider[] tokenProviders = Extensions.getExtensions(EP_NAME);
for (StartTagEndTokenProvider tokenProvider : tokenProviders) {
myElementTypes = ArrayUtil.mergeArrays(myElementTypes, tokenProvider.getTypes(), IElementType.class);
myElementTypes = ArrayUtil.mergeArrays(myElementTypes, tokenProvider.getTypes());
}
}
};
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -218,8 +218,7 @@ public class XmlElementDescriptorImpl implements XmlElementDescriptor, PsiWritab
if (nsDescriptor != null) {
elementsDescriptors = ArrayUtil.mergeArrays(
elementsDescriptors,
nsDescriptor.getRootElementsDescriptors(((XmlFile)containingFile).getDocument()),
XmlElementDescriptor.class
nsDescriptor.getRootElementsDescriptors(((XmlFile)containingFile).getDocument())
);
}
}
@@ -278,8 +277,7 @@ public class XmlElementDescriptorImpl implements XmlElementDescriptor, PsiWritab
if (descriptor instanceof XmlNSDescriptorImpl) {
attributeDescriptors = ArrayUtil.mergeArrays(
attributeDescriptors,
((XmlNSDescriptorImpl)descriptor).getRootAttributeDescriptors(context),
XmlAttributeDescriptor.class
((XmlNSDescriptorImpl)descriptor).getRootAttributeDescriptors(context)
);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -316,8 +316,7 @@ public class HtmlUtil {
if (declarationTag instanceof HtmlTag) {
descriptors = ArrayUtil.mergeArrays(
descriptors,
getCustomAttributeDescriptors(context),
XmlAttributeDescriptor.class
getCustomAttributeDescriptors(context)
);
return descriptors;
}
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2011 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.intellij.html;
import com.intellij.html.impl.RelaxedHtmlFromSchemaElementDescriptor;
@@ -41,8 +56,7 @@ public class RelaxedHtmlFromRngElementDescriptor implements XmlElementDescriptor
public XmlElementDescriptor[] getElementsDescriptors(final XmlTag context) {
return ArrayUtil.mergeArrays(
myDelegate.getElementsDescriptors(context),
HtmlUtil.getCustomTagDescriptors(context),
XmlElementDescriptor.class
HtmlUtil.getCustomTagDescriptors(context)
);
}
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2011 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.intellij.html;
import com.intellij.html.RelaxedHtmlNSDescriptor;
@@ -38,6 +53,6 @@ public class RelaxedHtmlFromRngNSDescriptor extends RngNsDescriptor implements R
@NotNull
public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument doc) {
return ArrayUtil.mergeArrays(super.getRootElementsDescriptors(doc), HtmlUtil.getCustomTagDescriptors(doc), XmlElementDescriptor.class);
return ArrayUtil.mergeArrays(super.getRootElementsDescriptors(doc), HtmlUtil.getCustomTagDescriptors(doc));
}
}
@@ -109,7 +109,7 @@ public abstract class BaseInspection extends XmlSuppressableInspectionTool {
return super.isAvailable(project, editor, element) && getTarget(element).getText().startsWith("grammar ");
}
}
}, getXmlOnlySuppressions(element), SuppressIntentionAction.class);
}, getXmlOnlySuppressions(element));
} else {
return super.getSuppressActions(element);
}
@@ -243,7 +243,7 @@ public class RngNsDescriptor implements XmlNSDescriptor, Validator {
final PsiElementProcessor.CollectElements<XmlFile> processor = new PsiElementProcessor.CollectElements<XmlFile>();
RelaxIncludeIndex.processForwardDependencies(myFile, processor);
if (processor.getCollection().size() > 0) {
return ArrayUtil.mergeArrays(a, processor.toArray(), Object.class);
return ArrayUtil.mergeArrays(a, processor.toArray());
} else {
return a;
}