diff --git a/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpPropertyImpl.java b/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpPropertyImpl.java index 3a2584df25f3..70154f0e36ec 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpPropertyImpl.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpPropertyImpl.java @@ -25,7 +25,6 @@ import com.intellij.psi.PsiReference; import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; import com.intellij.util.PlatformIcons; -import com.intellij.util.containers.ContainerUtil; import org.intellij.lang.regexp.RegExpLanguageHosts; import org.intellij.lang.regexp.RegExpTT; import org.intellij.lang.regexp.psi.RegExpElementVisitor; @@ -146,7 +145,7 @@ public class RegExpPropertyImpl extends RegExpElementImpl implements RegExpPrope } else { boolean startsWithIs = categoryNode != null && categoryNode.getText().startsWith("Is"); - Collection result = ContainerUtil.newArrayList(); + Collection result = new ArrayList<>(); for (String[] properties : RegExpLanguageHosts.getInstance().getAllKnownProperties(getElement())) { String name = ArrayUtil.getFirstElement(properties); if (name != null) { diff --git a/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.java b/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.java index 784465141a44..05ca5e482639 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/impl/BuildProcessClasspathManager.java @@ -14,17 +14,13 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.io.URLUtil; import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; import java.net.URL; -import java.util.Enumeration; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.jar.JarFile; /** @@ -56,7 +52,7 @@ public class BuildProcessClasspathManager { } private static List computeCompileServerPluginsClasspath() { - final List classpath = ContainerUtil.newArrayList(); + final List classpath = new ArrayList<>(); for (CompileServerPlugin serverPlugin : CompileServerPlugin.EP_NAME.getExtensions()) { final PluginId pluginId = serverPlugin.getPluginDescriptor().getPluginId(); @@ -148,7 +144,7 @@ public class BuildProcessClasspathManager { } private static List getDynamicClasspath(Project project) { - final List classpath = ContainerUtil.newArrayList(); + final List classpath = new ArrayList<>(); for (BuildProcessParametersProvider provider : BuildProcessParametersProvider.EP_NAME.getExtensionList(project)) { classpath.addAll(provider.getClassPath()); } @@ -156,7 +152,7 @@ public class BuildProcessClasspathManager { } public static List getLauncherClasspath(Project project) { - final List classpath = ContainerUtil.newArrayList(); + final List classpath = new ArrayList<>(); for (BuildProcessParametersProvider provider : BuildProcessParametersProvider.EP_NAME.getExtensionList(project)) { classpath.addAll(provider.getLauncherClassPath()); } diff --git a/java/idea-ui/src/com/intellij/jarRepository/JarRepositoryManager.java b/java/idea-ui/src/com/intellij/jarRepository/JarRepositoryManager.java index 5dc1fa57b00c..cecab2f59c9c 100644 --- a/java/idea-ui/src/com/intellij/jarRepository/JarRepositoryManager.java +++ b/java/idea-ui/src/com/intellij/jarRepository/JarRepositoryManager.java @@ -30,7 +30,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.util.Processor; import com.intellij.util.concurrency.SequentialTaskExecutor; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashMap; import org.eclipse.aether.artifact.Artifact; import org.eclipse.aether.repository.RemoteRepository; @@ -118,7 +117,7 @@ public class JarRepositoryManager { JpsMavenRepositoryLibraryDescriptor libraryDescriptor) { RepositoryLibraryProperties props = new RepositoryLibraryProperties(libraryDescriptor); final JpsMavenRepositoryLibraryDescriptor libDescriptor = props.getRepositoryLibraryDescriptor(); - final Collection roots = ContainerUtil.newArrayList(); + final Collection roots = new ArrayList<>(); if (libDescriptor.getMavenId() != null) { roots.addAll(loadDependenciesModal(project, libDescriptor, kinds, repositories, copyTo)); } diff --git a/java/idea-ui/src/com/intellij/jarRepository/RepositoryAttachDialog.java b/java/idea-ui/src/com/intellij/jarRepository/RepositoryAttachDialog.java index 15d90762e102..011152259ac1 100644 --- a/java/idea-ui/src/com/intellij/jarRepository/RepositoryAttachDialog.java +++ b/java/idea-ui/src/com/intellij/jarRepository/RepositoryAttachDialog.java @@ -23,7 +23,6 @@ import com.intellij.ui.ComboboxWithBrowseButton; import com.intellij.ui.DocumentAdapter; import com.intellij.ui.components.JBCheckBox; import com.intellij.ui.components.JBLabel; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.AsyncProcessIcon; import com.intellij.xml.util.XmlStringUtil; import gnu.trove.THashMap; @@ -86,7 +85,7 @@ public class RepositoryAttachDialog extends DialogWrapper { private final JComboBox myCombobox; private final Map myCoordinates = new THashMap<>(); - private final List myShownItems = ContainerUtil.newArrayList(); + private final List myShownItems = new ArrayList<>(); private final String myDefaultDownloadFolder; private String myFilterString; diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/DefaultInferredAnnotationProvider.java b/java/java-analysis-impl/src/com/intellij/codeInsight/DefaultInferredAnnotationProvider.java index 864093ad5751..d294f4b38b24 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/DefaultInferredAnnotationProvider.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/DefaultInferredAnnotationProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight; import com.intellij.codeInspection.bytecodeAnalysis.ProjectBytecodeAnalysis; @@ -234,7 +234,7 @@ public class DefaultInferredAnnotationProvider implements InferredAnnotationProv @Override public List findInferredAnnotations(@NotNull PsiModifierListOwner listOwner) { listOwner = PsiUtil.preferCompiledElement(listOwner); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); PsiAnnotation[] fromBytecode = ProjectBytecodeAnalysis.getInstance(myProject).findInferredAnnotations(listOwner); for (PsiAnnotation annotation : fromBytecode) { if (!ignoreInference(listOwner, annotation.getQualifiedName())) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java b/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java index da53b3a16551..7cefffc4daa2 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java @@ -1,14 +1,14 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.psi.PsiAnnotation; import com.intellij.psi.PsiModifierListOwner; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; public class InferredAnnotationsManagerImpl extends InferredAnnotationsManager { @@ -35,7 +35,7 @@ public class InferredAnnotationsManagerImpl extends InferredAnnotationsManager { @NotNull @Override public PsiAnnotation[] findInferredAnnotations(@NotNull PsiModifierListOwner listOwner) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (InferredAnnotationProvider provider : InferredAnnotationProvider.EP_NAME.getExtensionList(myProject)) { List annotations = provider.findInferredAnnotations(listOwner); for (PsiAnnotation annotation : annotations) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java index 3206e6c51bd8..7b3e38b72be4 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.daemon.impl.analysis; import com.intellij.codeInsight.daemon.JavaErrorMessages; @@ -919,7 +919,7 @@ public class GenericsHighlightUtil { @Nullable static Collection checkCatchParameterIsClass(@NotNull PsiParameter parameter) { if (!(parameter.getDeclarationScope() instanceof PsiCatchSection)) return null; - final Collection result = ContainerUtil.newArrayList(); + final Collection result = new ArrayList<>(); final List typeElements = PsiUtil.getParameterTypeElements(parameter); for (PsiTypeElement typeElement : typeElements) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java index dd2e0bcb4c79..61150afff102 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java @@ -1338,7 +1338,7 @@ public class HighlightUtil extends HighlightUtilBase { final GlobalSearchScope parameterResolveScope = parameter.getResolveScope(); thrownTypes.add(PsiType.getJavaLangError(manager, parameterResolveScope)); thrownTypes.add(PsiType.getJavaLangRuntimeException(manager, parameterResolveScope)); - final Collection result = ContainerUtil.newArrayList(); + final Collection result = new ArrayList<>(); final List parameterTypeElements = PsiUtil.getParameterTypeElements(parameter); final boolean isMultiCatch = parameterTypeElements.size() > 1; @@ -2453,7 +2453,7 @@ public class HighlightUtil extends HighlightUtilBase { static Collection checkCatchTypeIsDisjoint(@NotNull final PsiParameter parameter) { if (!(parameter.getType() instanceof PsiDisjunctionType)) return null; - final Collection result = ContainerUtil.newArrayList(); + final Collection result = new ArrayList<>(); final List typeElements = PsiUtil.getParameterTypeElements(parameter); for (int i = 0, size = typeElements.size(); i < size; i++) { final PsiClass class1 = PsiUtil.resolveClassInClassTypeOnly(typeElements.get(i).getType()); @@ -2493,7 +2493,7 @@ public class HighlightUtil extends HighlightUtilBase { final List typeElements = PsiUtil.getParameterTypeElements(parameter); final boolean isInMultiCatch = typeElements.size() > 1; - final Collection result = ContainerUtil.newArrayList(); + final Collection result = new ArrayList<>(); for (PsiTypeElement typeElement : typeElements) { final PsiClass catchClass = PsiUtil.resolveClassInClassTypeOnly(typeElement.getType()); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaInstructionState.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaInstructionState.java index 0c9f2a6f8a0b..1b0d931d03e1 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaInstructionState.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaInstructionState.java @@ -75,7 +75,7 @@ class StateQueue { DfaInstructionState next = myQueue.peek(); if (next == null || next.compareTo(state) != 0) return Collections.singletonList(state); - List memoryStates = ContainerUtil.newArrayList(); + List memoryStates = new ArrayList<>(); memoryStates.add((DfaMemoryStateImpl)state.getMemoryState()); while (!myQueue.isEmpty() && myQueue.peek().compareTo(state) == 0) { DfaMemoryState anotherState = myQueue.poll().getMemoryState(); @@ -93,7 +93,7 @@ class StateQueue { groups.putValue(memoryState.getSuperficialKey(), memoryState); } - memoryStates = ContainerUtil.newArrayList(); + memoryStates = new ArrayList<>(); for (Map.Entry> entry : groups.entrySet()) { memoryStates.addAll(mergeGroup((List)entry.getValue())); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java index f512b179d9ad..ac98220de341 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java @@ -52,7 +52,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState { protected DfaMemoryStateImpl(final DfaValueFactory factory) { myFactory = factory; myDefaultVariableStates = new THashMap<>(); - myEqClasses = ContainerUtil.newArrayList(); + myEqClasses = new ArrayList<>(); myVariableStates = new LinkedHashMap<>(); myDistinctClasses = new DistinctPairSet(this); myStack = new Stack<>(); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/EqClass.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/EqClass.java index 91029b77d1f6..2328253bcf7e 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/EqClass.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/EqClass.java @@ -1,24 +1,9 @@ -/* - * Copyright 2000-2013 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.dataFlow; import com.intellij.codeInspection.dataFlow.value.*; import com.intellij.openapi.util.Ref; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import one.util.streamex.IntStreamEx; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -68,7 +53,7 @@ class EqClass extends SortedIntSet { } List getVariables(boolean unwrap) { - List vars = ContainerUtil.newArrayList(); + List vars = new ArrayList<>(); forEach(id -> { DfaValue value = myFactory.getValue(id); if (value instanceof DfaVariableValue) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardMethodContract.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardMethodContract.java index 8a088057d9c2..bccc61a107d4 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardMethodContract.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardMethodContract.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.dataFlow; import com.intellij.codeInspection.dataFlow.value.DfaConstValue; @@ -203,7 +189,7 @@ public final class StandardMethodContract extends MethodContract { public static List parseContract(@NotNull String text) throws ParseException { if (StringUtil.isEmptyOrSpaces(text)) return Collections.emptyList(); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); String[] split = StringUtil.replace(text, " ", "").split(";"); for (int clauseIndex = 0; clauseIndex < split.length; clauseIndex++) { String clause = split[clauseIndex]; diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java index 415238fc4ad7..bdaf19350295 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java @@ -517,7 +517,7 @@ class StateMerger { private static class Replacements { @NotNull private final List myAllStates; private final Set myRemovedStates = ContainerUtil.newIdentityTroveSet(); - private final List myMerged = ContainerUtil.newArrayList(); + private final List myMerged = new ArrayList<>(); private Replacements(@NotNull List allStates) { myAllStates = allStates; diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/inference/ContractInferenceInterpreter.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/inference/ContractInferenceInterpreter.java index 4d2e0f74d36c..a51355dda1f4 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/inference/ContractInferenceInterpreter.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/inference/ContractInferenceInterpreter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.dataFlow.inference; import com.intellij.codeInspection.dataFlow.ContractReturnValue; @@ -242,7 +242,7 @@ class ContractInferenceInterpreter { int paramIndex = resolveParameter(expr); if (paramIndex >= 0) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (ValueConstraint[] state : states) { if (state[paramIndex] == TRUE_VALUE || state[paramIndex] == FALSE_VALUE || state[paramIndex] == NULL_VALUE) { // like "if(x == null) return x": no need to refer to parameter @@ -305,7 +305,7 @@ class ContractInferenceInterpreter { constraint = getLiteralConstraint(op1); } if (parameter >= 0 && constraint != null) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (ValueConstraint[] state : states) { if (constraint == NOT_NULL_VALUE) { if (getPrimitiveParameterType(parameter) == null) { @@ -334,7 +334,7 @@ class ContractInferenceInterpreter { private List visitLogicalOperation(List operands, boolean conjunction, List states) { BooleanReturnValue breakValue = returnBoolean(!conjunction); - List finalStates = ContainerUtil.newArrayList(); + List finalStates = new ArrayList<>(); for (LighterASTNode operand : operands) { List opResults = visitExpression(states, operand); finalStates.addAll(ContainerUtil.filter(knownContracts(opResults), contract -> contract.getReturnValue() == breakValue)); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java index 28d0bbb2604e..8555c2990bac 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaValueFactory.java @@ -12,7 +12,6 @@ import com.intellij.openapi.util.Pair; import com.intellij.patterns.ElementPattern; import com.intellij.psi.*; import com.intellij.psi.util.*; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.FList; import com.intellij.util.containers.FactoryMap; import one.util.streamex.StreamEx; @@ -27,7 +26,7 @@ import static com.intellij.patterns.PsiJavaPatterns.psiParameter; import static com.intellij.patterns.StandardPatterns.or; public class DfaValueFactory { - private final List myValues = ContainerUtil.newArrayList(); + private final List myValues = new ArrayList<>(); final Map, Boolean> myAssignableCache = new HashMap<>(); final Map, Boolean> myConvertibleCache = new HashMap<>(); private final Map myDfaTypes = new HashMap<>(); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java index 3f6df81e0d14..6f4908f4c920 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection.nullable; import com.intellij.codeInsight.*; @@ -190,7 +190,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection PsiElement list = reference.getParent(); PsiElement psiClass = list instanceof PsiReferenceList ? list.getParent() : null; PsiElement intf = reference.resolve(); - if (psiClass instanceof PsiClass && list == ((PsiClass)psiClass).getImplementsList() && + if (psiClass instanceof PsiClass && list == ((PsiClass)psiClass).getImplementsList() && intf instanceof PsiClass && ((PsiClass)intf).isInterface()) { String error = checkIndirectInheritance(psiClass, (PsiClass)intf); if (error != null) { @@ -371,9 +371,9 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection "' should not override non-null parameter from '" + intfMethodClass.getName() + "'"; } if (isNotNullParameterOverridingNonAnnotated(manager, parameter, supers)) { - return "Non-null parameter '" + parameter.getName() + - "' in method '" + overridingMethod.getName() + - "' from '" + overridingMethodClass.getName() + + return "Non-null parameter '" + parameter.getName() + + "' in method '" + overridingMethod.getName() + + "' from '" + overridingMethodClass.getName() + "' should not override non-annotated parameter from '" + intfMethodClass.getName() + "'"; } } @@ -531,7 +531,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection List initializers = DfaPsiUtil.findAllConstructorInitializers(field); if (initializers.isEmpty()) return; - List notNullParams = ContainerUtil.newArrayList(); + List notNullParams = new ArrayList<>(); boolean isFinal = field.hasModifierProperty(PsiModifier.FINAL); @@ -611,7 +611,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection AnnotationUtil.findAnnotation(owner, manager.getNullables())); } } - + private static Annotated check(final PsiModifierListOwner owner, final ProblemsHolder holder, PsiType type) { Annotated annotated = Annotated.from(owner); checkType(owner, holder, type, annotated.notNull, annotated.nullable); @@ -747,7 +747,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection for (int i = 0; i < parameters.length; i++) { PsiParameter parameter = parameters[i]; - List superParameters = ContainerUtil.newArrayList(); + List superParameters = new ArrayList<>(); for (PsiMethod superMethod : superMethods) { PsiParameter[] _superParameters = superMethod.getParameterList().getParameters(); if (_superParameters.length == parameters.length) { @@ -794,16 +794,16 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection private PsiParameter findNotNullSuperForNonAnnotatedParameter(NullableNotNullManager nullableManager, PsiParameter parameter, List superParameters) { - return REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL && !nullableManager.hasNullability(parameter) - ? ContainerUtil.find(superParameters, - sp -> isNotNullNotInferred(sp, false, IGNORE_EXTERNAL_SUPER_NOTNULL) && !hasInheritableNotNull(sp)) + return REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL && !nullableManager.hasNullability(parameter) + ? ContainerUtil.find(superParameters, + sp -> isNotNullNotInferred(sp, false, IGNORE_EXTERNAL_SUPER_NOTNULL) && !hasInheritableNotNull(sp)) : null; } @Nullable private PsiParameter findNullableSuperForNotNullParameter(PsiParameter parameter, List superParameters) { - return REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE && isNotNullNotInferred(parameter, false, false) - ? ContainerUtil.find(superParameters, sp -> isNullableNotInferred(sp, false)) + return REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE && isNotNullNotInferred(parameter, false, false) + ? ContainerUtil.find(superParameters, sp -> isNullableNotInferred(sp, false)) : null; } @@ -895,7 +895,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection for (int i = 0; i < psiParameters.length; i++) { if (parameterQuickFixSuggested[i]) continue; PsiParameter parameter = psiParameters[i]; - if (parameterAnnotated[i] && + if (parameterAnnotated[i] && !isNotNullNotInferred(parameter, false, false) && !isNullableNotInferred(parameter, false) && AddAnnotationPsiFix.isAvailable(parameter, defaultNotNull)) { @@ -924,7 +924,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection public static boolean shouldSkipOverriderAsGenerated(PsiMethod overriding) { if (Registry.is("idea.report.nullity.missing.in.generated.overriders")) return false; - + PsiFile file = overriding.getContainingFile(); VirtualFile virtualFile = file != null ? file.getVirtualFile() : null; return virtualFile != null && GeneratedSourcesFilter.isGeneratedSourceByAnyFilter(virtualFile, overriding.getProject()); diff --git a/java/java-impl/src/com/intellij/application/options/editor/ExcludeTable.java b/java/java-impl/src/com/intellij/application/options/editor/ExcludeTable.java index 75ae482f3420..d8ed9ec755e5 100644 --- a/java/java-impl/src/com/intellij/application/options/editor/ExcludeTable.java +++ b/java/java-impl/src/com/intellij/application/options/editor/ExcludeTable.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.application.options.editor; import com.intellij.codeInsight.CodeInsightSettings; @@ -23,7 +23,6 @@ import com.intellij.ui.ScrollingUtil; import com.intellij.ui.components.fields.ExtendableTextField; import com.intellij.ui.table.JBTable; import com.intellij.util.ArrayUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.ListTableModel; @@ -34,10 +33,7 @@ import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; +import java.util.*; import java.util.function.BiFunction; import java.util.regex.Pattern; @@ -186,7 +182,7 @@ class ExcludeTable extends ListTableWithButtons { } void reset() { - List rows = ContainerUtil.newArrayList(); + List rows = new ArrayList<>(); for (String s : CodeInsightSettings.getInstance().EXCLUDED_PACKAGES) { rows.add(new Item(s, ExclusionScope.IDE)); } @@ -204,7 +200,7 @@ class ExcludeTable extends ListTableWithButtons { } private List getExcludedPackages(ExclusionScope scope) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (Item pair : getTableView().getListTableModel().getItems()) { if (scope == pair.scope) { result.add(pair.exclude); diff --git a/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java b/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java index 3fc6cfbbc241..0edb2283400c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java @@ -179,7 +179,7 @@ public class ExpectedTypesProvider { } return null; } - + @NotNull public static PsiType[] processExpectedTypes(@NotNull ExpectedTypeInfo[] infos, @NotNull PsiTypeVisitor visitor, @NotNull Project project) { @@ -270,14 +270,14 @@ public class ExpectedTypesProvider { private final int myMaxCandidates; private final ExpectedClassProvider myClassProvider; private final boolean myVoidable; - final List myResult = ContainerUtil.newArrayList(); + final List myResult = new ArrayList<>(); @NonNls private static final String LENGTH_SYNTHETIC_ARRAY_FIELD = "length"; private MyParentVisitor(PsiExpression expr, boolean forCompletion, ExpectedClassProvider classProvider, boolean voidable, - boolean usedAfter, + boolean usedAfter, int maxCandidates) { myExpr = expr; myForCompletion = forCompletion; @@ -510,7 +510,7 @@ public class ExpectedTypesProvider { PsiType type = statement.getIterationParameter().getType(); if (PsiType.NULL.equals(type)) return; - + PsiType arrayType = type.createArrayType(); myResult.add(createInfoImpl(arrayType, arrayType)); @@ -671,7 +671,7 @@ public class ExpectedTypesProvider { if (candidates != null) { final PsiExpressionList argumentList = Objects.requireNonNull(newExpr.getArgumentList()); CandidateInfo[] converted = ContainerUtil.map(candidates, candidate -> (CandidateInfo)candidate, CandidateInfo.EMPTY_ARRAY); - Collections.addAll(myResult, getExpectedArgumentTypesForMethodCall(converted, argumentList, myExpr, myForCompletion, + Collections.addAll(myResult, getExpectedArgumentTypesForMethodCall(converted, argumentList, myExpr, myForCompletion, newExpr.resolveMethod())); } return; diff --git a/java/java-impl/src/com/intellij/codeInsight/JavaProjectCodeInsightSettings.java b/java/java-impl/src/com/intellij/codeInsight/JavaProjectCodeInsightSettings.java index eebeddeb84a8..424b0581329f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/JavaProjectCodeInsightSettings.java +++ b/java/java-impl/src/com/intellij/codeInsight/JavaProjectCodeInsightSettings.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight; import com.intellij.openapi.Disposable; @@ -12,13 +10,13 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.util.PatternUtil; import com.intellij.util.containers.ConcurrentFactoryMap; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.XmlSerializerUtil; import com.intellij.util.xmlb.annotations.XCollection; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ConcurrentMap; @@ -33,7 +31,7 @@ public class JavaProjectCodeInsightSettings implements PersistentStateComponent< private static final ConcurrentMap ourPatterns = ConcurrentFactoryMap.createWeakMap(PatternUtil::fromMask); @XCollection(propertyElementName = "excluded-names", elementName = "name", valueAttributeName = "") - public List excludedNames = ContainerUtil.newArrayList(); + public List excludedNames = new ArrayList<>(); public static JavaProjectCodeInsightSettings getSettings(@NotNull Project project) { return ServiceManager.getService(project, JavaProjectCodeInsightSettings.class); @@ -93,7 +91,7 @@ public class JavaProjectCodeInsightSettings implements PersistentStateComponent< Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { - instance.excludedNames = ContainerUtil.newArrayList(); + instance.excludedNames = new ArrayList<>(); } }); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java index ba61a5d392dc..241b7c0ff5da 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.ExpectedTypeInfo; @@ -76,7 +62,7 @@ public class JavaCompletionSorting { sorter = sorter.weighAfter("priority", new PreferDefaultTypeWeigher(expectedTypes, parameters, false)); } - List afterStats = ContainerUtil.newArrayList(); + List afterStats = new ArrayList<>(); afterStats.add(new PreferByKindWeigher(type, position, expectedTypes)); if (smart) { afterStats.add(new PreferDefaultTypeWeigher(expectedTypes, parameters, true)); @@ -284,8 +270,8 @@ public class JavaCompletionSorting { for (int i = 0; i < limit; i++) { String word = words.get(words.size() - i - 1); String expectedWord = expectedWords[expectedWords.length - i - 1]; - if ( word.equalsIgnoreCase(expectedWord) || - StringUtil.endsWithIgnoreCase(word, expectedWord) || + if ( word.equalsIgnoreCase(expectedWord) || + StringUtil.endsWithIgnoreCase(word, expectedWord) || StringUtil.endsWithIgnoreCase(expectedWord, word)) { max = Math.max(max, i + 1); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/PreferByKindWeigher.java b/java/java-impl/src/com/intellij/codeInsight/completion/PreferByKindWeigher.java index 0be9dc9006d9..ff11d9c6e726 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/PreferByKindWeigher.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/PreferByKindWeigher.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.completion; import com.intellij.codeInsight.AnnotationTargetUtil; @@ -37,10 +23,7 @@ import com.intellij.util.text.CharArrayUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.function.Function; import static com.intellij.patterns.PsiJavaPatterns.elementType; @@ -95,7 +78,7 @@ public class PreferByKindWeigher extends LookupElementWeigher { private static Function createSuitabilityCondition(final PsiElement position) { if (isExceptionPosition(position)) { PsiElement container = PsiTreeUtil.getParentOfType(position, PsiTryStatement.class, PsiMethod.class); - List thrownExceptions = ContainerUtil.newArrayList(); + List thrownExceptions = new ArrayList<>(); if (container != null) { PsiElement block = container instanceof PsiTryStatement ? ((PsiTryStatement)container).getTryBlock() : container; if (block != null) { @@ -154,8 +137,8 @@ public class PreferByKindWeigher extends LookupElementWeigher { } static boolean isExceptionPosition(PsiElement position) { - return IN_CATCH_TYPE.accepts(position) || IN_MULTI_CATCH_TYPE.accepts(position) || - INSIDE_METHOD_THROWS_CLAUSE.accepts(position) || + return IN_CATCH_TYPE.accepts(position) || IN_MULTI_CATCH_TYPE.accepts(position) || + INSIDE_METHOD_THROWS_CLAUSE.accepts(position) || JavaDocCompletionContributor.THROWS_TAG_EXCEPTION.accepts(position); } @@ -390,11 +373,11 @@ public class PreferByKindWeigher extends LookupElementWeigher { private static boolean isGetter(Object object) { if (!(object instanceof PsiMethod)) return false; - + PsiMethod method = (PsiMethod)object; if (!PropertyUtilBase.hasGetterName(method)) return false; if (method.hasTypeParameters()) return false; - + return !KnownElementWeigher.isGetClass(method); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java index caef24323b52..fa08e12ea9b1 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java @@ -94,7 +94,7 @@ public abstract class StaticMemberProcessor { } public List processMembersOfRegisteredClasses(final PrefixMatcher matcher, PairConsumer consumer) { - final ArrayList result = ContainerUtil.newArrayList(); + final ArrayList result = new ArrayList<>(); for (final PsiClass psiClass : myStaticImportedClasses) { for (final PsiMethod method : psiClass.getAllMethods()) { if (matcher.prefixMatches(method.getName())) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImplementMethodsFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImplementMethodsFix.java index 53fe662bbe2c..429fe6ad7fe8 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImplementMethodsFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImplementMethodsFix.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.FileModificationService; @@ -33,10 +19,10 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiEnumConstant; import com.intellij.psi.PsiFile; import com.intellij.psi.infos.CandidateInfo; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -105,12 +91,12 @@ public class ImplementMethodsFix extends LocalQuickFixAndIntentionActionOnPsiEle @Nullable protected static MemberChooser chooseMethodsToImplement(Editor editor, PsiElement startElement, - PsiClass aClass, + PsiClass aClass, boolean implemented) { FeatureUsageTracker.getInstance().triggerFeatureUsed(ProductivityFeatureNames.CODEASSISTS_OVERRIDE_IMPLEMENT); final Collection overrideImplement = OverrideImplementExploreUtil.getMapToOverrideImplement(aClass, true, implemented).values(); return OverrideImplementUtil - .showOverrideImplementChooser(editor, startElement, true, overrideImplement, ContainerUtil.newArrayList()); + .showOverrideImplementChooser(editor, startElement, true, overrideImplement, new ArrayList<>()); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java index e94f57ec004b..180c20478a29 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.editorActions.wordSelection; import com.intellij.lang.java.JavaLanguage; @@ -21,9 +7,9 @@ import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.javadoc.PsiDocComment; import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -41,7 +27,7 @@ public class MethodOrClassSelectioner extends BasicSelectioner { @Override public List select(@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); PsiElement firstChild = e.getFirstChild(); PsiElement[] children = e.getChildren(); diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java index 34ee8f77511d..77c9cc933bfd 100644 --- a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.generation; import com.intellij.application.options.CodeStyle; @@ -418,7 +418,7 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil { Collection candidates = getMethodsToOverrideImplement(aClass, toImplement); Collection secondary = toImplement || aClass.isInterface() ? - ContainerUtil.newArrayList() : getMethodsToOverrideImplement(aClass, true); + new ArrayList<>() : getMethodsToOverrideImplement(aClass, true); final MemberChooser chooser = showOverrideImplementChooser(editor, aClass, toImplement, candidates, secondary); if (chooser == null) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/template/macro/ComponentTypeOfMacro.java b/java/java-impl/src/com/intellij/codeInsight/template/macro/ComponentTypeOfMacro.java index 5ab66a10ad6b..ac528c39bfa6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/template/macro/ComponentTypeOfMacro.java +++ b/java/java-impl/src/com/intellij/codeInsight/template/macro/ComponentTypeOfMacro.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.template.macro; import com.intellij.codeInsight.CodeInsightBundle; @@ -22,9 +8,9 @@ import com.intellij.codeInsight.template.*; import com.intellij.psi.PsiArrayType; import com.intellij.psi.PsiExpression; import com.intellij.psi.PsiType; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; public class ComponentTypeOfMacro extends Macro { @@ -44,7 +30,7 @@ public class ComponentTypeOfMacro extends Macro { LookupElement[] lookupItems = params[0].calculateLookupItems(context); if (lookupItems == null) return null; - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (LookupElement element : lookupItems) { PsiTypeLookupItem lookupItem = element.as(PsiTypeLookupItem.CLASS_CONDITION_KEY); if (lookupItem != null) { diff --git a/java/java-impl/src/com/intellij/ide/projectView/impl/PackageViewPane.java b/java/java-impl/src/com/intellij/ide/projectView/impl/PackageViewPane.java index 98c2735f268f..435e353b95a4 100644 --- a/java/java-impl/src/com/intellij/ide/projectView/impl/PackageViewPane.java +++ b/java/java-impl/src/com/intellij/ide/projectView/impl/PackageViewPane.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.projectView.impl; @@ -119,7 +119,7 @@ public class PackageViewPane extends AbstractProjectViewPSIPane { @NotNull @Override public PsiDirectory[] getSelectedDirectories() { - List directories = ContainerUtil.newArrayList(); + List directories = new ArrayList<>(); for (PackageElementNode node : getSelectedNodes(PackageElementNode.class)) { PackageElement packageElement = node.getValue(); PsiPackage aPackage = packageElement != null ? packageElement.getPackage() : null; diff --git a/java/java-impl/src/com/intellij/internal/ExpressionStatisticsAction.java b/java/java-impl/src/com/intellij/internal/ExpressionStatisticsAction.java index c5ca3d8482cc..fdecb2b0a487 100644 --- a/java/java-impl/src/com/intellij/internal/ExpressionStatisticsAction.java +++ b/java/java-impl/src/com/intellij/internal/ExpressionStatisticsAction.java @@ -17,9 +17,9 @@ import com.intellij.openapi.ui.Messages; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; public class ExpressionStatisticsAction extends AnAction { @@ -80,7 +80,7 @@ public class ExpressionStatisticsAction extends AnAction { @NotNull private static List collectJavaFiles(VirtualFile dir, Project project) { - final List javaFiles = ContainerUtil.newArrayList(); + final List javaFiles = new ArrayList<>(); ProjectFileIndex.SERVICE.getInstance(project).iterateContentUnderDirectory(dir, file -> { if (file.getName().endsWith(".java")) { javaFiles.add(file); diff --git a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java index 46e8e5403f13..26c01c00d498 100644 --- a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java +++ b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java @@ -21,7 +21,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.*; import com.intellij.openapi.vfs.jrt.JrtFileSystem; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import com.intellij.util.lang.JavaVersion; import org.jdom.Element; @@ -433,7 +432,7 @@ public class JavaSdkImpl extends JavaSdk { @NotNull private static List findClasses(@NotNull File jdkHome, boolean isJre) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); if (JdkUtil.isExplodedModularRuntime(jdkHome.getPath())) { File[] exploded = new File(jdkHome, "modules").listFiles(); diff --git a/java/java-impl/src/com/intellij/pom/java/AcceptedLanguageLevelsSettings.java b/java/java-impl/src/com/intellij/pom/java/AcceptedLanguageLevelsSettings.java index 2fb5aee4cd46..71f145cb8a10 100644 --- a/java/java-impl/src/com/intellij/pom/java/AcceptedLanguageLevelsSettings.java +++ b/java/java-impl/src/com/intellij/pom/java/AcceptedLanguageLevelsSettings.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.pom.java; import com.intellij.notification.NotificationDisplayType; @@ -22,7 +22,6 @@ import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.util.Disposer; import com.intellij.ui.components.LegalNoticeDialog; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import com.intellij.util.xmlb.XmlSerializerUtil; import com.intellij.util.xmlb.annotations.XCollection; @@ -32,6 +31,7 @@ import org.jetbrains.annotations.TestOnly; import javax.swing.event.HyperlinkEvent; import java.awt.*; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -44,7 +44,7 @@ public class AcceptedLanguageLevelsSettings implements PersistentStateComponent< new NotificationGroup("Accepted language levels", NotificationDisplayType.STICKY_BALLOON, true); @XCollection(propertyElementName = "explicitly-accepted", elementName = "name", valueAttributeName = "") - public List acceptedNames = ContainerUtil.newArrayList(); + public List acceptedNames = new ArrayList<>(); @Override public void runActivity(@NotNull Project project) { diff --git a/java/java-impl/src/com/intellij/psi/codeStyle/JavaPackageEntryTableAccessor.java b/java/java-impl/src/com/intellij/psi/codeStyle/JavaPackageEntryTableAccessor.java index a8625e5bea19..eb583cd30533 100644 --- a/java/java-impl/src/com/intellij/psi/codeStyle/JavaPackageEntryTableAccessor.java +++ b/java/java-impl/src/com/intellij/psi/codeStyle/JavaPackageEntryTableAccessor.java @@ -2,11 +2,11 @@ package com.intellij.psi.codeStyle; import com.intellij.application.options.codeStyle.properties.ValueListPropertyAccessor; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.List; import static com.intellij.application.options.codeStyle.properties.CodeStylePropertiesUtil.toCommaSeparatedString; @@ -59,7 +59,7 @@ public class JavaPackageEntryTableAccessor extends ValueListPropertyAccessor toExternal(@NotNull PackageEntryTable value) { - List externalList = ContainerUtil.newArrayList(); + List externalList = new ArrayList<>(); for (PackageEntry entry : value.getEntries()) { if (entry == PackageEntry.BLANK_LINE_ENTRY) { externalList.add(String.valueOf(BLANK_LINE_CHAR)); diff --git a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/FieldDependenciesManager.java b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/FieldDependenciesManager.java index 86eadc18bfe9..16ce42b7e72a 100644 --- a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/FieldDependenciesManager.java +++ b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/FieldDependenciesManager.java @@ -2,13 +2,9 @@ package com.intellij.psi.codeStyle.arrangement; import com.intellij.psi.PsiField; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public class FieldDependenciesManager { private final Map> myFieldDependencies; @@ -24,7 +20,7 @@ public class FieldDependenciesManager { @NotNull public List getRoots() { - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); for (Map.Entry> entry : myFieldDependencies.entrySet()) { ArrangementEntryDependencyInfo currentInfo = myFieldInfosMap.get(entry.getKey()); diff --git a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java index 3ea4a8b19e80..4d9ce0ccebc3 100644 --- a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java +++ b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java @@ -355,7 +355,7 @@ public class JavaArrangementVisitor extends JavaRecursiveElementVisitor { @NotNull private static List getComments(@NotNull PsiElement element) { PsiElement[] children = element.getChildren(); - List comments = ContainerUtil.newArrayList(); + List comments = new ArrayList<>(); for (PsiElement e : children) { if (e instanceof PsiComment) { diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/ChildrenBlocksBuilder.java b/java/java-impl/src/com/intellij/psi/formatter/java/ChildrenBlocksBuilder.java index be0fecfb0922..b4d4b645b9d0 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/ChildrenBlocksBuilder.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/ChildrenBlocksBuilder.java @@ -6,9 +6,9 @@ import com.intellij.lang.ASTNode; import com.intellij.openapi.util.Condition; import com.intellij.psi.formatter.FormatterUtil; import com.intellij.psi.tree.IElementType; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,7 +21,7 @@ public class ChildrenBlocksBuilder { } public List buildNodeChildBlocks(ASTNode node, BlockFactory factory) { - List blocks = ContainerUtil.newArrayList(); + List blocks = new ArrayList<>(); for (ASTNode child : node.getChildren(null)) { if (FormatterUtil.isWhitespaceOrEmpty(child) || child.getTextLength() == 0) { diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java b/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java index 6af0433cff19..2eb3f79e68ee 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.formatter.java; import com.intellij.formatting.Block; @@ -40,6 +40,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -1294,7 +1295,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor { int length = expressions.length; assert length > 1; - List ranges = ContainerUtil.newArrayList(); + List ranges = new ArrayList<>(); for (int i = 0; i < length - 1; i++) { int startOffset = expressions[i].getTextRange().getEndOffset(); int endOffset = expressions[i + 1].getTextRange().getStartOffset(); diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java index 2e18eacfe5ef..b7da48f8871e 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2018 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.source.resolve.reference.impl.providers; import com.intellij.codeInsight.completion.JavaClassNameCompletionContributor; @@ -240,7 +226,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer @Override @NotNull public Object[] getVariants() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (PsiElement context : getCompletionContexts()) { if (context instanceof PsiPackage) { result.addAll(processPackage((PsiPackage)context)); @@ -259,7 +245,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer } private List getCompletionContexts() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); ContainerUtil.addIfNotNull(result, getCompletionContext()); @@ -293,7 +279,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer @NotNull private List processPackage(@NotNull PsiPackage aPackage) { - final ArrayList list = ContainerUtil.newArrayList(); + final ArrayList list = new ArrayList<>(); final int startOffset = StringUtil.isEmpty(aPackage.getName()) ? 0 : aPackage.getQualifiedName().length() + 1; final GlobalSearchScope scope = getScope(getJavaContextFile()); for (final PsiPackage subPackage : aPackage.getSubPackages(scope)) { diff --git a/java/java-impl/src/com/intellij/psi/util/proximity/ExplicitlyImportedWeigher.java b/java/java-impl/src/com/intellij/psi/util/proximity/ExplicitlyImportedWeigher.java index 112676319b0d..6ee48ef7031b 100644 --- a/java/java-impl/src/com/intellij/psi/util/proximity/ExplicitlyImportedWeigher.java +++ b/java/java-impl/src/com/intellij/psi/util/proximity/ExplicitlyImportedWeigher.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.util.proximity; import com.intellij.openapi.module.Module; @@ -29,6 +15,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -46,7 +33,7 @@ public class ExplicitlyImportedWeigher extends ProximityWeigher { final PsiImportList importList = psiJavaFile == null ? null : psiJavaFile.getImportList(); if (importList == null) return Collections.emptyList(); - List importedNames = ContainerUtil.newArrayList(); + List importedNames = new ArrayList<>(); for (PsiImportStatementBase statement : importList.getAllImportStatements()) { PsiJavaCodeReferenceElement reference = statement.getImportReference(); ContainerUtil.addIfNotNull(importedNames, reference == null ? null : reference.getQualifiedName()); diff --git a/java/java-impl/src/com/intellij/refactoring/encapsulateFields/EncapsulateFieldsProcessor.java b/java/java-impl/src/com/intellij/refactoring/encapsulateFields/EncapsulateFieldsProcessor.java index 7a4d988cced2..c8fe533a928c 100644 --- a/java/java-impl/src/com/intellij/refactoring/encapsulateFields/EncapsulateFieldsProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/encapsulateFields/EncapsulateFieldsProcessor.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.refactoring.encapsulateFields; import com.intellij.lang.findUsages.DescriptiveNameUtil; @@ -35,7 +21,6 @@ import com.intellij.usageView.UsageInfo; import com.intellij.usageView.UsageViewDescriptor; import com.intellij.usageView.UsageViewUtil; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -246,7 +231,7 @@ public class EncapsulateFieldsProcessor extends BaseRefactoringProcessor { @Override @NotNull protected UsageInfo[] findUsages() { - ArrayList array = ContainerUtil.newArrayList(); + ArrayList array = new ArrayList<>(); for (FieldDescriptor fieldDescriptor : myFieldDescriptors) { for (final PsiReference reference : ReferencesSearch.search(fieldDescriptor.getField())) { final PsiElement element = reference.getElement(); diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java b/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java index 42c4b206c798..9f2e0f868b10 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight; import com.intellij.openapi.util.Pair; @@ -36,7 +36,7 @@ public class ExceptionUtil { @NotNull public static List getThrownExceptions(@NotNull PsiElement[] elements) { - List array = ContainerUtil.newArrayList(); + List array = new ArrayList<>(); for (PsiElement element : elements) { List exceptions = getThrownExceptions(element); addExceptions(array, exceptions); @@ -55,7 +55,7 @@ public class ExceptionUtil { @NotNull private static List filterOutUncheckedExceptions(@NotNull List exceptions) { - List array = ContainerUtil.newArrayList(); + List array = new ArrayList<>(); for (PsiClassType exception : exceptions) { if (!isUncheckedException(exception)) array.add(exception); } @@ -145,7 +145,7 @@ public class ExceptionUtil { @NotNull private static List getTryExceptions(@NotNull PsiTryStatement tryStatement) { - List array = ContainerUtil.newArrayList(); + List array = new ArrayList<>(); PsiResourceList resourceList = tryStatement.getResourceList(); if (resourceList != null) { @@ -205,7 +205,7 @@ public class ExceptionUtil { GlobalSearchScope scope = place.getResolveScope(); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (PsiType type : referenceTypes) { type = PsiClassImplUtil.correctType(substitutor.substitute(type), scope); if (type instanceof PsiClassType) { @@ -371,7 +371,7 @@ public class ExceptionUtil { @NotNull public static List getUnhandledExceptions(final @NotNull PsiElement[] elements) { - final List array = ContainerUtil.newArrayList(); + final List array = new ArrayList<>(); final PsiElementVisitor visitor = new JavaRecursiveElementWalkingVisitor() { @Override @@ -473,7 +473,7 @@ public class ExceptionUtil { try { PsiScopesUtil.setupAndRunProcessor(processor, methodCall, false); // Resolve other signatures in case of multiple interface inheritance - // e.g. consider + // e.g. consider // interface X {void a() throws A;} interface Y{void a() throws B;} class Z extends X, Y {} // here normal resolve returns X.a(), but we should check throws clauses for both a() methods. // (see JLS 15.12.2.5) @@ -672,7 +672,7 @@ public class ExceptionUtil { PsiSubstitutor substitutor, PsiClassType[] referencedTypes) { if (referencedTypes.length > 0) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (PsiClassType referencedType : referencedTypes) { final PsiType type = PsiClassImplUtil.correctType(GenericsUtil.eliminateWildcards(substitutor.substitute(referencedType), false), element.getResolveScope()); diff --git a/java/java-psi-impl/src/com/intellij/psi/NonClasspathClassFinder.java b/java/java-psi-impl/src/com/intellij/psi/NonClasspathClassFinder.java index b01761fb5839..f107b9d7f9bd 100644 --- a/java/java-psi-impl/src/com/intellij/psi/NonClasspathClassFinder.java +++ b/java/java-psi-impl/src/com/intellij/psi/NonClasspathClassFinder.java @@ -110,7 +110,7 @@ public abstract class NonClasspathClassFinder extends PsiElementFinder { @NotNull @Override public PsiClass[] getClasses(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); processDirectories(psiPackage.getQualifiedName(), scope, dir -> { for (final VirtualFile file : dir.getChildren()) { if (!file.isDirectory() && ArrayUtil.contains(file.getExtension(), myFileExtensions)) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java index ec349f07cd1b..f1c3a3655f18 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java @@ -349,7 +349,7 @@ public class PsiClassImplUtil { return ConcurrentFactoryMap.createMap(key -> { final Map> map = new THashMap<>(); - final List allMembers = ContainerUtil.newArrayList(); + final List allMembers = new ArrayList<>(); map.put(ALL, allMembers); ElementClassFilter filter = key == MemberType.CLASS ? ElementClassFilter.CLASS : diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/ScopedClassHierarchy.java b/java/java-psi-impl/src/com/intellij/psi/impl/ScopedClassHierarchy.java index 89dc87c20c99..86c734b12289 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/ScopedClassHierarchy.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/ScopedClassHierarchy.java @@ -17,10 +17,7 @@ import gnu.trove.TObjectHashingStrategy; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.intellij.util.ObjectUtils.assertNotNull; @@ -73,7 +70,7 @@ class ScopedClassHierarchy { @NotNull private static List getSuperTypes(PsiClass psiClass) { - List superTypes = ContainerUtil.newArrayList(); + List superTypes = new ArrayList<>(); if (psiClass instanceof PsiAnonymousClass) { ContainerUtil.addIfNotNull(superTypes, ((PsiAnonymousClass)psiClass).getBaseClassType()); } @@ -144,7 +141,7 @@ class ScopedClassHierarchy { @NotNull private List calcImmediateSupersWithCapturing() { PsiUtilCore.ensureValid(myPlaceClass); - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); for (PsiClassType type : myPlaceClass.getSuperTypes()) { PsiUtil.ensureValidType(type); PsiClassType corrected = PsiClassImplUtil.correctType(type, myResolveScope); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java index e9488cacf8fb..5cc8d7ffdf85 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.compiled; import com.intellij.navigation.ItemPresentation; @@ -46,7 +46,7 @@ public class ClsClassImpl extends ClsMemberImpl> implements PsiE @Override @NotNull public PsiElement[] getChildren() { - List children = ContainerUtil.newArrayList(); + List children = new ArrayList<>(); ContainerUtil.addAll(children, getChildren(getDocComment(), getModifierListInternal(), getNameIdentifier(), getExtendsList(), getImplementsList())); ContainerUtil.addAll(children, getOwnFields()); ContainerUtil.addAll(children, getOwnMethods()); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java index 3eb6183f45d6..9726aaec7e00 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.compiled; import com.intellij.core.JavaCoreBundle; @@ -34,10 +20,10 @@ import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -95,7 +81,7 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil return PsiElement.EMPTY_ARRAY; } - List list = ContainerUtil.newArrayListWithCapacity(children.length); + List list = new ArrayList<>(children.length); for (PsiElement child : children) { if (child != null) { list.add(child); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java index de619887b92b..74cf55dbf862 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.compiled; import com.intellij.openapi.util.Pair; @@ -26,6 +12,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.text.CharacterIterator; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -43,7 +30,7 @@ public class SignatureParsing { return Collections.emptyList(); } - List> typeParameters = ContainerUtil.newArrayList(); + List> typeParameters = new ArrayList<>(); signature.next(); while (signature.current() != '>') { typeParameters.add(parseTypeParameter(signature, mapping)); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java index ab1b042d2365..10931a1c4393 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java @@ -28,10 +28,7 @@ import java.io.IOException; import java.lang.reflect.Array; import java.text.CharacterIterator; import java.text.StringCharacterIterator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import static com.intellij.openapi.util.Pair.pair; import static com.intellij.util.BitUtil.isSet; @@ -672,7 +669,7 @@ public class StubBuildingVisitor extends ClassVisitor { private boolean accepted(int index, String text) { if (myFilters == null) { - myFilters = ContainerUtil.newArrayListWithCapacity(myParamCount + 1); + myFilters = new ArrayList<>(myParamCount + 1); for (int i = 0; i < myParamCount + 1; i++) myFilters.add(null); } Set filter = myFilters.get(index); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java index 849e3ad6b60a..0f102b451a11 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.file; import com.intellij.codeInsight.completion.scope.JavaCompletionHints; @@ -248,7 +234,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya } PsiClass[] result = partial.get(Pair.create(scope, name)); if (result == null) { - List fastClasses = ContainerUtil.newArrayList(); + List fastClasses = new ArrayList<>(); for (PsiDirectory directory : getDirectories(scope)) { List sameNamed = ContainerUtil.filter(directory.getFiles(), file -> file.getName().contains(name)); Collections.addAll(fastClasses, CoreJavaDirectoryService.getPsiClasses(directory, sameNamed.toArray(PsiFile.EMPTY_ARRAY))); @@ -307,7 +293,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya if (classes.length == 0 && PsiUtil.isInsideJavadocComment(place)) { //extend scope for javadoc references when no classes are found in the resolve scope: - //always replacing the scope works bad for the case when multiple classes with the same FQName exist, because index return them in unpredictable order, + //always replacing the scope works bad for the case when multiple classes with the same FQName exist, because index return them in unpredictable order, //so class not accessible from `place` may be used instead of another accessible class classes = findClassByShortName(providedName, allScope()); } @@ -390,7 +376,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya private class PackageAnnotationValueProvider implements CachedValueProvider { @Override public Result compute() { - List modifiers = ContainerUtil.newArrayList(); + List modifiers = new ArrayList<>(); for(PsiDirectory directory: getDirectories()) { PsiFile file = directory.findFile(PACKAGE_INFO_FILE); PsiPackageStatement stmt = file == null ? null : PsiTreeUtil.getChildOfType(file, PsiPackageStatement.class); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/light/LightJavaModule.java b/java/java-psi-impl/src/com/intellij/psi/impl/light/LightJavaModule.java index 7cb97f93282b..8f196fcea526 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/light/LightJavaModule.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/light/LightJavaModule.java @@ -17,12 +17,12 @@ import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiUtil; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.jar.JarFile; @@ -67,7 +67,7 @@ public class LightJavaModule extends LightElement implements PsiJavaModule { } private List findExports() { - List exports = ContainerUtil.newArrayList(); + List exports = new ArrayList<>(); VfsUtilCore.visitChildrenRecursively(myJarRoot, new VirtualFileVisitor() { private final JavaDirectoryService service = JavaDirectoryService.getInstance(); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/light/LightPsiClassBuilder.java b/java/java-psi-impl/src/com/intellij/psi/impl/light/LightPsiClassBuilder.java index 2489be4ae573..d515cf5528b1 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/light/LightPsiClassBuilder.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/light/LightPsiClassBuilder.java @@ -1,26 +1,12 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.light; import com.intellij.psi.*; import com.intellij.psi.impl.PsiClassImplUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import static com.intellij.psi.PsiReferenceList.Role.EXTENDS_LIST; @@ -32,7 +18,7 @@ public class LightPsiClassBuilder extends LightPsiClassBase implements OriginInf private final LightReferenceListBuilder myImplementsList = new LightReferenceListBuilder(getManager(), IMPLEMENTS_LIST); private final LightReferenceListBuilder myExtendsList = new LightReferenceListBuilder(getManager(), EXTENDS_LIST); private final LightTypeParameterListBuilder myTypeParametersList = new LightTypeParameterListBuilder(getManager(), getLanguage()); - private final Collection myMethods = ContainerUtil.newArrayList(); + private final Collection myMethods = new ArrayList<>(); private PsiElement myScope; private PsiClass myContainingClass; private String myOriginInfo; diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocMethodOrFieldRef.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocMethodOrFieldRef.java index 675d8ea011a8..1d91de397653 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocMethodOrFieldRef.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocMethodOrFieldRef.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.source.javadoc; import com.intellij.lang.ASTNode; @@ -40,7 +26,6 @@ import com.intellij.util.ArrayUtil; import com.intellij.util.CharTable; import com.intellij.util.IncorrectOperationException; import com.intellij.util.SmartList; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -99,7 +84,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo final MethodSignature methodSignature; if (signature != null) { - final List types = ContainerUtil.newArrayListWithCapacity(signature.length); + final List types = new ArrayList<>(signature.length); final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(element.getProject()); for (String s : signature) { try { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCatchSectionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCatchSectionImpl.java index 17116b7bc5ee..37e6721cb40b 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCatchSectionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCatchSectionImpl.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.source.tree.java; import com.intellij.codeInsight.ExceptionUtil; @@ -146,7 +132,7 @@ public class PsiCatchSectionImpl extends CompositePsiElement implements PsiCatch } private static Collection getThrownTypes(@NotNull PsiTryStatement statement) { - Collection types = ContainerUtil.newArrayList(); + Collection types = new ArrayList<>(); PsiCodeBlock tryBlock = statement.getTryBlock(); if (tryBlock != null) { types.addAll(ExceptionUtil.getThrownExceptions(tryBlock)); diff --git a/java/java-tests/testSrc/com/intellij/java/psi/impl/cache/impl/FindClassTest.java b/java/java-tests/testSrc/com/intellij/java/psi/impl/cache/impl/FindClassTest.java index 9f843712558f..34597b1f6842 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/impl/cache/impl/FindClassTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/impl/cache/impl/FindClassTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.psi.impl.cache.impl; import com.intellij.openapi.application.ApplicationManager; @@ -41,10 +27,10 @@ import com.intellij.psi.search.PackageScope; import com.intellij.psi.util.FindClassUtil; import com.intellij.testFramework.PsiTestCase; import com.intellij.testFramework.PsiTestUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.jps.model.java.JavaResourceRootType; import java.io.File; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -196,7 +182,7 @@ public class FindClassTest extends PsiTestCase { } private List configureTwoMoreModules() { - final List newModules = ContainerUtil.newArrayList(); + final List newModules = new ArrayList<>(); ApplicationManager.getApplication().runWriteAction(() -> { ModifiableModuleModel modifiableModel = ModuleManager.getInstance(getProject()).getModifiableModel(); Module module2 = modifiableModel.newModule("a.iml", StdModuleTypes.JAVA.getId()); diff --git a/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JavaSdkUtil.java b/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JavaSdkUtil.java index 907c02b6a94d..a714c07b1bc6 100644 --- a/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JavaSdkUtil.java +++ b/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JavaSdkUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.model.java.impl; import com.intellij.openapi.util.SystemInfo; @@ -14,6 +14,7 @@ import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.FileFilter; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -55,7 +56,7 @@ public class JavaSdkUtil { FileFilter jarFileFilter = FileFilters.filesWithExtension("jar"); Set pathFilter = ContainerUtil.newTroveSet(FileUtil.PATH_HASHING_STRATEGY); - List rootFiles = ContainerUtil.newArrayList(); + List rootFiles = new ArrayList<>(); if (Registry.is("project.structure.add.tools.jar.to.new.jdk")) { File toolsJar = new File(home, "lib/tools.jar"); if (toolsJar.isFile()) { diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/JpsJavaCompilerNotNullableSerializer.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/JpsJavaCompilerNotNullableSerializer.java index 12c15ecc8262..42a6f060534d 100644 --- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/JpsJavaCompilerNotNullableSerializer.java +++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/JpsJavaCompilerNotNullableSerializer.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.model.serialization.java.compiler; import com.intellij.util.containers.ContainerUtil; @@ -23,6 +9,7 @@ import org.jetbrains.jps.model.java.JpsJavaExtensionService; import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration; import org.jetbrains.jps.model.serialization.JpsProjectExtensionSerializer; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -38,7 +25,7 @@ public class JpsJavaCompilerNotNullableSerializer extends JpsProjectExtensionSer @Override public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project); - List annoNames = ContainerUtil.newArrayList(); + List annoNames = new ArrayList<>(); for (Element option : componentTag.getChildren("instrumentedNotNulls")) { for (Element item : option.getChildren("option")) { ContainerUtil.addIfNotNull(annoNames, item.getAttributeValue("value")); diff --git a/json/src/com/intellij/json/breadcrumbs/JsonBreadcrumbsProvider.java b/json/src/com/intellij/json/breadcrumbs/JsonBreadcrumbsProvider.java index 7ab178f8eca6..e188ea02829f 100644 --- a/json/src/com/intellij/json/breadcrumbs/JsonBreadcrumbsProvider.java +++ b/json/src/com/intellij/json/breadcrumbs/JsonBreadcrumbsProvider.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.json.breadcrumbs; import com.intellij.json.JsonBundle; @@ -10,7 +11,6 @@ import com.intellij.lang.Language; import com.intellij.openapi.ide.CopyPasteManager; import com.intellij.psi.PsiElement; import com.intellij.ui.breadcrumbs.BreadcrumbsProvider; -import com.intellij.util.containers.ContainerUtil; import com.jetbrains.jsonSchema.impl.JsonSchemaDocumentationProvider; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,6 +18,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; +import java.util.ArrayList; import java.util.List; /** @@ -59,7 +60,7 @@ public class JsonBreadcrumbsProvider implements BreadcrumbsProvider { @Override public List getContextActions(@NotNull PsiElement element) { JsonQualifiedNameKind[] values = JsonQualifiedNameKind.values(); - List actions = ContainerUtil.newArrayListWithCapacity(values.length); + List actions = new ArrayList<>(values.length); for (JsonQualifiedNameKind kind: values) { actions.add(new AbstractAction(JsonBundle.message("json.copy.to.clipboard", kind.toString())) { @Override diff --git a/json/src/com/intellij/json/formatter/JsonBlock.java b/json/src/com/intellij/json/formatter/JsonBlock.java index 992e0001e5e6..bc256f364bda 100644 --- a/json/src/com/intellij/json/formatter/JsonBlock.java +++ b/json/src/com/intellij/json/formatter/JsonBlock.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.json.formatter; import com.intellij.formatting.*; @@ -12,10 +13,10 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.TokenType; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.tree.TokenSet; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import static com.intellij.json.JsonElementTypes.*; @@ -65,7 +66,7 @@ public class JsonBlock implements ASTBlock { public JsonBlock(@Nullable JsonBlock parent, @NotNull ASTNode node, - @NotNull JsonCodeStyleSettings customSettings, + @NotNull JsonCodeStyleSettings customSettings, @Nullable Alignment alignment, @NotNull Indent indent, @Nullable Wrap wrap, @@ -109,7 +110,7 @@ public class JsonBlock implements ASTBlock { if (mySubBlocks == null) { int propertyAlignment = myCustomSettings.PROPERTY_ALIGNMENT; ASTNode[] children = myNode.getChildren(null); - mySubBlocks = ContainerUtil.newArrayListWithCapacity(children.length); + mySubBlocks = new ArrayList<>(children.length); for (ASTNode child: children) { if (isWhitespaceOrEmpty(child)) continue; mySubBlocks.add(makeSubBlock(child, propertyAlignment)); diff --git a/json/src/com/intellij/json/pointer/JsonPointerPosition.java b/json/src/com/intellij/json/pointer/JsonPointerPosition.java index 1447b95fa06f..9a384f86aaca 100644 --- a/json/src/com/intellij/json/pointer/JsonPointerPosition.java +++ b/json/src/com/intellij/json/pointer/JsonPointerPosition.java @@ -1,10 +1,11 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.json.pointer; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -13,7 +14,7 @@ import static com.jetbrains.jsonSchema.JsonPointerUtil.*; public class JsonPointerPosition { public JsonPointerPosition() { - this.steps = ContainerUtil.newArrayList(); + this.steps = new ArrayList<>(); } private JsonPointerPosition(List steps) { @@ -26,7 +27,7 @@ public class JsonPointerPosition { public static JsonPointerPosition parsePointer(@NotNull String pointer) { final List chain = split(normalizeSlashes(normalizeId(pointer))); - List steps = ContainerUtil.newArrayListWithCapacity(chain.size()); + List steps = new ArrayList<>(chain.size()); for (String s: chain) { try { steps.add(JsonPointerPosition.Step.createArrayElementStep(Integer.parseInt(s))); diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonCachedValues.java b/json/src/com/jetbrains/jsonSchema/impl/JsonCachedValues.java index 4fa1a61c8086..fdbe08d59a12 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonCachedValues.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonCachedValues.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.jsonSchema.impl; import com.intellij.codeInsight.completion.CompletionUtil; @@ -26,10 +26,7 @@ import com.jetbrains.jsonSchema.remote.JsonFileResolver; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; public class JsonCachedValues { private static final Key> JSON_OBJECT_CACHE_KEY = Key.create("JsonSchemaObjectCache"); @@ -154,7 +151,7 @@ public class JsonCachedValues { JsonValue schemasValue = schemas.getValue(); if (!(schemasValue instanceof JsonArray)) return null; - List catalogMap = ContainerUtil.newArrayList(); + List catalogMap = new ArrayList<>(); fillMap((JsonArray)schemasValue, catalogMap); return catalogMap; } @@ -193,7 +190,7 @@ public class JsonCachedValues { } if (value instanceof JsonArray) { - List strings = ContainerUtil.newArrayList(); + List strings = new ArrayList<>(); for (JsonValue val: ((JsonArray)value).getValueList()) { if (val instanceof JsonStringLiteral) { strings.add(((JsonStringLiteral)val).getValue()); diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonPointerReferenceProvider.java b/json/src/com/jetbrains/jsonSchema/impl/JsonPointerReferenceProvider.java index 312102d71f19..b870bc9473f6 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonPointerReferenceProvider.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonPointerReferenceProvider.java @@ -32,6 +32,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -52,7 +53,7 @@ public class JsonPointerReferenceProvider extends PsiReferenceProvider { @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { if (!(element instanceof JsonStringLiteral)) return PsiReference.EMPTY_ARRAY; - List refs = ContainerUtil.newArrayList(); + List refs = new ArrayList<>(); List> fragments = ((JsonStringLiteral)element).getTextFragments(); if (fragments.size() != 1) return PsiReference.EMPTY_ARRAY; @@ -136,7 +137,7 @@ public class JsonPointerReferenceProvider extends PsiReferenceProvider { @NotNull private Object[] collectCatalogVariants() { - List elements = ContainerUtil.newArrayList(); + List elements = new ArrayList<>(); final Project project = getElement().getProject(); final List schemas = JsonSchemaService.Impl.get(project).getAllUserVisibleSchemas(); for (JsonSchemaInfo schema : schemas) { diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java index 9607d2c4c094..a0b9eb6059f9 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaAnnotatorChecker.java @@ -361,7 +361,7 @@ class JsonSchemaAnnotatorChecker { @NotNull private JsonValidationError.MissingMultiplePropsIssueData createMissingPropertiesData(@NotNull JsonSchemaObject schema, HashSet requiredNames) { - List allProps = ContainerUtil.newArrayList(); + List allProps = new ArrayList<>(); for (String req: requiredNames) { JsonSchemaObject propertySchema = resolvePropertySchema(schema, req); Object defaultValue = propertySchema == null ? null : propertySchema.getDefault(); @@ -516,7 +516,7 @@ class JsonSchemaAnnotatorChecker { if (!value.isShouldBeIgnored()) checker.typeError(value.getDelegate(), null, getExpectedTypes(collection)); } else { - final List filtered = ContainerUtil.newArrayListWithCapacity(collection.size()); + final List filtered = new ArrayList<>(collection.size()); for (JsonSchemaObject schema: collection) { if (!areSchemaTypesCompatible(schema, type)) continue; filtered.add(schema); @@ -848,8 +848,8 @@ class JsonSchemaAnnotatorChecker { // returns the schema, selected for annotation private JsonSchemaObject processOneOf(@NotNull JsonValueAdapter value, List oneOf) { - final List candidateErroneousCheckers = ContainerUtil.newArrayList(); - final List candidateErroneousSchemas = ContainerUtil.newArrayList(); + final List candidateErroneousCheckers = new ArrayList<>(); + final List candidateErroneousSchemas = new ArrayList<>(); final List correct = new SmartList<>(); for (JsonSchemaObject object : oneOf) { // skip it if something JS awaited, we do not process it currently @@ -941,8 +941,8 @@ class JsonSchemaAnnotatorChecker { // returns the schema, selected for annotation private JsonSchemaObject processAnyOf(@NotNull JsonValueAdapter value, List anyOf) { - final List candidateErroneousCheckers = ContainerUtil.newArrayList(); - final List candidateErroneousSchemas = ContainerUtil.newArrayList(); + final List candidateErroneousCheckers = new ArrayList<>(); + final List candidateErroneousSchemas = new ArrayList<>(); for (JsonSchemaObject object : anyOf) { final JsonSchemaAnnotatorChecker checker = new JsonSchemaAnnotatorChecker(myProject, myOptions); diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaComplianceChecker.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaComplianceChecker.java index 8bca7942cd93..dbee14ea14a8 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaComplianceChecker.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaComplianceChecker.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.jsonSchema.impl; import com.intellij.codeInspection.LocalInspectionToolSession; @@ -18,10 +18,7 @@ import com.jetbrains.jsonSchema.extension.adapters.JsonValueAdapter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public class JsonSchemaComplianceChecker { private static final Key> ANNOTATED_PROPERTIES = Key.create("JsonSchema.Properties.Annotated"); @@ -89,8 +86,8 @@ public class JsonSchemaComplianceChecker { private void createWarnings(@Nullable JsonSchemaAnnotatorChecker checker) { if (checker == null || checker.isCorrect()) return; // compute intersecting ranges - we'll solve warning priorities based on this information - List ranges = ContainerUtil.newArrayList(); - List>> entries = ContainerUtil.newArrayList(); + List ranges = new ArrayList<>(); + List>> entries = new ArrayList<>(); for (Map.Entry entry : checker.getErrors().entrySet()) { TextRange range = entry.getKey().getTextRange(); boolean processed = false; diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java index 6d9f00051bcb..562c6499f820 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaDocumentationProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.jsonSchema.impl; import com.intellij.json.pointer.JsonPointerPosition; @@ -13,13 +13,13 @@ import com.intellij.psi.*; import com.intellij.psi.impl.FakePsiElement; import com.intellij.psi.impl.source.resolve.reference.impl.providers.PsiFileReference; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import com.jetbrains.jsonSchema.extension.JsonLikePsiWalker; import com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider; import com.jetbrains.jsonSchema.ide.JsonSchemaService; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -108,7 +108,7 @@ public class JsonSchemaDocumentationProvider implements DocumentationProvider { String htmlDescription = null; boolean deprecated = false; - List possibleTypes = ContainerUtil.newArrayList(); + List possibleTypes = new ArrayList<>(); for (JsonSchemaObject schema : schemas) { if (htmlDescription == null) { htmlDescription = getBestDocumentation(preferShort, schema); diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaObject.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaObject.java index dfb2e49db1b4..81181b19af6a 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaObject.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaObject.java @@ -140,7 +140,7 @@ public class JsonSchemaObject { public void completeInitialization(JsonValueAdapter jsonObject) { if (myIf != null) { - myIfThenElse = ContainerUtil.newArrayList(); + myIfThenElse = new ArrayList<>(); myIfThenElse.add(new IfThenElse(myIf, myThen, myElse)); } @@ -362,7 +362,7 @@ public class JsonSchemaObject { @Nullable private static List copyList(@Nullable List target, @Nullable List source) { if (source == null || source.isEmpty()) return target; - if (target == null) target = ContainerUtil.newArrayListWithCapacity(source.size()); + if (target == null) target = new ArrayList<>(source.size()); target.addAll(source); return target; } diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaReader.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaReader.java index 4b515d6b8c47..10424c793b6c 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaReader.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaReader.java @@ -256,7 +256,7 @@ public class JsonSchemaReader { return (element, object, queue, virtualFile) -> { if (element instanceof JsonArrayValueAdapter) { final List list = ((JsonArrayValueAdapter)element).getElements(); - final List members = ContainerUtil.newArrayListWithCapacity(list.size()); + final List members = new ArrayList<>(list.size()); for (int i = 0; i < list.size(); i++) { JsonValueAdapter value = list.get(i); if (!(value.isObject())) continue; diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java index d8159926d884..b4230facfc6b 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaServiceImpl.java @@ -176,7 +176,7 @@ public class JsonSchemaServiceImpl implements JsonSchemaService { } if (!single) { - List files = ContainerUtil.newArrayList(); + List files = new ArrayList<>(); for (JsonSchemaFileProvider provider : providers) { VirtualFile schemaFile = getSchemaForProvider(myProject, provider); if (schemaFile != null) { @@ -231,7 +231,7 @@ public class JsonSchemaServiceImpl implements JsonSchemaService { public List getAllUserVisibleSchemas() { List schemas = myCatalogManager.getAllCatalogEntries(); Collection providers = myState.getProviders(); - List results = ContainerUtil.newArrayListWithCapacity(schemas.size() + providers.size()); + List results = new ArrayList<>(schemas.size() + providers.size()); Map processedRemotes = new HashMap<>(); for (JsonSchemaFileProvider provider: providers) { if (provider.isUserVisible()) { diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaTreeNode.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaTreeNode.java index 8c443842667e..67125006d6fc 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaTreeNode.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaTreeNode.java @@ -1,22 +1,7 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.jsonSchema.impl; import com.intellij.json.pointer.JsonPointerPosition; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -83,7 +68,7 @@ public class JsonSchemaTreeNode { } private List convertToNodes(List children) { - List nodes = ContainerUtil.newArrayListWithCapacity(children.size()); + List nodes = new ArrayList<>(children.size()); for (JsonSchemaObject child: children) { nodes.add(new JsonSchemaTreeNode(this, child)); } diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaVariantsTreeBuilder.java b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaVariantsTreeBuilder.java index abe556a7f190..a74a1ed591be 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaVariantsTreeBuilder.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonSchemaVariantsTreeBuilder.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.jsonSchema.impl; import com.intellij.json.pointer.JsonPointerPosition; @@ -262,11 +248,9 @@ public class JsonSchemaVariantsTreeBuilder { final List mergedAny = andGroups(op.myAnyOfGroup, myAnyOfGroup); final List> mergedExclusive = - ContainerUtil.newArrayListWithCapacity( - op.myAnyOfGroup.size() * maxSize(myOneOfGroup) + - myAnyOfGroup.size() * maxSize(op.myOneOfGroup) + - maxSize(myOneOfGroup) * maxSize(op.myOneOfGroup) - ); + new ArrayList<>(op.myAnyOfGroup.size() * maxSize(myOneOfGroup) + + myAnyOfGroup.size() * maxSize(op.myOneOfGroup) + + maxSize(myOneOfGroup) * maxSize(op.myOneOfGroup)); for (List objects : myOneOfGroup) { mergedExclusive.add(andGroups(op.myAnyOfGroup, objects)); @@ -290,7 +274,7 @@ public class JsonSchemaVariantsTreeBuilder { private static List andGroups(@NotNull List g1, @NotNull List g2) { - List result = ContainerUtil.newArrayListWithCapacity(g1.size() * g2.size()); + List result = new ArrayList<>(g1.size() * g2.size()); for (JsonSchemaObject s: g1) { result.addAll(andGroup(s, g2)); } @@ -299,7 +283,7 @@ public class JsonSchemaVariantsTreeBuilder { // here is important, which pointer gets the result: lets make them all different, otherwise two schemas of branches of oneOf would be equal private static List andGroup(@NotNull JsonSchemaObject object, @NotNull List group) { - List list = ContainerUtil.newArrayListWithCapacity(group.size()); + List list = new ArrayList<>(group.size()); for (JsonSchemaObject s: group) { JsonSchemaObject schemaObject = JsonSchemaObject.merge(object, s, s); if (schemaObject.isValidByExclusion()) { diff --git a/json/src/com/jetbrains/jsonSchema/impl/JsonValidationError.java b/json/src/com/jetbrains/jsonSchema/impl/JsonValidationError.java index e35c67465a68..992eda571810 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/JsonValidationError.java +++ b/json/src/com/jetbrains/jsonSchema/impl/JsonValidationError.java @@ -1,8 +1,7 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.jsonSchema.impl; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.util.containers.ContainerUtil; import com.jetbrains.jsonSchema.extension.JsonLikeSyntaxAdapter; import com.jetbrains.jsonSchema.impl.fixes.AddMissingPropertyFix; import com.jetbrains.jsonSchema.impl.fixes.RemoveProhibitedPropertyFix; @@ -10,6 +9,7 @@ import com.jetbrains.jsonSchema.impl.fixes.SuggestEnumValuesFix; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.stream.Collectors; @@ -71,7 +71,7 @@ public class JsonValidationError { Collection namesToDisplay = myMissingPropertyIssues; boolean trimmed = false; if (trimIfNeeded && namesToDisplay.size() > 3) { - namesToDisplay = ContainerUtil.newArrayList(); + namesToDisplay = new ArrayList<>(); Iterator iterator = myMissingPropertyIssues.iterator(); for (int i = 0; i < 3; i++) { namesToDisplay.add(iterator.next()); diff --git a/json/src/com/jetbrains/jsonSchema/impl/MatchResult.java b/json/src/com/jetbrains/jsonSchema/impl/MatchResult.java index 910313e764b9..6bcca9dd3255 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/MatchResult.java +++ b/json/src/com/jetbrains/jsonSchema/impl/MatchResult.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.jsonSchema.impl; import com.intellij.util.Processor; @@ -50,7 +36,7 @@ public class MatchResult { }); List> result = oneOfGroups.isEmpty() ? ContainerUtil.emptyList() - : ContainerUtil.newArrayListWithCapacity(oneOfGroups.keySet().size()); + : new ArrayList<>(oneOfGroups.keySet().size()); for (Map.Entry> entry: oneOfGroups.entrySet()) { result.add(entry.getValue()); } diff --git a/json/src/com/jetbrains/jsonSchema/impl/fixes/AddMissingPropertyFix.java b/json/src/com/jetbrains/jsonSchema/impl/fixes/AddMissingPropertyFix.java index 6eaba37593f1..56585daf9187 100644 --- a/json/src/com/jetbrains/jsonSchema/impl/fixes/AddMissingPropertyFix.java +++ b/json/src/com/jetbrains/jsonSchema/impl/fixes/AddMissingPropertyFix.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.jsonSchema.impl.fixes; import com.intellij.codeInsight.template.Template; @@ -32,6 +32,7 @@ import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; public class AddMissingPropertyFix implements LocalQuickFix, BatchQuickFix { @@ -154,7 +155,7 @@ public class AddMissingPropertyFix implements LocalQuickFix, BatchQuickFix psiElementsToIgnore, @Nullable Runnable refreshViews) { - List> propFixes = ContainerUtil.newArrayList(); + List> propFixes = new ArrayList<>(); for (CommonProblemDescriptor descriptor: descriptors) { if (!(descriptor instanceof ProblemDescriptor)) continue; QuickFix[] fixes = descriptor.getFixes(); diff --git a/json/src/com/jetbrains/jsonSchema/widget/JsonSchemaStatusWidget.java b/json/src/com/jetbrains/jsonSchema/widget/JsonSchemaStatusWidget.java index b29310bb4c0b..f4dd1ad69c07 100644 --- a/json/src/com/jetbrains/jsonSchema/widget/JsonSchemaStatusWidget.java +++ b/json/src/com/jetbrains/jsonSchema/widget/JsonSchemaStatusWidget.java @@ -25,7 +25,6 @@ import com.intellij.openapi.vfs.impl.http.RemoteFileInfo; import com.intellij.openapi.wm.StatusBarWidget; import com.intellij.openapi.wm.impl.status.EditorBasedStatusBarPopup; import com.intellij.util.Alarm; -import com.intellij.util.containers.ContainerUtil; import com.jetbrains.jsonSchema.JsonSchemaCatalogProjectConfiguration; import com.jetbrains.jsonSchema.extension.*; import com.jetbrains.jsonSchema.ide.JsonSchemaService; @@ -35,6 +34,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; @@ -119,7 +119,7 @@ class JsonSchemaStatusWidget extends EditorBasedStatusBarPopup { } if (schemaFiles.size() != 1) { - final List userSchemas = ContainerUtil.newArrayList(); + final List userSchemas = new ArrayList<>(); if (hasConflicts(userSchemas, file)) { MyWidgetState state = new MyWidgetState(createMessage(schemaFiles, myService, "
", "There are several JSON Schemas mapped to this file:
", diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorUtil.java b/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorUtil.java index 38af9b3aa038..fd80e0b7394b 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorUtil.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInspection; import com.intellij.codeInsight.daemon.impl.HighlightInfo; @@ -179,7 +179,7 @@ public class ProblemDescriptorUtil { return ProblemDescriptor.EMPTY_ARRAY; } - List problems = ContainerUtil.newArrayListWithCapacity(annotations.size()); + List problems = new ArrayList<>(annotations.size()); IdentityHashMap quickFixMappingCache = ContainerUtil.newIdentityHashMap(); for (Annotation annotation : annotations) { if (annotation.getSeverity() == HighlightSeverity.INFORMATION || diff --git a/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java b/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java index a00d9ca7d93a..2bcca730c017 100644 --- a/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java +++ b/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.source.resolve.reference.impl.providers; @@ -235,7 +221,7 @@ public class FileReferenceSet { decoded = str; valueRange = TextRange.from(startInElement, decoded.length()); } - List referencesList = ContainerUtil.newArrayList(); + List referencesList = new ArrayList<>(); for (int i = wsHead; i < decoded.length() && Character.isWhitespace(decoded.charAt(i)); i++) { wsHead++; // skip head white spaces diff --git a/platform/core-api/src/com/intellij/lang/LanguageUtil.java b/platform/core-api/src/com/intellij/lang/LanguageUtil.java index 6f4a063009e2..ece7ad5c5f13 100644 --- a/platform/core-api/src/com/intellij/lang/LanguageUtil.java +++ b/platform/core-api/src/com/intellij/lang/LanguageUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.lang; @@ -115,7 +115,7 @@ public final class LanguageUtil { @NotNull public static List getFileLanguages() { LanguageParserDefinitions.INSTANCE.ensureValuesLoaded(); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (Language language : Language.getRegisteredLanguages()) { if (!isFileLanguage(language)) continue; result.add(language); diff --git a/platform/core-api/src/com/intellij/psi/LanguageSubstitutors.java b/platform/core-api/src/com/intellij/psi/LanguageSubstitutors.java index 7228cb6c6451..0f38cbad98fb 100644 --- a/platform/core-api/src/com/intellij/psi/LanguageSubstitutors.java +++ b/platform/core-api/src/com/intellij/psi/LanguageSubstitutors.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi; import com.intellij.injected.editor.VirtualFileWindow; @@ -29,6 +15,7 @@ import com.intellij.util.ObjectUtils; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentMap; @@ -110,7 +97,7 @@ public final class LanguageSubstitutors extends LanguageExtension { REQUESTS_DRAIN_NEEDED.set(true); List> set = ContainerUtil.newArrayList(ourReparsingRequests.entrySet()); - List files = ContainerUtil.newArrayListWithCapacity(set.size()); + List files = new ArrayList<>(set.size()); int id = 1; for (Map.Entry entry : set) { VirtualFile f = entry.getKey(); diff --git a/platform/core-api/src/com/intellij/psi/ReferenceProviderType.java b/platform/core-api/src/com/intellij/psi/ReferenceProviderType.java index f78a72f50d19..ac556214a6b5 100644 --- a/platform/core-api/src/com/intellij/psi/ReferenceProviderType.java +++ b/platform/core-api/src/com/intellij/psi/ReferenceProviderType.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi; import com.intellij.openapi.diagnostic.Logger; @@ -22,6 +8,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -66,7 +53,7 @@ public class ReferenceProviderType { @NotNull @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { - Collection result = ContainerUtil.newArrayList(); + Collection result = new ArrayList<>(); for (PsiReferenceProvider child : children) { ContainerUtil.addAllNotNull(result, child.getReferencesByElement(element, context)); } diff --git a/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java b/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java index 3bb61265e40e..b6ee71ec03f5 100644 --- a/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java +++ b/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java @@ -1193,7 +1193,7 @@ public class PsiTreeUtil { public static List getInjectedElements(@NotNull OuterLanguageElement outerLanguageElement) { PsiElement psi = outerLanguageElement.getContainingFile().getViewProvider().getPsi(outerLanguageElement.getLanguage()); TextRange injectionRange = outerLanguageElement.getTextRange(); - List res = ContainerUtil.newArrayList(); + List res = new ArrayList<>(); assert psi != null : outerLanguageElement; for (PsiElement element = psi.findElementAt(injectionRange.getStartOffset()); diff --git a/platform/core-impl/src/com/intellij/codeInsight/controlflow/ControlFlowBuilder.java b/platform/core-impl/src/com/intellij/codeInsight/controlflow/ControlFlowBuilder.java index 9580bc4a4069..58ad26279025 100644 --- a/platform/core-impl/src/com/intellij/codeInsight/controlflow/ControlFlowBuilder.java +++ b/platform/core-impl/src/com/intellij/codeInsight/controlflow/ControlFlowBuilder.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.controlflow; import com.intellij.codeInsight.controlflow.impl.ConditionalInstructionImpl; @@ -24,7 +10,6 @@ import com.intellij.openapi.util.Pair; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -53,8 +38,8 @@ public class ControlFlowBuilder { public int transparentInstructionCount; public ControlFlowBuilder() { - instructions = ContainerUtil.newArrayList(); - pending = ContainerUtil.newArrayList(); + instructions = new ArrayList<>(); + pending = new ArrayList<>(); instructionCount = 0; transparentInstructionCount = 0; } @@ -84,8 +69,8 @@ public class ControlFlowBuilder { @NotNull public final ControlFlow getCompleteControlFlow() { if (transparentInstructionCount == 0) return getControlFlow(); - - ArrayList result = ContainerUtil.newArrayListWithCapacity(instructionCount); + + ArrayList result = new ArrayList<>(instructionCount); int processedTransparentInstructions = 0; for (Instruction instruction : instructions) { if (instruction instanceof TransparentInstruction) { @@ -111,7 +96,7 @@ public class ControlFlowBuilder { LOG.error("Control flow graph is inconsistent. Instructions: (" + result.size() + ", " + instructionCount + ")\n" + "Transparent instructions: (" + processedTransparentInstructions + ", " + transparentInstructionCount + ")"); } - + if (!pending.isEmpty()) { LOG.error("Control flow is used incorrectly. All pending node must be connected to fake exit point. Pending: " + pending); } @@ -246,7 +231,7 @@ public class ControlFlowBuilder { /** * Creates transparent instruction for given element, and adds it to the instructions list - * Transparent instruction will be replaced in the result control flow by direct connection between predecessors and successors + * Transparent instruction will be replaced in the result control flow by direct connection between predecessors and successors * * @param element Element to create instruction for * @param markerName name for debug information diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java index 3989ca275882..541fa4552f34 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java +++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java @@ -1430,7 +1430,7 @@ public class PluginManagerCore { private static IdeaPluginDescriptorImpl[] initializePlugins(@Nullable StartupProgress progress) { configureExtensions(); - List errors = ContainerUtil.newArrayList(); + List errors = new ArrayList<>(); IdeaPluginDescriptorImpl[] pluginDescriptors = loadDescriptors(progress, errors); checkEssentialPluginsAreAvailable(pluginDescriptors); diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java index f3e5f5e8bfdd..15635766d075 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl; import com.google.common.annotations.VisibleForTesting; @@ -1058,7 +1058,7 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen private static class UncommittedInfo { private final FrozenDocument myFrozen; - private final List myEvents = ContainerUtil.newArrayList(); + private final List myEvents = new ArrayList<>(); private final ConcurrentMap myFrozenWindows = ContainerUtil.newConcurrentMap(); private UncommittedInfo(@NotNull DocumentImpl original) { diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerTracker.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerTracker.java index 6248d62de39d..7b40dd88fe5a 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerTracker.java +++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPointerTracker.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.smartPointers; import com.intellij.openapi.application.ApplicationManager; @@ -26,7 +12,6 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.util.CommonProcessors; import com.intellij.util.Processor; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; @@ -242,7 +227,7 @@ class SmartPointerTracker { synchronized List getSortedInfos() { ensureSorted(); - final List infos = ContainerUtil.newArrayListWithCapacity(size); + final List infos = new ArrayList<>(size); processAlivePointers(pointer -> { SelfElementInfo info = (SelfElementInfo)pointer.getElementInfo(); if (!info.hasRange()) return false; diff --git a/platform/core-impl/src/com/intellij/psi/stubs/StubTreeLoader.java b/platform/core-impl/src/com/intellij/psi/stubs/StubTreeLoader.java index baa588e5e29e..0efee98734d7 100644 --- a/platform/core-impl/src/com/intellij/psi/stubs/StubTreeLoader.java +++ b/platform/core-impl/src/com/intellij/psi/stubs/StubTreeLoader.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.stubs; import com.intellij.lang.Language; @@ -30,10 +16,10 @@ import com.intellij.psi.impl.DebugUtil; import com.intellij.psi.impl.source.PsiFileWithStubSupport; import com.intellij.psi.tree.IStubFileElementType; import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; /** @@ -157,7 +143,7 @@ public abstract class StubTreeLoader { @NotNull PsiFileWithStubSupport psiFile, VirtualFile file, @Nullable StubTree stubTreeFromIndex) { - List attachments = ContainerUtil.newArrayList(); + List attachments = new ArrayList<>(); attachments.add(new Attachment(file.getPath() + "_file.txt", psiFile instanceof PsiCompiledElement ? "compiled" : psiFile.getText())); if (stubTree != null) { attachments.add(new Attachment("stubTree.txt", ((PsiFileStubImpl)stubTree.getRoot()).printTree())); diff --git a/platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java b/platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java index 65503adafc36..a6a1bf0607f6 100644 --- a/platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java +++ b/platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java @@ -52,7 +52,7 @@ class Jsr223IdeScriptEngineManagerImpl extends IdeScriptEngineManager { @NotNull @Override public List getFileExtensions(@Nullable String language) { - List extensions = ContainerUtil.newArrayList(); + List extensions = new ArrayList<>(); List factories = getScriptEngineManager().getEngineFactories(); for (ScriptEngineFactory factory : factories) { if (language == null || factory.getLanguageName().equals(language)) { diff --git a/platform/diff-impl/src/com/intellij/diff/comparison/iterables/DiffIterableUtil.java b/platform/diff-impl/src/com/intellij/diff/comparison/iterables/DiffIterableUtil.java index f66f457db3a9..e53690a8b2d1 100644 --- a/platform/diff-impl/src/com/intellij/diff/comparison/iterables/DiffIterableUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/comparison/iterables/DiffIterableUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.comparison.iterables; import com.intellij.diff.comparison.DiffTooBigException; @@ -9,7 +9,6 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.registry.Registry; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.diff.Diff; import com.intellij.util.diff.FilesTooBigForDiffException; import org.jetbrains.annotations.NotNull; @@ -356,7 +355,7 @@ public class DiffIterableUtil { public static List extractDataRanges(@NotNull List objects1, @NotNull List objects2, @NotNull DiffIterable iterable) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (Pair pair : iterateAll(iterable)) { Range range = pair.first; diff --git a/platform/dvcs-api/src/com/intellij/dvcs/push/PushSettings.java b/platform/dvcs-api/src/com/intellij/dvcs/push/PushSettings.java index 6163780b3b99..6640f4842809 100644 --- a/platform/dvcs-api/src/com/intellij/dvcs/push/PushSettings.java +++ b/platform/dvcs-api/src/com/intellij/dvcs/push/PushSettings.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.dvcs.push; import com.intellij.openapi.components.PersistentStateComponent; @@ -12,6 +12,7 @@ import com.intellij.util.xmlb.annotations.XCollection; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; @State(name = "Push.Settings", storages = {@Storage(StoragePathMacros.WORKSPACE_FILE)}) @@ -21,7 +22,7 @@ public class PushSettings implements PersistentStateComponent FORCE_PUSH_TARGETS = ContainerUtil.newArrayList(); + public List FORCE_PUSH_TARGETS = new ArrayList<>(); } @Nullable diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java index 4186ea3dafac..275b74a19302 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java @@ -434,7 +434,7 @@ public class DvcsUtil { } List commitsInRoot = groupedCommits.get(repository); if (commitsInRoot == null) { - commitsInRoot = ContainerUtil.newArrayList(); + commitsInRoot = new ArrayList<>(); groupedCommits.put(repository, commitsInRoot); } commitsInRoot.add(commit); diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/cherrypick/VcsCherryPickAction.java b/platform/dvcs-impl/src/com/intellij/dvcs/cherrypick/VcsCherryPickAction.java index 58f769499e9b..f1c45f38ba90 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/cherrypick/VcsCherryPickAction.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/cherrypick/VcsCherryPickAction.java @@ -20,10 +20,7 @@ import icons.DvcsImplIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class VcsCherryPickAction extends DumbAwareAction { private static final String NAME = "Cherry-Pick"; @@ -88,7 +85,7 @@ public class VcsCherryPickAction extends DumbAwareAction { for (CommitId commit : details) { List hashes = result.get(commit.getRoot()); if (hashes == null) { - hashes = ContainerUtil.newArrayList(); + hashes = new ArrayList<>(); result.put(commit.getRoot(), hashes); } hashes.add(commit.getHash()); diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java index 97f57f71cfb9..e9c7364f40b7 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/PushController.java @@ -55,7 +55,7 @@ public class PushController implements Disposable { @NotNull private final PushLog myPushLog; @NotNull private final VcsPushDialog myDialog; @Nullable private final Repository myCurrentlyOpenedRepository; - private final List myHandlers = ContainerUtil.newArrayList(); + private final List myHandlers = new ArrayList<>(); private final boolean mySingleRepoProject; private static final int DEFAULT_CHILDREN_PRESENTATION_NUMBER = 20; private final ExecutorService myExecutorService = ConcurrencyUtil.newSingleThreadExecutor("DVCS Push"); @@ -499,7 +499,7 @@ public class PushController implements Disposable { @NotNull private List preparePushDetails() { - List allDetails = ContainerUtil.newArrayList(); + List allDetails = new ArrayList<>(); Collection> repoModels = getSelectedRepoNode(); for (MyRepoModel model : repoModels) { @@ -509,7 +509,7 @@ public class PushController implements Disposable { } PushSpec pushSpec = new PushSpec<>(model.getSource(), target); - List loadedCommits = ContainerUtil.newArrayList(); + List loadedCommits = new ArrayList<>(); loadedCommits.addAll(model.getLoadedCommits()); if (loadedCommits.isEmpty()) { //Note: loadCommits is cancellable - it tracks current thread's progress indicator under the hood! diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java index 5fef951bfe03..45c1eaa93bf1 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.dvcs.push.ui; import com.intellij.openapi.actionSystem.*; @@ -344,7 +344,7 @@ public class PushLog extends JPanel implements DataProvider { @NotNull private static List collectChanges(@NotNull List commitNodes) { - List changes = ContainerUtil.newArrayList(); + List changes = new ArrayList<>(); for (CommitNode node : commitNodes) { changes.addAll(node.getUserObject().getChanges()); } @@ -353,7 +353,7 @@ public class PushLog extends JPanel implements DataProvider { @NotNull private static List getChildNodesByType(@NotNull DefaultMutableTreeNode node, Class type, boolean reverseOrder) { - List nodes = ContainerUtil.newArrayList(); + List nodes = new ArrayList<>(); if (node.getChildCount() < 1) { return nodes; } @@ -376,7 +376,7 @@ public class PushLog extends JPanel implements DataProvider { @NotNull private static List getSortedRows(@NotNull int[] rows) { - List sorted = ContainerUtil.newArrayList(); + List sorted = new ArrayList<>(); for (int row : rows) { sorted.add(row); } @@ -431,7 +431,7 @@ public class PushLog extends JPanel implements DataProvider { @NotNull private List getNodesForRows(@NotNull List rows) { - List nodes = ContainerUtil.newArrayList(); + List nodes = new ArrayList<>(); for (Integer row : rows) { TreePath path = myTree.getPathForRow(row); Object pathComponent = path == null ? null : path.getLastPathComponent(); diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java index 2e57a59d26b0..804abfb598db 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.dvcs.ui; import com.intellij.icons.AllIcons; @@ -28,7 +28,6 @@ import com.intellij.ui.popup.WizardPopup; import com.intellij.ui.popup.list.ListPopupImpl; import com.intellij.ui.popup.list.ListPopupModel; import com.intellij.util.FontUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; @@ -39,6 +38,7 @@ import javax.swing.*; import javax.swing.plaf.basic.BasicButtonUI; import java.awt.*; import java.awt.event.*; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -65,7 +65,7 @@ public class BranchActionGroupPopup extends FlatSpeedSearchPopup { @Nullable private MyToolbarButton myRestoreSizeButton; @Nullable private MyToolbarButton mySettingsButton; - private final List mySettingsActions = ContainerUtil.newArrayList(); + private final List mySettingsActions = new ArrayList<>(); @Nullable private JPanel myTitleToolbarPanel; public BranchActionGroupPopup(@NotNull String title, @@ -184,7 +184,7 @@ public class BranchActionGroupPopup extends FlatSpeedSearchPopup { @NotNull private List getMoreActions() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); ListPopupModel model = getListModel(); for (int i = 0; i < model.getSize(); i++) { MoreAction moreAction = getSpecificAction(model.getElementAt(i), MoreAction.class); @@ -243,7 +243,7 @@ public class BranchActionGroupPopup extends FlatSpeedSearchPopup { if (parentActionGroup instanceof BranchActionGroup) return Collections.emptyList(); // add per repository branches into the model as Speed Search elements and show them only if regular items were not found by mask; - List speedSearchActions = ContainerUtil.newArrayList(); + List speedSearchActions = new ArrayList<>(); if (!isFirstLevel) speedSearchActions.add(new Separator(parentActionGroup.getTemplatePresentation().getText())); for (AnAction child : parentActionGroup.getChildren(null)) { if (child instanceof ActionGroup) { diff --git a/platform/extensions/testSrc/com/intellij/openapi/extensions/impl/ExtensionPointImplTest.java b/platform/extensions/testSrc/com/intellij/openapi/extensions/impl/ExtensionPointImplTest.java index b58bd03f217a..1ba690706cc6 100644 --- a/platform/extensions/testSrc/com/intellij/openapi/extensions/impl/ExtensionPointImplTest.java +++ b/platform/extensions/testSrc/com/intellij/openapi/extensions/impl/ExtensionPointImplTest.java @@ -5,7 +5,6 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.extensions.*; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.util.Disposer; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.After; @@ -13,6 +12,7 @@ import org.junit.Test; import org.picocontainer.PicoContainer; import org.picocontainer.defaults.DefaultPicoContainer; +import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; @@ -225,7 +225,7 @@ public class ExtensionPointImplTest { public void testListenerNotifications() { ExtensionPoint extensionPoint = buildExtensionPoint(String.class); - final List extensions = ContainerUtil.newArrayList(); + final List extensions = new ArrayList<>(); extensionPoint.addExtensionPointListener(new ExtensionPointListener() { @Override public void extensionAdded(@NotNull String extension, @Nullable PluginDescriptor pluginDescriptor) { diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalModuleBuildClasspathPojo.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalModuleBuildClasspathPojo.java index 16f30a63a86f..c20ee2f25117 100644 --- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalModuleBuildClasspathPojo.java +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalModuleBuildClasspathPojo.java @@ -1,23 +1,9 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.model.project; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; /** @@ -31,7 +17,7 @@ public class ExternalModuleBuildClasspathPojo { @SuppressWarnings("UnusedDeclaration") public ExternalModuleBuildClasspathPojo() { // Used by IJ serialization - this("___DUMMY___", ContainerUtil.newArrayList()); + this("___DUMMY___", new ArrayList<>()); } public ExternalModuleBuildClasspathPojo(@NotNull String path, @NotNull List entries) { diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalProjectBuildClasspathPojo.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalProjectBuildClasspathPojo.java index 7553e2fb12a0..192a2a4dbb8f 100644 --- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalProjectBuildClasspathPojo.java +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalProjectBuildClasspathPojo.java @@ -1,9 +1,9 @@ // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.model.project; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -23,7 +23,7 @@ public class ExternalProjectBuildClasspathPojo { @SuppressWarnings("UnusedDeclaration") public ExternalProjectBuildClasspathPojo() { // Used by IJ serialization - this("___DUMMY___", ContainerUtil.newArrayList(), new HashMap<>()); + this("___DUMMY___", new ArrayList<>(), new HashMap<>()); } public ExternalProjectBuildClasspathPojo(@NotNull String name, diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/action/RefreshAllExternalProjectsAction.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/action/RefreshAllExternalProjectsAction.java index 1d1487df92b2..bddf086630d1 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/action/RefreshAllExternalProjectsAction.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/action/RefreshAllExternalProjectsAction.java @@ -18,9 +18,9 @@ import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; /** @@ -86,7 +86,7 @@ public class RefreshAllExternalProjectsAction extends AnAction implements AnActi } private static List getSystemIds(@NotNull AnActionEvent e) { - final List systemIds = ContainerUtil.newArrayList(); + final List systemIds = new ArrayList<>(); final ProjectSystemId externalSystemId = e.getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID); if (externalSystemId != null) { diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/TaskCompletionProvider.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/TaskCompletionProvider.java index f82cd6c31a6c..f70b956f0bb2 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/TaskCompletionProvider.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/TaskCompletionProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.service.execution; import com.intellij.codeInsight.completion.CompletionResultSet; @@ -38,6 +24,7 @@ import icons.ExternalSystemIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -99,7 +86,7 @@ public class TaskCompletionProvider extends CommandLineCompletionProvider { } final Collection> tasks = ExternalSystemApiUtil.getChildren(moduleDataNode, ProjectKeys.TASK); - List elements = ContainerUtil.newArrayListWithCapacity(tasks.size()); + List elements = new ArrayList<>(tasks.size()); for (DataNode taskDataNode : tasks) { elements.add(LookupElementBuilder.create(taskDataNode.getData().getName()).withIcon(ExternalSystemIcons.Task)); } diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/ExternalSystemExecuteTaskTask.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/ExternalSystemExecuteTaskTask.java index 8c3006689fc9..eec3b5fcfac8 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/ExternalSystemExecuteTaskTask.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/internal/ExternalSystemExecuteTaskTask.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.service.internal; import com.intellij.openapi.components.ServiceManager; @@ -37,10 +23,7 @@ import com.intellij.util.keyFMap.KeyFMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author Denis Zhdanov @@ -181,6 +164,6 @@ public class ExternalSystemExecuteTaskTask extends AbstractExternalSystemTask { } private static List parseCmdParameters(@Nullable String cmdArgsLine) { - return cmdArgsLine != null ? ParametersListUtil.parse(cmdArgsLine, false, true) : ContainerUtil.newArrayList(); + return cmdArgsLine != null ? ParametersListUtil.parse(cmdArgsLine, false, true) : new ArrayList<>(); } } diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java index 5d3e2ae9f062..33df1da90487 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java @@ -98,7 +98,7 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific myRefreshRequestsQueue = new MergingUpdateQueue("ExternalSystemProjectsWatcher: Refresh requests queue", REFRESH_MERGING_TIME_SPAN, false, ANY_COMPONENT, myProject, null, false); - myImportAwareManagers = ContainerUtil.newArrayList(); + myImportAwareManagers = new ArrayList<>(); for (ExternalSystemManager manager : ExternalSystemApiUtil.getAllManagers()) { if (manager instanceof ExternalSystemAutoImportAware) { myImportAwareManagers.add((ExternalSystemAutoImportAware)manager); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java index 52227af64b6d..64a387814e68 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java @@ -287,7 +287,7 @@ public abstract class AbstractModuleDataService extends Ab project.putUserData(ORPHAN_MODULE_FILES, null); project.putUserData(ORPHAN_MODULE_HANDLERS_COUNTER, null); StringBuilder modulesToRestoreText = new StringBuilder(); - List> modulesToRestore = ContainerUtil.newArrayList(); + List> modulesToRestore = new ArrayList<>(); for (Path modulePath : orphanModules) { try { String path = FileUtil.loadFile(modulePath.resolveSibling(modulePath.getFileName() + ".path").toFile()); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ExternalSystemTaskActivator.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ExternalSystemTaskActivator.java index f84977eca45d..9a5aec7c14be 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ExternalSystemTaskActivator.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ExternalSystemTaskActivator.java @@ -102,7 +102,7 @@ public class ExternalSystemTaskActivator { () -> ContainerUtil.mapNotNull(context.getCompileScope().getAffectedModules(), module -> ExternalSystemApiUtil.getExternalProjectPath(module))); - final Collection phases = ContainerUtil.newArrayList(); + final Collection phases = new ArrayList<>(); if (myBefore) { if(context.isRebuild()) { phases.add(Phase.BEFORE_REBUILD); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ui/ConfigureTasksActivationDialog.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ui/ConfigureTasksActivationDialog.java index a19c2d60e89a..5b423654f0e3 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ui/ConfigureTasksActivationDialog.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ui/ConfigureTasksActivationDialog.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.service.task.ui; import com.intellij.ide.projectView.PresentationData; @@ -149,7 +135,7 @@ public class ConfigureTasksActivationDialog extends DialogWrapper { if (projectData == null || projectData.getExternalProjectStructure() == null) return; - final List popupItems = ContainerUtil.newArrayList(); + final List popupItems = new ArrayList<>(); for (DataNode moduleDataNode : ExternalSystemApiUtil .findAllRecursively(projectData.getExternalProjectStructure(), ProjectKeys.MODULE)) { if(moduleDataNode.isIgnored()) continue; @@ -269,7 +255,7 @@ public class ConfigureTasksActivationDialog extends DialogWrapper { } private List findSelectedProjects() { - List tasks = ContainerUtil.newArrayList(); + List tasks = new ArrayList<>(); for (DefaultMutableTreeNode node : myTree.getSelectedNodes(DefaultMutableTreeNode.class, null)) { if (node.getUserObject() instanceof ProjectNode) { final ProjectNode projectNode = (ProjectNode)node.getUserObject(); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalProjectsStructure.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalProjectsStructure.java index 8a9af9443aa3..4e32b544b590 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalProjectsStructure.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalProjectsStructure.java @@ -138,7 +138,7 @@ public class ExternalProjectsStructure extends SimpleTreeStructure implements Di final ExternalSystemNode[] cached = currentNode.getCached(); if (cached != null) { - final List duplicates = ContainerUtil.newArrayList(); + final List duplicates = new ArrayList<>(); final Map oldDataMap = new LinkedHashMap<>(); for (ExternalSystemNode node : cached) { Object key = node.getData() != null ? node.getData() : node.getName(); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalSystemNode.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalSystemNode.java index e0ded3b11152..a9bafeb3f859 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalSystemNode.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalSystemNode.java @@ -59,13 +59,13 @@ public abstract class ExternalSystemNode extends SimpleNode implements Compar protected static final ExternalSystemNode[] NO_CHILDREN = new ExternalSystemNode[0]; private final ExternalProjectsView myExternalProjectsView; - private final List> myChildrenList = ContainerUtil.newArrayList(); + private final List> myChildrenList = new ArrayList<>(); protected DataNode myDataNode; @Nullable private ExternalSystemNode myParent; private ExternalSystemNode[] myChildren; private ExternalProjectsStructure.ErrorLevel myErrorLevel = ExternalProjectsStructure.ErrorLevel.NONE; - private final List myErrors = ContainerUtil.newArrayList(); + private final List myErrors = new ArrayList<>(); private ExternalProjectsStructure.ErrorLevel myTotalErrorLevel = null; public ExternalSystemNode(@NotNull ExternalProjectsView externalProjectsView, diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalSystemViewDefaultContributor.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalSystemViewDefaultContributor.java index 9f9685fe7d4d..a620ddb9b5c7 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalSystemViewDefaultContributor.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ExternalSystemViewDefaultContributor.java @@ -145,7 +145,7 @@ public class ExternalSystemViewDefaultContributor extends ExternalSystemViewCont final Map groupToModule = new HashMap(moduleDataNodes.size()); - List moduleNodes = ContainerUtil.newArrayList(); + List moduleNodes = new ArrayList<>(); for (DataNode dataNode : moduleDataNodes) { final ModuleData data = (ModuleData)dataNode.getData(); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ModuleNode.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ModuleNode.java index 778627f68fd3..d45b143e7a77 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ModuleNode.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/ModuleNode.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.view; import com.intellij.ide.projectView.PresentationData; @@ -24,6 +10,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -70,7 +57,7 @@ public class ModuleNode extends ExternalSystemNode { @NotNull @Override protected List doBuildChildren() { - List> myChildNodes = ContainerUtil.newArrayList(); + List> myChildNodes = new ArrayList<>(); if (getExternalProjectsView().getGroupModules()) { List childModules = ContainerUtil.findAll( myAllModules, diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/RunConfigurationsNode.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/RunConfigurationsNode.java index dffd927dd6f4..655bc976d9fd 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/RunConfigurationsNode.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/RunConfigurationsNode.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.view; import com.intellij.execution.RunManager; @@ -24,11 +10,11 @@ import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunCo import com.intellij.openapi.externalSystem.util.ExternalSystemUtil; import com.intellij.openapi.externalSystem.util.Order; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; import icons.ExternalSystemIcons; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; @@ -65,7 +51,7 @@ public class RunConfigurationsNode extends ExternalSystemNode { @NotNull @Override protected List doBuildChildren() { - List runConfigurationNodes = ContainerUtil.newArrayList(); + List runConfigurationNodes = new ArrayList<>(); final AbstractExternalSystemTaskConfigurationType configurationType = ExternalSystemUtil.findConfigurationType(myModuleData.getOwner()); if (configurationType == null) return Collections.emptyList(); diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/TasksNode.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/TasksNode.java index fb2dc5979edc..9f508aea4f51 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/TasksNode.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/view/TasksNode.java @@ -1,32 +1,17 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.view; import com.intellij.ide.projectView.PresentationData; import com.intellij.openapi.externalSystem.model.DataNode; -import com.intellij.openapi.externalSystem.model.ProjectKeys; import com.intellij.openapi.externalSystem.model.task.TaskData; import com.intellij.openapi.externalSystem.util.Order; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import icons.ExternalSystemIcons; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -73,7 +58,7 @@ public class TasksNode extends ExternalSystemNode { @NotNull @Override protected List doBuildChildren() { - final List> result = ContainerUtil.newArrayList(); + final List> result = new ArrayList<>(); final boolean isGroup = getExternalProjectsView().getGroupTasks(); if (isGroup) { for (Map.Entry> collectionEntry : myTasksMap.entrySet()) { diff --git a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java index abc9aef055a4..7dff69299d73 100644 --- a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java +++ b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java @@ -372,7 +372,7 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest @NotNull private List getModuleDep(@NotNull String moduleName, @NotNull String depName, @NotNull Class clazz) { - List deps = ContainerUtil.newArrayList(); + List deps = new ArrayList<>(); for (OrderEntry e : getRootManager(moduleName).getOrderEntries()) { if (clazz.isInstance(e) && e.getPresentableName().equals(depName)) { diff --git a/platform/indexing-impl/src/com/intellij/openapi/roots/impl/LibraryScopeCache.java b/platform/indexing-impl/src/com/intellij/openapi/roots/impl/LibraryScopeCache.java index a0c4def4076d..047b968bb553 100644 --- a/platform/indexing-impl/src/com/intellij/openapi/roots/impl/LibraryScopeCache.java +++ b/platform/indexing-impl/src/com/intellij/openapi/roots/impl/LibraryScopeCache.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.roots.impl; import com.intellij.concurrency.ConcurrentCollectionFactory; @@ -101,7 +87,7 @@ public class LibraryScopeCache { return myLibraryResolveScopeCache.get(orderEntries); } - /** + /** * Returns a scope containing all modules depending on the library transitively plus all the project's libraries * @param orderEntries the order entries that reference a particular SDK/library * @return a cached use scope @@ -180,7 +166,7 @@ public class LibraryScopeCache { return GlobalSearchScope.allScope(myProject); } - List united = ContainerUtil.newArrayList(); + List united = new ArrayList<>(); if (!modulesWithSdk.isEmpty()) { united.add(new ModulesScope(modulesWithSdk, myProject)); united.add(myLibrariesOnlyScope.intersectWith(new LibraryRuntimeClasspathScope(myProject, modulesWithSdk))); diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java b/platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java index dacaa0fd0b60..da40412555fb 100644 --- a/platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java +++ b/platform/indexing-impl/src/com/intellij/psi/impl/search/PsiSearchHelperImpl.java @@ -592,7 +592,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper { } do { final Map, Collection> globals = new HashMap<>(); - final List> customs = ContainerUtil.newArrayList(); + final List> customs = new ArrayList<>(); final Set locals = new LinkedHashSet<>(); Map> localProcessors = new THashMap<>(); distributePrimitives(collectors, locals, globals, customs, localProcessors, progress); diff --git a/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/LanguageCodeStylePropertyMapper.java b/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/LanguageCodeStylePropertyMapper.java index 9fe6fe6ad9cb..bbc2216e0daa 100644 --- a/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/LanguageCodeStylePropertyMapper.java +++ b/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/LanguageCodeStylePropertyMapper.java @@ -11,7 +11,6 @@ import com.intellij.psi.codeStyle.CodeStyleSettingsProvider; import com.intellij.psi.codeStyle.CommonCodeStyleSettings.IndentOptions; import com.intellij.psi.codeStyle.CustomCodeStyleSettings; import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -61,7 +60,7 @@ public final class LanguageCodeStylePropertyMapper extends AbstractCodeStyleProp @NotNull @Override protected List getSupportedFields() { - List fieldsDescriptors = ContainerUtil.newArrayList(); + List fieldsDescriptors = new ArrayList<>(); IndentOptions indentOptions = getRootSettings().getCommonSettings(myLanguage).getIndentOptions(); if (indentOptions != null) { fieldsDescriptors.add(new CodeStyleObjectDescriptor(indentOptions, getSupportedIndentOptions())); diff --git a/platform/lang-api/src/com/intellij/execution/util/ListTableWithButtons.java b/platform/lang-api/src/com/intellij/execution/util/ListTableWithButtons.java index b327cb8ad226..146da59d1f80 100644 --- a/platform/lang-api/src/com/intellij/execution/util/ListTableWithButtons.java +++ b/platform/lang-api/src/com/intellij/execution/util/ListTableWithButtons.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.util; import com.intellij.openapi.actionSystem.ex.ActionUtil; @@ -39,7 +25,7 @@ import java.util.Observable; * @author traff */ public abstract class ListTableWithButtons extends Observable { - private final List myElements = ContainerUtil.newArrayList(); + private final List myElements = new ArrayList<>(); private JPanel myPanel; private final TableView myTableView; private final CommonActionsPanel myActionsPanel; diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/ExcludedFiles.java b/platform/lang-api/src/com/intellij/psi/codeStyle/ExcludedFiles.java index daa44506b7cc..90246e79c394 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/ExcludedFiles.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/ExcludedFiles.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle; import com.intellij.formatting.fileSet.FileSetDescriptor; @@ -10,11 +10,11 @@ import com.intellij.util.xmlb.annotations.OptionTag; import org.jdom.Element; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; public class ExcludedFiles { - private final List myDescriptors = ContainerUtil.newArrayList(); + private final List myDescriptors = new ArrayList<>(); private final State myState = new State(); public void serializeInto(@NotNull Element element) { diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/LanguageCodeStyleSettingsProvider.java b/platform/lang-api/src/com/intellij/psi/codeStyle/LanguageCodeStyleSettingsProvider.java index 1cf205b00180..d6852e9344dc 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/LanguageCodeStyleSettingsProvider.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/LanguageCodeStyleSettingsProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle; import com.intellij.application.options.IndentOptionsEditor; @@ -370,7 +370,7 @@ public abstract class LanguageCodeStyleSettingsProvider extends CodeStyleSetting @NotNull protected static List calcSettingPagesProviders() { - List settingsPagesProviders = ContainerUtil.newArrayList(); + List settingsPagesProviders = new ArrayList<>(); for (LanguageCodeStyleSettingsProvider provider : EP_NAME.getExtensionList()) { try { Method configMethod = provider.getClass().getMethod("createConfigurable", CodeStyleSettings.class, CodeStyleSettings.class); diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/ArrangementUtil.java b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/ArrangementUtil.java index 463793f0fa84..d048494d4d42 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/ArrangementUtil.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/ArrangementUtil.java @@ -13,7 +13,6 @@ import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCon import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition; import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchConditionVisitor; import com.intellij.psi.codeStyle.arrangement.std.*; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtilRt; import com.intellij.util.text.CharArrayUtil; import org.jdom.Element; @@ -301,7 +300,7 @@ public class ArrangementUtil { //region Arrangement Sections @NotNull public static List collectMatchRules(@NotNull List sections) { - final List matchRules = ContainerUtil.newArrayList(); + final List matchRules = new ArrayList<>(); for (ArrangementSectionRule section : sections) { matchRules.addAll(section.getMatchRules()); } diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/DefaultArrangementSettingsSerializer.java b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/DefaultArrangementSettingsSerializer.java index b77eec024044..8d5db872b767 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/DefaultArrangementSettingsSerializer.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/DefaultArrangementSettingsSerializer.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle.arrangement; import com.intellij.openapi.diagnostic.Logger; @@ -35,7 +21,7 @@ import java.util.Set; /** * {@link ArrangementSettingsSerializer} which knows how to handle {@link StdArrangementSettings built-in arrangement tokens} * and {@link Mixin can be used as a base for custom serializer implementation}. - * + * * @author Denis Zhdanov */ public class DefaultArrangementSettingsSerializer implements ArrangementSettingsSerializer { @@ -128,7 +114,7 @@ public class DefaultArrangementSettingsSerializer implements ArrangementSettings final Set tokensDefinition = deserializeTokensDefinition(element, myDefaultSettings); final List groupingRules = deserializeGropings(element, myDefaultSettings); final Element rulesElement = element.getChild(RULES_ELEMENT_NAME); - final List sectionRules = ContainerUtil.newArrayList(); + final List sectionRules = new ArrayList<>(); if(rulesElement == null) { sectionRules.addAll(myDefaultSettings.getSections()); } @@ -277,7 +263,7 @@ public class DefaultArrangementSettingsSerializer implements ArrangementSettings if (matcherElement == null) { return null; } - + Element result = new Element(RULE_ELEMENT_NAME); result.addContent(new Element(MATCHER_ELEMENT_NAME).addContent(matcherElement)); if (rule.getOrderType() != ArrangementMatchRule.DEFAULT_ORDER_TYPE) { @@ -337,7 +323,7 @@ public class DefaultArrangementSettingsSerializer implements ArrangementSettings return null; } } - + public interface Mixin { Mixin NULL = new Mixin() { diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/match/ArrangementSectionRule.java b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/match/ArrangementSectionRule.java index 89f1e332d53f..a4a29a5518f6 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/match/ArrangementSectionRule.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/match/ArrangementSectionRule.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle.arrangement.match; import com.intellij.openapi.util.text.StringUtil; @@ -25,6 +11,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import static com.intellij.psi.codeStyle.arrangement.std.StdArrangementTokens.Section.END_SECTION; @@ -57,7 +44,7 @@ public class ArrangementSectionRule implements Cloneable { } public static ArrangementSectionRule create(@Nullable String start, @Nullable String end, @NotNull List rules) { - final List matchRules = ContainerUtil.newArrayList(); + final List matchRules = new ArrayList<>(); if (StringUtil.isNotEmpty(start)) { matchRules.add(createSectionRule(start, START_SECTION)); } @@ -134,7 +121,7 @@ public class ArrangementSectionRule implements Cloneable { @Override public ArrangementSectionRule clone() { - final List rules = ContainerUtil.newArrayList(); + final List rules = new ArrayList<>(); for (StdArrangementMatchRule myMatchRule : myMatchRules) { rules.add(myMatchRule.clone()); } diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/modifier/TransientCodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/modifier/TransientCodeStyleSettings.java index 7b3600d42fc5..b4a3f6395d81 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/modifier/TransientCodeStyleSettings.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/modifier/TransientCodeStyleSettings.java @@ -1,18 +1,18 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle.modifier; import com.intellij.application.options.CodeStyle; -import com.intellij.psi.codeStyle.CodeStyleSettings; -import com.intellij.psi.codeStyle.FileIndentOptionsProvider; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.util.ModificationTracker; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiFile; +import com.intellij.psi.codeStyle.CodeStyleSettings; +import com.intellij.psi.codeStyle.FileIndentOptionsProvider; import com.intellij.util.Processor; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; /** @@ -24,7 +24,7 @@ import java.util.List; public final class TransientCodeStyleSettings extends CodeStyleSettings { private final PsiFile myPsiFile; private CodeStyleSettingsModifier myModifier; - private final List myDependencies = ContainerUtil.newArrayList(); + private final List myDependencies = new ArrayList<>(); public TransientCodeStyleSettings(@NotNull PsiFile psiFile, @NotNull CodeStyleSettings settings) { myPsiFile = psiFile; diff --git a/platform/lang-impl/src/com/intellij/application/options/CodeCompletionOptions.java b/platform/lang-impl/src/com/intellij/application/options/CodeCompletionOptions.java index 9dab381da08a..2e0be6a0fd02 100644 --- a/platform/lang-impl/src/com/intellij/application/options/CodeCompletionOptions.java +++ b/platform/lang-impl/src/com/intellij/application/options/CodeCompletionOptions.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.application.options; import com.intellij.application.options.editor.EditorOptionsProvider; @@ -8,10 +8,10 @@ import com.intellij.openapi.options.CompositeConfigurable; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.options.UnnamedConfigurable; import com.intellij.openapi.options.ex.ConfigurableWrapper; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import javax.swing.*; +import java.util.ArrayList; import java.util.List; public class CodeCompletionOptions extends CompositeConfigurable implements EditorOptionsProvider { @@ -27,8 +27,8 @@ public class CodeCompletionOptions extends CompositeConfigurable configurables = getConfigurables(); - List addonComponents = ContainerUtil.newArrayListWithCapacity(configurables.size()); - List sectionComponents = ContainerUtil.newArrayListWithCapacity(configurables.size()); + List addonComponents = new ArrayList<>(configurables.size()); + List sectionComponents = new ArrayList<>(configurables.size()); for (UnnamedConfigurable configurable : configurables) { if (configurable instanceof CodeCompletionOptionsCustomSection) sectionComponents.add(configurable.createComponent()); else addonComponents.add(configurable.createComponent()); diff --git a/platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java b/platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java index 1f349c89a4b9..4db964315807 100644 --- a/platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java +++ b/platform/lang-impl/src/com/intellij/application/options/CodeStyleSchemesConfigurable.java @@ -16,7 +16,6 @@ import com.intellij.psi.codeStyle.CodeStyleScheme; import com.intellij.psi.codeStyle.CodeStyleSettingsManager; import com.intellij.psi.codeStyle.CodeStyleSettingsProvider; import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -193,7 +192,7 @@ public class CodeStyleSchemesConfigurable extends SearchableConfigurable.Parent. myPanels = new ArrayList<>(); Set addedGroupProviders = new HashSet<>(); - final List providers = ContainerUtil.newArrayList(); + final List providers = new ArrayList<>(); providers.addAll(CodeStyleSettingsProvider.EXTENSION_POINT_NAME.getExtensionList()); providers.addAll(LanguageCodeStyleSettingsProvider.getSettingsPagesProviders()); diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRuleManager.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRuleManager.java index 5f56ef940aa8..4b2dd5f0e32c 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRuleManager.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRuleManager.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.application.options.codeStyle.arrangement.match; import com.intellij.application.options.codeStyle.arrangement.color.ArrangementColorsProvider; @@ -36,6 +22,7 @@ import com.intellij.util.containers.ContainerUtilRt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -73,7 +60,7 @@ public class ArrangementSectionRuleManager { @NotNull ArrangementSectionRulesControl control) { myCommenter = LanguageCommenters.INSTANCE.forLanguage(language); myControl = control; - final List tokens = ContainerUtil.newArrayList(); + final List tokens = new ArrayList<>(); tokens.add(new CompositeArrangementSettingsToken(TYPE, ContainerUtil.newArrayList(START_SECTION, END_SECTION))); tokens.add(new CompositeArrangementSettingsToken(TEXT)); myEditor = new ArrangementMatchingRuleEditor(settingsManager, tokens, colorsProvider, control); diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesControl.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesControl.java index 6a4368aec662..330511fbde56 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesControl.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementSectionRulesControl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.application.options.codeStyle.arrangement.match; import com.intellij.application.options.codeStyle.arrangement.ArrangementConstants; @@ -17,15 +17,11 @@ import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition; import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchConditionVisitor; import com.intellij.psi.codeStyle.arrangement.std.ArrangementStandardSettingsManager; import com.intellij.psi.codeStyle.arrangement.std.StdArrangementRuleAliasToken; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; +import java.util.*; import static com.intellij.application.options.codeStyle.arrangement.match.ArrangementSectionRuleManager.ArrangementSectionRuleData; @@ -91,8 +87,8 @@ public class ArrangementSectionRulesControl extends ArrangementMatchingRulesCont return Collections.emptyList(); } - final List result = ContainerUtil.newArrayList(); - final List buffer = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); + final List buffer = new ArrayList<>(); String currentSectionStart = null; for (int i = 0; i < getModel().getSize(); i++) { final Object element = getModel().getElementAt(i); diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/excludedFiles/ExcludedFilesList.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/excludedFiles/ExcludedFilesList.java index a408b7e5bf9a..5c8859eea537 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/excludedFiles/ExcludedFilesList.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/excludedFiles/ExcludedFilesList.java @@ -18,13 +18,13 @@ import com.intellij.ui.AnActionButton; import com.intellij.ui.AnActionButtonRunnable; import com.intellij.ui.ToolbarDecorator; import com.intellij.ui.components.JBList; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -139,7 +139,7 @@ public class ExcludedFilesList extends JBList { private List getAvailableScopes() { Set usedNames = getUsedScopeNames(); - List namedScopes = ContainerUtil.newArrayList(); + List namedScopes = new ArrayList<>(); for (NamedScopesHolder holder : getScopeHolders()) { for (NamedScope scope : holder.getEditableScopes()) { if (!usedNames.contains(scope.getName())) { @@ -248,7 +248,7 @@ public class ExcludedFilesList extends JBList { } private List getScopeHolders() { - List holders = ContainerUtil.newArrayList(); + List holders = new ArrayList<>(); Project project = getScopeHolderProject(); holders.add(DependencyValidationManager.getInstance(project)); holders.add(NamedScopeManager.getInstance(project)); diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/group/CodeStyleGroupProvider.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/group/CodeStyleGroupProvider.java index 88333e4bf0f6..18c157b75ce7 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/group/CodeStyleGroupProvider.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/group/CodeStyleGroupProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.application.options.codeStyle.group; import com.intellij.ConfigurableFactory; @@ -11,17 +11,17 @@ import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.psi.codeStyle.CodeStyleGroup; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CodeStyleSettingsProvider; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; public class CodeStyleGroupProvider extends CodeStyleSettingsProvider { private final CodeStyleGroup myGroup; private final CodeStyleSchemesModel myModel; private final CodeStyleSchemesConfigurable mySchemesConfigurable; - private final List myChildProviders = ContainerUtil.newArrayList(); + private final List myChildProviders = new ArrayList<>(); public CodeStyleGroupProvider(@NotNull CodeStyleGroup group, CodeStyleSchemesModel model, @@ -76,7 +76,7 @@ public class CodeStyleGroupProvider extends CodeStyleSettingsProvider { @NotNull @Override public Configurable[] buildConfigurables() { - List childConfigurables = ContainerUtil.newArrayList(); + List childConfigurables = new ArrayList<>(); for (CodeStyleSettingsProvider childProvider : myChildProviders) { CodeStyleConfigurableWrapper wrapper = ConfigurableFactory.Companion.getInstance().createCodeStyleConfigurable(childProvider, myModel, mySchemesConfigurable); diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/ColorOptionsTree.java b/platform/lang-impl/src/com/intellij/application/options/colors/ColorOptionsTree.java index b6e126de4d4f..aa63f802d1f3 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/ColorOptionsTree.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/ColorOptionsTree.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.application.options.colors; import com.intellij.openapi.editor.colors.EditorSchemeAttributeDescriptor; @@ -22,7 +8,6 @@ import com.intellij.ui.SimpleTextAttributes; import com.intellij.ui.TreeSpeedSearch; import com.intellij.ui.treeStructure.Tree; import com.intellij.util.FontUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.StatusText; import com.intellij.util.ui.UIUtil; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; @@ -87,7 +72,7 @@ public class ColorOptionsTree extends Tree { } private Collection getOrderedDescriptors(@NotNull ColorAndFontOptions options) { - ArrayList list = ContainerUtil.newArrayList(); + ArrayList list = new ArrayList<>(); for (EditorSchemeAttributeDescriptor description : options.getCurrentDescriptions()) { if (!description.getGroup().equals(myCategoryName)) continue; list.add(description); diff --git a/platform/lang-impl/src/com/intellij/build/output/JavacOutputParser.java b/platform/lang-impl/src/com/intellij/build/output/JavacOutputParser.java index 26294f2a9495..0553b25778d8 100644 --- a/platform/lang-impl/src/com/intellij/build/output/JavacOutputParser.java +++ b/platform/lang-impl/src/com/intellij/build/output/JavacOutputParser.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.build.output; import com.intellij.build.FilePosition; @@ -7,13 +7,13 @@ import com.intellij.build.events.MessageEvent; import com.intellij.build.events.impl.FileMessageEventImpl; import com.intellij.build.events.impl.MessageEventImpl; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; +import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; @@ -95,7 +95,7 @@ public class JavacOutputParser implements BuildOutputParser { } BuildOutputCollector outputCollector = new BuildOutputCollector(reader); - List messageList = ContainerUtil.newArrayList(); + List messageList = new ArrayList<>(); messageList.add(text); int column; // 0-based. String prevLine = null; diff --git a/platform/lang-impl/src/com/intellij/codeEditor/printing/TextPrintHandler.java b/platform/lang-impl/src/com/intellij/codeEditor/printing/TextPrintHandler.java index 3c4e4655900b..83cb9fad78cf 100644 --- a/platform/lang-impl/src/com/intellij/codeEditor/printing/TextPrintHandler.java +++ b/platform/lang-impl/src/com/intellij/codeEditor/printing/TextPrintHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeEditor.printing; import com.intellij.CommonBundle; @@ -25,7 +25,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.awt.print.PageFormat; @@ -107,7 +106,7 @@ public class TextPrintHandler extends PrintActionHandler { painter = new MultiFilePainter(psiFiles, printSettings.EVEN_NUMBER_OF_PAGES); } else if (printSettings.getPrintScope() == PrintSettings.PRINT_DIRECTORY) { - List filesList = ContainerUtil.newArrayList(); + List filesList = new ArrayList<>(); boolean isRecursive = printSettings.isIncludeSubdirectories(); addToPsiFileList(psiDirectory, filesList, isRecursive); painter = new MultiFilePainter(filesList, printSettings.EVEN_NUMBER_OF_PAGES); @@ -251,7 +250,7 @@ public class TextPrintHandler extends PrintActionHandler { if (doc == null) return null; EditorHighlighter highlighter = HighlighterFactory.createHighlighter(virtualFile, EditorColorsUtil.getColorSchemeForPrinting(), psiFile.getProject()); highlighter.setText(doc.getCharsSequence()); - return new TextPainter(doc, highlighter, virtualFile.getPresentableUrl(), virtualFile.getPresentableName(), + return new TextPainter(doc, highlighter, virtualFile.getPresentableUrl(), virtualFile.getPresentableName(), psiFile, psiFile.getFileType()); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/TargetElementUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/TargetElementUtil.java index 9798cd64390f..7b7d885ec9b0 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/TargetElementUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/TargetElementUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight; @@ -30,7 +30,6 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.BitUtil; import com.intellij.util.Consumer; import com.intellij.util.ThreeState; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -300,7 +299,7 @@ public class TargetElementUtil extends TargetElementUtilBase { public PsiElement getNamedElement(@Nullable final PsiElement element, final int offsetInElement) { if (element == null) return null; - final List targets = ContainerUtil.newArrayList(); + final List targets = new ArrayList<>(); final Consumer consumer = target -> { if (target instanceof PsiDeclaredTarget) { final PsiDeclaredTarget declaredTarget = (PsiDeclaredTarget)target; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java index a95707f435b2..1e5cd637093b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.actions; @@ -60,6 +46,7 @@ import com.intellij.util.diff.FilesTooBigForDiffException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.CancellationException; @@ -84,7 +71,7 @@ public abstract class AbstractLayoutCodeProcessor { private boolean myProcessChangedTextOnly; protected AbstractLayoutCodeProcessor myPreviousCodeProcessor; - private List myFilters = ContainerUtil.newArrayList(); + private List myFilters = new ArrayList<>(); private LayoutCodeInfoCollector myInfoCollector; @@ -272,7 +259,7 @@ public abstract class AbstractLayoutCodeProcessor { } private List getAllSearchableDirsFromContext() { - List dirs = ContainerUtil.newArrayList(); + List dirs = new ArrayList<>(); if (myDirectory != null) { dirs.add(myDirectory); } @@ -436,7 +423,7 @@ public abstract class AbstractLayoutCodeProcessor { private List getAllProcessors() { AbstractLayoutCodeProcessor current = this; - List all = ContainerUtil.newArrayList(); + List all = new ArrayList<>(); while (current != null) { all.add(current); current = current.myPreviousCodeProcessor; @@ -447,10 +434,10 @@ public abstract class AbstractLayoutCodeProcessor { private class ReformatFilesTask implements SequentialTask { private final List myProcessors; - + private final FileRecursiveIterator myFileTreeIterator; private final FileRecursiveIterator myCountingIterator; - + private final ProgressIndicator myProgressIndicator; private int myTotalFiles; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/FileTreeIterator.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/FileTreeIterator.java index 0aea8f48c322..89a1405f38e3 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/FileTreeIterator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/FileTreeIterator.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.actions; import com.intellij.openapi.module.Module; @@ -23,7 +9,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -48,7 +33,7 @@ public class FileTreeIterator { @NotNull public static List collectProjectDirectories(@NotNull Project project) { - List directories = ContainerUtil.newArrayList(); + List directories = new ArrayList<>(); Module[] modules = ModuleManager.getInstance(project).getModules(); for (Module module : modules) { @@ -96,7 +81,7 @@ public class FileTreeIterator { @NotNull public static List collectModuleDirectories(Module module) { - List dirs = ContainerUtil.newArrayList(); + List dirs = new ArrayList<>(); VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots(); for (VirtualFile root : contentRoots) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java index fdb28c5b3dcb..3371277c8b6f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/FormatChangedTextUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.actions; import com.intellij.openapi.application.ReadAction; @@ -25,10 +25,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; public class FormatChangedTextUtil { @@ -103,7 +100,7 @@ public class FormatChangedTextUtil { @NotNull public static List getChangedFilesFromDirs(@NotNull Project project, @NotNull List dirs) { ChangeListManager changeListManager = ChangeListManager.getInstance(project); - Collection changes = ContainerUtil.newArrayList(); + Collection changes = new ArrayList<>(); for (PsiDirectory dir : dirs) { changes.addAll(changeListManager.getChangesIn(dir.getVirtualFile())); @@ -139,8 +136,8 @@ public class FormatChangedTextUtil { public boolean isChangeNotTrackedForFile(@NotNull Project project, @NotNull PsiFile file) { return false; } - - + + @Nullable public ChangedRangesInfo getChangedRangesInfo(@NotNull PsiFile file) { return null; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArrangerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArrangerImpl.java index 25249fb499c7..93703d278cb1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArrangerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArrangerImpl.java @@ -240,8 +240,8 @@ public class CompletionLookupArrangerImpl extends LookupArranger implements Comp } private List sortByPresentation(Iterable source) { - ArrayList startMatches = ContainerUtil.newArrayList(); - ArrayList middleMatches = ContainerUtil.newArrayList(); + ArrayList startMatches = new ArrayList<>(); + ArrayList middleMatches = new ArrayList<>(); for (LookupElement element : source) { (itemMatcher(element).isStartMatch(element) ? startMatches : middleMatches).add(element); } @@ -411,8 +411,8 @@ public class CompletionLookupArrangerImpl extends LookupArranger implements Comp private Iterable sortByRelevance(MultiMap inputBySorter) { if (inputBySorter.isEmpty()) return Collections.emptyList(); - - final List> byClassifier = ContainerUtil.newArrayList(); + + final List> byClassifier = new ArrayList<>(); for (CompletionSorterImpl sorter : myClassifiers.keySet()) { ProcessingContext context = createContext(); byClassifier.add(myClassifiers.get(sorter).classify(inputBySorter.get(sorter), context)); @@ -421,7 +421,7 @@ public class CompletionLookupArrangerImpl extends LookupArranger implements Comp Iterable result = ContainerUtil.concat(byClassifier.toArray(new Iterable[0])); return myFinalSorter.sort(result, Objects.requireNonNull(myProcess.getParameters())); } - + private ProcessingContext createContext() { ProcessingContext context = new ProcessingContext(); context.put(PREFIX_CHANGES, myPrefixChanges); @@ -508,13 +508,13 @@ public class CompletionLookupArrangerImpl extends LookupArranger implements Comp @Nullable private LookupElement findMostRelevantItem(Iterable sorted) { final CompletionPreselectSkipper[] skippers = CompletionPreselectSkipper.EP_NAME.getExtensions(); - + for (LookupElement element : sorted) { if (!shouldSkip(skippers, element)) { return element; } } - + return null; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java index ff12f2978462..12bc1082688d 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java @@ -118,7 +118,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement private boolean myLookupUpdated; private final PropertyChangeListener myLookupManagerListener; private final Queue myAdvertiserChanges = new ConcurrentLinkedQueue<>(); - private final List myDelayedMiddleMatches = ContainerUtil.newArrayList(); + private final List myDelayedMiddleMatches = new ArrayList<>(); private final int myStartCaret; private final CompletionThreadingBase myThreading; private final Object myLock = ObjectUtils.sentinel("CompletionProgressIndicator"); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ChameleonSyntaxHighlightingPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ChameleonSyntaxHighlightingPass.java index b1978ffb3962..4febb06d6b49 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ChameleonSyntaxHighlightingPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ChameleonSyntaxHighlightingPass.java @@ -25,11 +25,11 @@ import com.intellij.psi.tree.IFileElementType; import com.intellij.psi.tree.ILazyParseableElementType; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.TreeTraversal; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; class ChameleonSyntaxHighlightingPass extends GeneralHighlightingPass { @@ -79,10 +79,10 @@ class ChameleonSyntaxHighlightingPass extends GeneralHighlightingPass { return type instanceof ILazyParseableElementType && !(type instanceof IFileElementType); }); - List lazyOutside = ContainerUtil.newArrayListWithCapacity(100); - List lazyInside = ContainerUtil.newArrayListWithCapacity(100); - List outside = ContainerUtil.newArrayListWithCapacity(100); - List inside = ContainerUtil.newArrayListWithCapacity(100); + List lazyOutside = new ArrayList<>(100); + List lazyInside = new ArrayList<>(100); + List outside = new ArrayList<>(100); + List inside = new ArrayList<>(100); for (PsiElement e : s) { (e.getTextRange().intersects(myPriorityRange) ? lazyInside : lazyOutside).add(e); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java index 05f1bf395731..773a86b9cc7a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/ExtendWordSelectionHandlerBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.editorActions; @@ -10,7 +10,6 @@ import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.text.CharArrayUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,14 +48,14 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect /** * Returns minimal selection length for given element. - * - * Sometimes the length of word selection should be bounded below. + * + * Sometimes the length of word selection should be bounded below. * E.g. it is useful in languages that requires prefixes for variable (php, less, etc.). * By default this kind of variables will be selected without prefix: @variable, - * but it make sense to exclude this range from selection list. + * but it make sense to exclude this range from selection list. * So if this method returns 9 as a minimal length of selection * then first selection range for @variable will be: @variable. - * + * * @param element element at caret * @param text text in editor * @param cursorOffset current caret offset in editor @@ -131,7 +130,7 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect @NotNull public static List expandToWholeLinesWithBlanks(@NotNull CharSequence text, @NotNull TextRange range) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); result.addAll(expandToWholeLine(text, range, true)); TextRange last = result.isEmpty() ? range : result.get(result.size() - 1); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/wordSelection/AbstractWordSelectioner.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/wordSelection/AbstractWordSelectioner.java index dc6b5a64ae0c..88d470c4e01f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/wordSelection/AbstractWordSelectioner.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/wordSelection/AbstractWordSelectioner.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.editorActions.wordSelection; @@ -21,9 +7,9 @@ import com.intellij.codeInsight.editorActions.SelectWordUtil; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; /** @@ -42,7 +28,7 @@ public abstract class AbstractWordSelectioner extends ExtendWordSelectionHandler ranges = super.select(e, editorText, cursorOffset, editor); } else { - ranges = ContainerUtil.newArrayList(); + ranges = new ArrayList<>(); } SelectWordUtil.addWordOrLexemeSelection(editor.getSettings().isCamelWords(), editor, cursorOffset, ranges); return ranges; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/wordSelection/InjectedReferenceSelectioner.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/wordSelection/InjectedReferenceSelectioner.java index 606e4f884dfa..4a78fa665350 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/wordSelection/InjectedReferenceSelectioner.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/wordSelection/InjectedReferenceSelectioner.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.editorActions.wordSelection; @@ -22,7 +8,6 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiLanguageInjectionHost; import com.intellij.psi.impl.source.resolve.reference.impl.providers.PsiFileReference; import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.JBIterable; import org.jetbrains.annotations.NotNull; @@ -46,7 +31,7 @@ public class InjectedReferenceSelectioner extends AbstractWordSelectioner { .filter(PsiFileReference.class) .map(r -> r.getRangeInElement().shiftRight(r.getElement().getTextRange().getStartOffset())) .filter(r -> r.getStartOffset() <= cursorOffset) - .addAllTo(ContainerUtil.newArrayList()); + .addAllTo(new ArrayList<>()); if (ranges.isEmpty()) return Collections.emptyList(); TextRange smallest = null; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hints/ParameterHintsUpdater.java b/platform/lang-impl/src/com/intellij/codeInsight/hints/ParameterHintsUpdater.java index d7fd4a959bf5..bed1d29001be 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hints/ParameterHintsUpdater.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hints/ParameterHintsUpdater.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.hints; import com.intellij.codeInsight.daemon.impl.ParameterHintsPresentationManager; @@ -23,7 +9,6 @@ import com.intellij.openapi.editor.VisualPosition; import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.util.Key; import com.intellij.util.DocumentUtil; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.TIntObjectHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -37,7 +22,7 @@ public class ParameterHintsUpdater { private final ParameterHintsPresentationManager myHintsManager = ParameterHintsPresentationManager.getInstance(); private final TIntObjectHashMap myCaretMap; - + private final TIntObjectHashMap> myNewHints; private final TIntObjectHashMap myHintsToPreserve; private final boolean myForceImmediateUpdate; @@ -49,7 +34,7 @@ public class ParameterHintsUpdater { public ParameterHintsUpdater(@NotNull Editor editor, @NotNull List editorInlays, @NotNull TIntObjectHashMap> newHints, - @NotNull TIntObjectHashMap hintsToPreserve, + @NotNull TIntObjectHashMap hintsToPreserve, boolean forceImmediateUpdate) { myEditor = editor; myNewHints = newHints; @@ -62,12 +47,12 @@ public class ParameterHintsUpdater { myEditorInlays = editorInlays; } - - + + private List getInlayUpdates(List editorHints) { myEditor.putUserData(HINT_REMOVAL_DELAYED, Boolean.FALSE); - List updates = ContainerUtil.newArrayList(); + List updates = new ArrayList<>(); editorHints.forEach(editorHint -> { int offset = editorHint.getOffset(); @@ -113,7 +98,7 @@ public class ParameterHintsUpdater { } return newHint; } - + private boolean isPreserveHint(@NotNull Inlay inlay, @Nullable String newText) { if (newText == null) { newText = myHintsToPreserve.get(inlay.getOffset()); @@ -121,7 +106,7 @@ public class ParameterHintsUpdater { String oldText = myHintsManager.getHintText(inlay); return Objects.equals(newText, oldText); } - + public void update() { myUpdateList = getInlayUpdates(myEditorInlays); @@ -143,10 +128,10 @@ public class ParameterHintsUpdater { Inlay inlay = myHintsManager.addHint(myEditor, info.offset, info.relatesToPrecedingText, newText, info.widthAdjustment, useAnimation); if (inlay != null && !((DocumentEx)myEditor.getDocument()).isInBulkUpdate()) { VisualPosition inlayPosition = inlay.getVisualPosition(); - VisualPosition visualPosition = new VisualPosition(inlayPosition.line, + VisualPosition visualPosition = new VisualPosition(inlayPosition.line, inlayPosition.column + (info.relatesToPrecedingText ? 1 : 0)); Caret caret = myEditor.getCaretModel().getCaretAt(visualPosition); - if (caret != null) caret.moveToVisualPosition(new VisualPosition(inlayPosition.line, + if (caret != null) caret.moveToVisualPosition(new VisualPosition(inlayPosition.line, inlayPosition.column + (info.relatesToPrecedingText ? 0 : 1))); } } @@ -168,10 +153,10 @@ public class ParameterHintsUpdater { private boolean isSameHintAddedNear(@NotNull String text, int index) { return getInfosNear(index).anyMatch((info) -> text.equals(info.newText)); } - - + + private Stream getInfosNear(int index) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); if (index > 0) { result.add(myUpdateList.get(index - 1)); } @@ -196,7 +181,7 @@ public class ParameterHintsUpdater { return true; } - + private static class InlayUpdateInfo { public enum Action { ADD, DELETE, REPLACE, SKIP diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupArranger.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupArranger.java index f3b527a4b0bb..77517bcca58c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupArranger.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/LookupArranger.java @@ -115,8 +115,8 @@ public abstract class LookupArranger implements WeighingContext { } protected List retainItems(final Set retained) { - List filtered = ContainerUtil.newArrayList(); - List removed = ContainerUtil.newArrayList(); + List filtered = new ArrayList<>(); + List removed = new ArrayList<>(); for (LookupElement item : myItems) { (retained.contains(item) ? filtered : removed).add(item); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java index f7dc9929cd63..3026e6616da9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java @@ -526,7 +526,7 @@ public class TemplateManagerImpl extends TemplateManager implements Disposable { public static List listApplicableTemplates(PsiFile file, int offset, boolean selectionOnly) { Set contextTypes = getApplicableContextTypes(file, offset); - final ArrayList result = ContainerUtil.newArrayList(); + final ArrayList result = new ArrayList<>(); for (final TemplateImpl template : TemplateSettings.getInstance().getTemplates()) { if (!template.isDeactivated() && (!selectionOnly || template.isSelectionTemplate()) && isApplicable(template, contextTypes)) { result.add(template); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java index e1ab9b98cae7..11568d7b7fa9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.template.impl; import com.intellij.codeInsight.CodeInsightSettings; @@ -629,7 +629,7 @@ public class TemplateState implements Disposable { catch (IndexNotReadyException ignored) { } if (elements == null) return Collections.emptyList(); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (int i = 0; i < elements.length; i++) { result.add(new TemplateExpressionLookupElement(this, elements[i], i)); } @@ -738,7 +738,7 @@ public class TemplateState implements Disposable { } } - List changes = ContainerUtil.newArrayList(); + List changes = new ArrayList<>(); boolean selectionCalculated = false; for (int i = 0; i < myTemplate.getSegmentsCount(); i++) { if (!calcedSegments.get(i)) { @@ -1152,7 +1152,7 @@ public class TemplateState implements Disposable { int selStart = myTemplate.getSelectionStartSegmentNumber(); int selEnd = myTemplate.getSelectionEndSegmentNumber(); IntArrayList indices = new IntArrayList(); - List changes = ContainerUtil.newArrayList(); + List changes = new ArrayList<>(); for (int i = 0; i < myTemplate.getSegmentsCount(); i++) { int length = mySegments.getSegmentEnd(i) - mySegments.getSegmentStart(i); if (length != 0) continue; @@ -1177,7 +1177,7 @@ public class TemplateState implements Disposable { } private void restoreEmptyVariables(IntArrayList indices) { - List rangesToRemove = ContainerUtil.newArrayList(); + List rangesToRemove = new ArrayList<>(); for (int i = 0; i < indices.size(); i++) { int index = indices.get(i); rangesToRemove.add(TextRange.create(mySegments.getSegmentStart(index), mySegments.getSegmentEnd(index))); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplateMetaData.java b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplateMetaData.java index b8187ee4d3e6..028bc5ff0d15 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplateMetaData.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplateMetaData.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.template.postfix.settings; @@ -10,7 +10,6 @@ import com.intellij.codeInsight.template.postfix.templates.editable.EditablePost import com.intellij.codeInsight.template.postfix.templates.editable.PostfixTemplateWrapper; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.lang.UrlClassLoader; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,6 +17,7 @@ import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.List; public final class PostfixTemplateMetaData extends BeforeAfterActionMetaData { @@ -71,7 +71,7 @@ public final class PostfixTemplateMetaData extends BeforeAfterActionMetaData { @NotNull static TextDescriptor[] decorateTextDescriptorWithKey(TextDescriptor[] before, @NotNull String key) { - List list = ContainerUtil.newArrayListWithCapacity(before.length); + List list = new ArrayList<>(before.length); for (final TextDescriptor descriptor : before) { list.add(new TextDescriptor() { @Override diff --git a/platform/lang-impl/src/com/intellij/execution/filters/AbstractFileHyperlinkFilter.java b/platform/lang-impl/src/com/intellij/execution/filters/AbstractFileHyperlinkFilter.java index 8b094666eb20..163f717123ab 100644 --- a/platform/lang-impl/src/com/intellij/execution/filters/AbstractFileHyperlinkFilter.java +++ b/platform/lang-impl/src/com/intellij/execution/filters/AbstractFileHyperlinkFilter.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.filters; import com.intellij.openapi.application.ReadAction; @@ -25,12 +11,12 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.io.LocalFileFinder; import java.io.File; +import java.util.ArrayList; import java.util.List; public abstract class AbstractFileHyperlinkFilter implements Filter { @@ -76,7 +62,7 @@ public abstract class AbstractFileHyperlinkFilter implements Filter { LOG.error("Failed to parse '" + line + "' with " + getClass(), e); return null; } - List items = ContainerUtil.newArrayList(); + List items = new ArrayList<>(); for (FileHyperlinkRawData link : links) { String filePath = FileUtil.toSystemIndependentName(link.getFilePath()); if (StringUtil.isEmptyOrSpaces(filePath)) continue; diff --git a/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java b/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java index 544e37365989..ab468c0f594c 100644 --- a/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java +++ b/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.rmi; import com.intellij.execution.ExecutionException; @@ -24,7 +24,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ExceptionUtil; import com.intellij.util.ObjectUtils; import com.intellij.util.concurrency.FixedFuture; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -70,7 +69,7 @@ public abstract class RemoteProcessSupport { } public void stopAll(final boolean wait) { - final List infos = ContainerUtil.newArrayList(); + final List infos = new ArrayList<>(); synchronized (myProcMap) { for (Info o : myProcMap.values()) { if (o.handler != null) infos.add(o); @@ -151,7 +150,7 @@ public abstract class RemoteProcessSupport { @NotNull public Future release(@NotNull Target target, @Nullable Parameters configuration) { - List infos = ContainerUtil.newArrayList(); + List infos = new ArrayList<>(); synchronized (myProcMap) { for (Pair key : myProcMap.keySet()) { if (key.first == target && (configuration == null || key.second == configuration)) { diff --git a/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java b/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java index 8a20199c0b45..0e65d0c9f17a 100644 --- a/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java +++ b/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.runners; import com.intellij.execution.ExecutionException; @@ -30,13 +16,13 @@ import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.Project; import com.intellij.ui.JBColor; import com.intellij.ui.SideBorder; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; import java.util.List; /** @@ -176,7 +162,7 @@ public abstract class AbstractConsoleRunnerWithHistory actionList = ContainerUtil.newArrayList(); + List actionList = new ArrayList<>(); //stop actionList.add(createStopAction()); diff --git a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java index 5c8b2c633021..00c0571ad0dc 100644 --- a/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java +++ b/platform/lang-impl/src/com/intellij/find/editorHeaderActions/SelectAllAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.find.editorHeaderActions; import com.intellij.find.EditorSearchSession; @@ -22,6 +8,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; public class SelectAllAction extends OccurrenceAction { @@ -44,7 +31,7 @@ public class SelectAllAction extends OccurrenceAction { @Nullable @Override public ShortcutSet getShortcut() { - List shortcuts = ContainerUtil.newArrayList(); + List shortcuts = new ArrayList<>(); AnAction selectAllOccurrences = ActionManager.getInstance().getAction(IdeActions.ACTION_SELECT_ALL_OCCURRENCES); if (selectAllOccurrences != null) { ContainerUtil.addAll(shortcuts, selectAllOccurrences.getShortcutSet().getShortcuts()); diff --git a/platform/lang-impl/src/com/intellij/find/findUsages/UsageHistory.java b/platform/lang-impl/src/com/intellij/find/findUsages/UsageHistory.java index 0649b1e6063e..dda42fe24888 100644 --- a/platform/lang-impl/src/com/intellij/find/findUsages/UsageHistory.java +++ b/platform/lang-impl/src/com/intellij/find/findUsages/UsageHistory.java @@ -1,22 +1,7 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.find.findUsages; import com.intellij.usages.ConfigurableUsageTarget; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.hash.EqualityPolicy; import com.intellij.util.containers.hash.LinkedHashMap; import org.jetbrains.annotations.NotNull; @@ -46,7 +31,7 @@ public class UsageHistory { @NotNull public List getAll() { synchronized (myHistory) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); final Set entries = myHistory.keySet(); for (Iterator iterator = entries.iterator(); iterator.hasNext(); ) { final ConfigurableUsageTarget target = iterator.next(); diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java index 79eebe779dc4..fb046bc13dd0 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java @@ -638,7 +638,7 @@ public class FindPopupPanel extends JBPanel implements FindUI { DumbAwareAction.create(__ -> myReplaceAllButton.doClick()).registerCustomShortcutSet(new CustomShortcutSet(REPLACE_ALL), this); myReplaceAllButton.setToolTipText(KeymapUtil.getKeystrokeText(REPLACE_ALL)); - List navigationKeyStrokes = ContainerUtil.newArrayList(); + List navigationKeyStrokes = new ArrayList<>(); KeyStroke viewSourceKeyStroke = KeymapUtil.getKeyStroke(CommonShortcuts.getViewSource()); if (viewSourceKeyStroke != null && !Comparing.equal(viewSourceKeyStroke, ENTER_WITH_MODIFIERS) && !Comparing.equal(viewSourceKeyStroke, ENTER)) { navigationKeyStrokes.add(new KeyboardShortcut(viewSourceKeyStroke, null)); diff --git a/platform/lang-impl/src/com/intellij/formatting/InitialInfoBuilderState.java b/platform/lang-impl/src/com/intellij/formatting/InitialInfoBuilderState.java index fe22b496cd64..d8ade4993bf7 100644 --- a/platform/lang-impl/src/com/intellij/formatting/InitialInfoBuilderState.java +++ b/platform/lang-impl/src/com/intellij/formatting/InitialInfoBuilderState.java @@ -1,25 +1,11 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.formatting; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; class InitialInfoBuilderState { @@ -29,7 +15,7 @@ class InitialInfoBuilderState { public Block previousBlock; - private final List myWrappedChildren = ContainerUtil.newArrayList(); + private final List myWrappedChildren = new ArrayList<>(); InitialInfoBuilderState(@NotNull Block parentBlock, @NotNull CompositeBlockWrapper wrappedBlock, @@ -72,5 +58,5 @@ class InitialInfoBuilderState { } } } - + } \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/formatting/engine/StateProcessor.java b/platform/lang-impl/src/com/intellij/formatting/engine/StateProcessor.java index 606d96e45826..8544df58b66d 100644 --- a/platform/lang-impl/src/com/intellij/formatting/engine/StateProcessor.java +++ b/platform/lang-impl/src/com/intellij/formatting/engine/StateProcessor.java @@ -1,41 +1,26 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.formatting.engine; -import com.intellij.util.containers.ContainerUtil; - +import java.util.ArrayList; import java.util.List; public class StateProcessor { - - private final List myStates = ContainerUtil.newArrayList(); + + private final List myStates = new ArrayList<>(); private State myCurrentState; - + public StateProcessor(State initial) { myCurrentState = initial; } - + public void setNextState(State state) { myStates.add(state); } - + public boolean isDone() { return myStates.isEmpty() && myCurrentState.isDone(); } - + public void iteration() { if (!myCurrentState.isDone()) { myCurrentState.iteration(); diff --git a/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceUtil.java b/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceUtil.java index 9377c6cc5817..e60956a81260 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceUtil.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceUtil.java @@ -31,6 +31,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -59,7 +60,7 @@ public class CopyReferenceUtil { @NotNull static List getElementsToCopy(@Nullable final Editor editor, final DataContext dataContext) { - List elements = ContainerUtil.newArrayList(); + List elements = new ArrayList<>(); if (editor != null) { PsiReference reference = TargetElementUtil.findReference(editor); if (reference != null) { @@ -122,7 +123,7 @@ public class CopyReferenceUtil { static String doCopy(List elements, @Nullable Editor editor) { if (elements.isEmpty()) return null; - List fqns = ContainerUtil.newArrayList(); + List fqns = new ArrayList<>(); for (PsiElement element : elements) { String fqn = elementToFqn(element, editor); if (fqn == null) return null; diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java index 4e6f76e13844..5ce733cda227 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java @@ -37,6 +37,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.event.DocumentEvent; import java.awt.*; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -260,7 +261,7 @@ public abstract class GotoActionBase extends AnAction { private void updateHistory(@Nullable String text) { if (!StringUtil.isEmptyOrSpaces(text)) { List history = ourHistory.get(myInAction); - if (history == null) history = ContainerUtil.newArrayList(); + if (history == null) history = new ArrayList<>(); if (!text.equals(ContainerUtil.getFirstItem(history))) { history.add(0, text); } diff --git a/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingCache.java b/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingCache.java index 12a1e48e0509..ff518dcc7168 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingCache.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingCache.java @@ -1,16 +1,16 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.actions.runAnything; import com.intellij.ide.actions.runAnything.activity.RunAnythingProvider; import com.intellij.openapi.components.*; import com.intellij.openapi.project.Project; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.XmlSerializerUtil; import com.intellij.util.xmlb.annotations.XCollection; import com.intellij.util.xmlb.annotations.XMap; import one.util.streamex.StreamEx; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -60,7 +60,7 @@ public class RunAnythingCache implements PersistentStateComponent true)); @XCollection(elementName = "command") - @NotNull private final List myCommands = ContainerUtil.newArrayList(); + @NotNull private final List myCommands = new ArrayList<>(); @NotNull public List getCommands() { diff --git a/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingUtil.java b/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingUtil.java index 63967bd7dc65..72ab56979991 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingUtil.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.actions.runAnything; import com.intellij.execution.Executor; @@ -26,7 +26,6 @@ import com.intellij.ui.*; import com.intellij.ui.components.JBList; import com.intellij.ui.popup.PopupPositionManager; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -35,6 +34,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.border.Border; import java.awt.*; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; @@ -163,7 +163,7 @@ public class RunAnythingUtil { public static Collection> getOrCreateWrappedCommands(@NotNull Project project) { Collection> list = project.getUserData(RUN_ANYTHING_WRAPPED_COMMANDS); if (list == null) { - list = ContainerUtil.newArrayList(); + list = new ArrayList<>(); project.putUserData(RUN_ANYTHING_WRAPPED_COMMANDS, list); } return list; diff --git a/platform/lang-impl/src/com/intellij/ide/actions/runAnything/groups/RunAnythingGeneralGroup.java b/platform/lang-impl/src/com/intellij/ide/actions/runAnything/groups/RunAnythingGeneralGroup.java index 8b2b2edd84b4..b5085d9722a3 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/runAnything/groups/RunAnythingGeneralGroup.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/runAnything/groups/RunAnythingGeneralGroup.java @@ -1,13 +1,13 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.actions.runAnything.groups; import com.intellij.ide.IdeBundle; import com.intellij.ide.actions.runAnything.activity.RunAnythingProvider; import com.intellij.ide.actions.runAnything.items.RunAnythingItem; import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collection; public class RunAnythingGeneralGroup extends RunAnythingGroupBase { @@ -25,7 +25,7 @@ public class RunAnythingGeneralGroup extends RunAnythingGroupBase { @NotNull @Override public Collection getGroupItems(@NotNull DataContext dataContext, @NotNull String pattern) { - Collection collector = ContainerUtil.newArrayList(); + Collection collector = new ArrayList<>(); for (RunAnythingProvider provider : RunAnythingProvider.EP_NAME.getExtensions()) { if (GENERAL_GROUP_TITLE.equals(provider.getCompletionGroupTitle())) { diff --git a/platform/lang-impl/src/com/intellij/ide/actions/runAnything/groups/RunAnythingRecentGroup.java b/platform/lang-impl/src/com/intellij/ide/actions/runAnything/groups/RunAnythingRecentGroup.java index 28c7c53f7ab0..30c3a8231709 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/runAnything/groups/RunAnythingRecentGroup.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/runAnything/groups/RunAnythingRecentGroup.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.actions.runAnything.groups; import com.intellij.ide.IdeBundle; @@ -11,6 +11,7 @@ import com.intellij.openapi.project.Project; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collection; public class RunAnythingRecentGroup extends RunAnythingGroupBase { @@ -30,7 +31,7 @@ public class RunAnythingRecentGroup extends RunAnythingGroupBase { Project project = CommonDataKeys.PROJECT.getData(dataContext); assert project != null; - Collection collector = ContainerUtil.newArrayList(); + Collection collector = new ArrayList<>(); for (String command : ContainerUtil.iterateBackward(RunAnythingCache.getInstance(project).getState().getCommands())) { for (RunAnythingProvider provider : RunAnythingProvider.EP_NAME.getExtensions()) { Object matchingValue = provider.findMatchingValue(dataContext, command); diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeSelectWordHandler.java b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeSelectWordHandler.java index 34a230194277..b6d7e13882d1 100644 --- a/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeSelectWordHandler.java +++ b/platform/lang-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeSelectWordHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.highlighter.custom.impl; import com.intellij.codeInsight.editorActions.BraceMatcherBasedSelectioner; @@ -8,9 +8,9 @@ import com.intellij.openapi.editor.highlighter.HighlighterIterator; import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; /** @@ -28,7 +28,7 @@ public class CustomFileTypeSelectWordHandler extends BraceMatcherBasedSelectione HighlighterIterator iterator = ((EditorEx)editor).getHighlighter().createIterator(cursorOffset); if (CustomFileTypeQuoteHandler.isQuotedToken(iterator.getTokenType())) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); int start = iterator.getStart(); int end = iterator.getEnd(); char limitingQuote = CustomFileTypeQuoteHandler.getLimitingQuote(iterator.getTokenType()); @@ -41,7 +41,7 @@ public class CustomFileTypeSelectWordHandler extends BraceMatcherBasedSelectione } return result; } - + return superResult; } } diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarModel.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarModel.java index c176707f8197..ee89b274147a 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarModel.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarModel.java @@ -237,7 +237,7 @@ public class NavBarModel { } protected List getChildren(final Object object) { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); Processor processor = o -> { ContainerUtil.addIfNotNull(result, o instanceof PsiElement ? normalize((PsiElement)o) : o); return true; diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java index 142f91d5f1e1..e39f59876a75 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.projectView.impl; @@ -530,7 +530,7 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl @NotNull public PsiDirectory[] getSelectedDirectories() { - List directories = ContainerUtil.newArrayList(); + List directories = new ArrayList<>(); for (PsiDirectoryNode node : getSelectedNodes(PsiDirectoryNode.class)) { PsiDirectory directory = node.getValue(); if (directory != null) { diff --git a/platform/lang-impl/src/com/intellij/ide/scratch/LRUPopupBuilder.java b/platform/lang-impl/src/com/intellij/ide/scratch/LRUPopupBuilder.java index cf0b690172f2..fda4ac2f23b7 100644 --- a/platform/lang-impl/src/com/intellij/ide/scratch/LRUPopupBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/scratch/LRUPopupBuilder.java @@ -156,8 +156,8 @@ public abstract class LRUPopupBuilder { if (mySelection != null) { ids.add(getStorageId(mySelection)); } - List lru = ContainerUtil.newArrayListWithCapacity(LRU_ITEMS); - List items = ContainerUtil.newArrayListWithCapacity(MAX_VISIBLE_SIZE); + List lru = new ArrayList<>(LRU_ITEMS); + List items = new ArrayList<>(MAX_VISIBLE_SIZE); List extra = myExtraItems.toList(); if (myItemsIterable != null) { for (T t : myItemsIterable) { @@ -247,7 +247,7 @@ public abstract class LRUPopupBuilder { private void storeLRUItems(@NotNull T t) { String[] values = myPropertiesComponent.getValues(getLRUKey()); - List lastUsed = ContainerUtil.newArrayListWithCapacity(LRU_ITEMS); + List lastUsed = new ArrayList<>(LRU_ITEMS); lastUsed.add(getStorageId(t)); if (values != null) { for (String value : values) { diff --git a/platform/lang-impl/src/com/intellij/ide/scratch/ScratchProjectViewPane.java b/platform/lang-impl/src/com/intellij/ide/scratch/ScratchProjectViewPane.java index 84d4d6a64e75..249c71d2d4e3 100644 --- a/platform/lang-impl/src/com/intellij/ide/scratch/ScratchProjectViewPane.java +++ b/platform/lang-impl/src/com/intellij/ide/scratch/ScratchProjectViewPane.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.scratch; import com.intellij.icons.AllIcons; @@ -245,7 +245,7 @@ public class ScratchProjectViewPane extends ProjectViewPane { @NotNull @Override public Collection getChildren() { - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); for (RootType rootType : RootType.getAllRootTypes()) { ContainerUtil.addIfNotNull(list, createRootNode(getProject(), rootType, getSettings())); } @@ -340,7 +340,7 @@ public class ScratchProjectViewPane extends ProjectViewPane { @Nullable PsiDirectory directory, @NotNull ViewSettings settings, @NotNull PsiFileSystemItemFilter filter) { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); PsiElementProcessor processor = new PsiElementProcessor() { @Override public boolean execute(@NotNull PsiFileSystemItem element) { diff --git a/platform/lang-impl/src/com/intellij/ide/script/IdeStartupScripts.java b/platform/lang-impl/src/com/intellij/ide/script/IdeStartupScripts.java index 72dc2c94679d..2190f73e65bb 100644 --- a/platform/lang-impl/src/com/intellij/ide/script/IdeStartupScripts.java +++ b/platform/lang-impl/src/com/intellij/ide/script/IdeStartupScripts.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.script; import com.intellij.ide.ApplicationInitializedListener; @@ -30,6 +30,7 @@ import org.jetbrains.ide.script.IdeScriptException; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.Future; @@ -67,7 +68,7 @@ class IdeStartupScripts implements ApplicationInitializedListener { if (scripts.isEmpty()) return Collections.emptyList(); IdeScriptEngineManager scriptEngineManager = IdeScriptEngineManager.getInstance(); - List> result = ContainerUtil.newArrayList(); + List> result = new ArrayList<>(); for (File script : scripts) { String extension = FileUtilRt.getExtension(script.getName()); IdeScriptEngine engine = extension.isEmpty() ? null : scriptEngineManager.getEngineForFileExtension(extension, null); diff --git a/platform/lang-impl/src/com/intellij/ide/todo/configurable/FilterDialog.java b/platform/lang-impl/src/com/intellij/ide/todo/configurable/FilterDialog.java index 25177be4f4fc..3e5111b2cd0d 100644 --- a/platform/lang-impl/src/com/intellij/ide/todo/configurable/FilterDialog.java +++ b/platform/lang-impl/src/com/intellij/ide/todo/configurable/FilterDialog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.todo.configurable; import com.intellij.ide.IdeBundle; @@ -10,12 +10,12 @@ import com.intellij.ui.CheckBoxList; import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.components.JBTextField; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.FormBuilder; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; import java.util.List; class FilterDialog extends DialogWrapper { @@ -65,7 +65,7 @@ class FilterDialog extends DialogWrapper { @NotNull @Override protected List doValidateAll() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); String filterName = getNewFilterName(); if (filterName.isEmpty()) { result.add(new ValidationInfo(IdeBundle.message("error.filter.name.should.be.specified"), myNameField)); diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java index 6c98cedab713..fd3446c9b8d5 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.util.gotoByName; @@ -111,8 +111,8 @@ public abstract class ChooseByNameBase implements ChooseByNameViewModel { JScrollPane myListScrollPane; // Located in the layered pane private final SmartPointerListModel myListModel = new SmartPointerListModel<>(); protected final JList myList = new JBList<>(myListModel); - private final List> myHistory = ContainerUtil.newArrayList(); - private final List> myFuture = ContainerUtil.newArrayList(); + private final List> myHistory = new ArrayList<>(); + private final List> myFuture = new ArrayList<>(); protected ChooseByNamePopupComponent.Callback myActionListener; diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java index 2715a4c54fba..62f015bf226b 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionItemProvider.java @@ -127,7 +127,7 @@ public class GotoActionItemProvider implements ChooseByNameItemProvider { Map map = myModel.getConfigurablesNames(); SearchableOptionsRegistrarImpl registrar = (SearchableOptionsRegistrarImpl)SearchableOptionsRegistrar.getInstance(); - List options = ContainerUtil.newArrayList(); + List options = new ArrayList<>(); final Set words = registrar.getProcessedWords(pattern); Set optionDescriptions = null; final String actionManagerName = myActionManager.getComponentName(); diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java index a5f6d4104044..d0cc4cb94a8e 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java @@ -877,7 +877,7 @@ public class GotoActionModel implements ChooseByNameModel, Comparator, D boolean selected) { SimpleTextAttributes plain = new SimpleTextAttributes(STYLE_PLAIN, fg); SimpleTextAttributes highlighted = new SimpleTextAttributes(null, fg, null, STYLE_SEARCH_MATCH); - List fragments = ContainerUtil.newArrayList(); + List fragments = new ArrayList<>(); if (selected) { int matchStart = StringUtil.indexOfIgnoreCase(name, pattern, 0); if (matchStart >= 0) { diff --git a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java index e36f902da9b7..c1e4f99b7bbf 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java +++ b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java @@ -31,6 +31,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; +import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; import java.util.List; @@ -105,7 +106,7 @@ public class AbstractNewProjectStep extends DefaultActionGroup implements Dum } public AnAction[] getActions(@NotNull DirectoryProjectGenerator[] generators, @NotNull AbstractCallback callback) { - final List actions = ContainerUtil.newArrayList(); + final List actions = new ArrayList<>(); for (DirectoryProjectGenerator projectGenerator : generators) { try { actions.addAll(Arrays.asList(getActions(projectGenerator, callback))); diff --git a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java index 5427dad89f06..cac34628812d 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java +++ b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.util.projectWizard; import com.intellij.BundleBase; @@ -22,7 +22,6 @@ import com.intellij.platform.templates.TemplateProjectDirectoryGenerator; import com.intellij.ui.DocumentAdapter; import com.intellij.ui.JBColor; import com.intellij.ui.components.JBScrollPane; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,6 +34,7 @@ import java.awt.event.ActionListener; import java.io.File; import java.nio.file.InvalidPathException; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; import static com.intellij.openapi.wm.impl.welcomeScreen.FlatWelcomeFrame.BOTTOM_PANEL; @@ -253,7 +253,7 @@ public class ProjectSettingsStepBase extends AbstractActionWithPanel implemen if (settingsStep.isEmpty()) return createContentPanelWithAdvancedSettingsPanel(); final JPanel jPanel = new JPanel(new VerticalFlowLayout(0, 5)); - List labeledComponentList = ContainerUtil.newArrayList(); + List labeledComponentList = new ArrayList<>(); labeledComponentList.add(createLocationComponent()); labeledComponentList.addAll(settingsStep.getFields()); diff --git a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/WebProjectSettingsStepWrapper.java b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/WebProjectSettingsStepWrapper.java index 9a27e95f67d4..d77469601597 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/WebProjectSettingsStepWrapper.java +++ b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/WebProjectSettingsStepWrapper.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.util.projectWizard; import com.intellij.openapi.ui.LabeledComponent; @@ -23,14 +9,15 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.ArrayList; import java.util.List; public class WebProjectSettingsStepWrapper implements SettingsStep { private static final Function, LabeledComponent> PAIR_LABELED_COMPONENT_FUNCTION = pair -> LabeledComponent.create(pair.getSecond(), pair.getFirst()); - private final List> myFields = ContainerUtil.newArrayList(); - private final List myComponents = ContainerUtil.newArrayList(); + private final List> myFields = new ArrayList<>(); + private final List myComponents = new ArrayList<>(); public List getComponents() { return myComponents; diff --git a/platform/lang-impl/src/com/intellij/internal/psiView/PsiViewerSourceWrapper.java b/platform/lang-impl/src/com/intellij/internal/psiView/PsiViewerSourceWrapper.java index 7e5ea2d078f4..63d29c27f2e4 100644 --- a/platform/lang-impl/src/com/intellij/internal/psiView/PsiViewerSourceWrapper.java +++ b/platform/lang-impl/src/com/intellij/internal/psiView/PsiViewerSourceWrapper.java @@ -13,10 +13,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; class PsiViewerSourceWrapper implements Comparable { @@ -56,7 +53,7 @@ class PsiViewerSourceWrapper implements Comparable { @NotNull public static List getFileTypeBasedWrappers() { Set allFileTypes = new HashSet<>(); - List sourceWrappers = ContainerUtil.newArrayList(); + List sourceWrappers = new ArrayList<>(); Collections.addAll(allFileTypes, FileTypeManager.getInstance().getRegisteredFileTypes()); for (Language language : Language.getRegisteredLanguages()) { FileType fileType = language.getAssociatedFileType(); diff --git a/platform/lang-impl/src/com/intellij/internal/statistic/actions/TestParseEventLogWhitelistDialog.java b/platform/lang-impl/src/com/intellij/internal/statistic/actions/TestParseEventLogWhitelistDialog.java index e4e351180f61..5111823af61a 100644 --- a/platform/lang-impl/src/com/intellij/internal/statistic/actions/TestParseEventLogWhitelistDialog.java +++ b/platform/lang-impl/src/com/intellij/internal/statistic/actions/TestParseEventLogWhitelistDialog.java @@ -37,7 +37,6 @@ import com.intellij.psi.PsiManager; import com.intellij.testFramework.LightVirtualFile; import com.intellij.util.IncorrectOperationException; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -45,6 +44,7 @@ import javax.swing.*; import java.awt.*; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import static com.intellij.openapi.command.WriteCommandAction.writeCommandAction; @@ -64,7 +64,7 @@ public class TestParseEventLogWhitelistDialog extends DialogWrapper { private final Project myProject; private final EditorEx myWhitelistEditor; private final EditorEx myResultEditor; - private final List myTempFiles = ContainerUtil.newArrayList(); + private final List myTempFiles = new ArrayList<>(); protected TestParseEventLogWhitelistDialog(@NotNull Project project, @Nullable Editor selectedEditor) { super(project); diff --git a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java index c5445d55d3fb..5b1547d3cb1e 100644 --- a/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java +++ b/platform/lang-impl/src/com/intellij/lang/javascript/boilerplate/GithubProjectGeneratorPeer.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.lang.javascript.boilerplate; import com.google.common.collect.Sets; @@ -31,10 +17,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; +import java.util.*; /** * @author Sergey Simonchik @@ -116,7 +99,7 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator myVersionPanel = myReloadableComboBoxPanel.getMainPanel(); } - private final List myListeners = ContainerUtil.newArrayList(); + private final List myListeners = new ArrayList<>(); private final GithubTagInfo myMasterTag; private final GithubTagListProvider myTagListProvider; private JComponent myComponent; diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java index de51df4c8bdb..110a5b43ff16 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. /* * @author max @@ -69,7 +69,7 @@ public class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesUpdater public void processAfterVfsChanges(@NotNull List events) { boolean pushedSomething = false; - List delayedTasks = ContainerUtil.newArrayList(); + List delayedTasks = new ArrayList<>(); for (VFileEvent event : events) { VirtualFile file = event.getFile(); if (event instanceof VFileCopyEvent) { @@ -273,7 +273,7 @@ public class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesUpdater final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); final ConcurrentLinkedQueue tasksQueue = new ConcurrentLinkedQueue<>(tasks); - List> results = ContainerUtil.newArrayList(); + List> results = new ArrayList<>(); if (tasks.size() > 1) { int numThreads = Math.max(Math.min(CacheUpdateRunner.indexingThreadCount() - 1, tasks.size() - 1), 1); diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java index 73299fc87ecb..8c3f2ce32c1a 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java @@ -147,7 +147,7 @@ public class CodeStyleSettingsCodeFragmentFilter { private final int myTotalFieldsNumber; private final Collection myAllFields; - private List myAffectingFields = ContainerUtil.newArrayList(); + private List myAffectingFields = new ArrayList<>(); private final Object myCommonSettings; @Nullable private final CustomCodeStyleSettings myCustomSettings; @@ -258,7 +258,7 @@ interface SequentialTaskWithFixedIterationsNumber extends SequentialTask { } class CompositeSequentialTask implements SequentialTask { - private final List myUnfinishedTasks = ContainerUtil.newArrayList(); + private final List myUnfinishedTasks = new ArrayList<>(); private SequentialTask myCurrentTask = null; private int myIterationsFinished; diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java index 1be5a3093c19..3f08cb4c41ce 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.codeStyle; import com.intellij.application.options.CodeStyle; @@ -47,6 +33,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; @@ -63,7 +50,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { private static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("Automatic indent detection", NotificationDisplayType.STICKY_BALLOON, true); - + private boolean myIsEnabledInTest; private final Map myDiscardedOptions = ContainerUtil.createWeakMap(); @@ -219,7 +206,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { @Override public AnAction[] getActions(@NotNull PsiFile file) { IndentOptions indentOptions = getIndentOptions(); - List actions = ContainerUtil.newArrayList(); + List actions = new ArrayList<>(); final VirtualFile virtualFile = file.getVirtualFile(); final Project project = file.getProject(); final IndentOptions projectOptions = CodeStyle.getSettings(project).getIndentOptions(file.getFileType()); diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java index 70134386ab72..f88035c13f13 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/arrangement/engine/ArrangementEngine.java @@ -274,7 +274,7 @@ public class ArrangementEngine { for (int i = 0; i < arranged.size() && !dependent.isEmpty(); i++) { E e = arranged.get(i); - List shouldBeAddedAfterCurrentElement = ContainerUtil.newArrayList(); + List shouldBeAddedAfterCurrentElement = new ArrayList<>(); for (Iterator, E>> iterator = dependent.iterator(); iterator.hasNext(); ) { Pair, E> pair = iterator.next(); diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/IndentUsageStatisticsImpl.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/IndentUsageStatisticsImpl.java index 05b190bc95f3..efe258a32933 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/IndentUsageStatisticsImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/autodetect/IndentUsageStatisticsImpl.java @@ -7,6 +7,7 @@ import gnu.trove.TIntIntHashMap; import gnu.trove.TIntIntIterator; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -23,7 +24,7 @@ public class IndentUsageStatisticsImpl implements IndentUsageStatistics { private int myTotalLinesWithWhiteSpaces = 0; private final TIntIntHashMap myIndentToUsagesMap = new TIntIntHashMap(); - private List myIndentUsages = ContainerUtil.newArrayList(); + private List myIndentUsages = new ArrayList<>(); private final Stack myParentIndents = new Stack<>(new IndentData(0, 0)); public IndentUsageStatisticsImpl(@NotNull List lineInfos) { @@ -35,7 +36,7 @@ public class IndentUsageStatisticsImpl implements IndentUsageStatistics { @NotNull private static List toIndentUsageList(@NotNull TIntIntHashMap indentToUsages) { - List indentUsageInfos = ContainerUtil.newArrayList(); + List indentUsageInfos = new ArrayList<>(); TIntIntIterator it = indentToUsages.iterator(); while (it.hasNext()) { it.advance(); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceCompletionImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceCompletionImpl.java index 1362c8336cfc..18966f5f7a48 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceCompletionImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceCompletionImpl.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl.source.resolve.reference.impl.providers; import com.intellij.codeInsight.completion.PrioritizedLookupElement; @@ -30,7 +16,6 @@ import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.ArrayUtil; import com.intellij.util.CommonProcessors; import com.intellij.util.FilteringProcessor; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; import gnu.trove.TObjectHashingStrategy; import org.jetbrains.annotations.NotNull; @@ -82,8 +67,8 @@ public class FileReferenceCompletionImpl extends FileReferenceCompletion { FileReference.getOriginalFile(fileSystemItem)); } }; - - List additionalItems = ContainerUtil.newArrayList(); + + List additionalItems = new ArrayList<>(); for (PsiFileSystemItem context : reference.getContexts()) { for (final PsiElement child : context.getChildren()) { if (child instanceof PsiFileSystemItem) { @@ -112,7 +97,7 @@ public class FileReferenceCompletionImpl extends FileReferenceCompletion { } variants[i] = item; } - + for (int i = 0; i < additionalItems.size(); i++) { variants[i + candidates.length] = additionalItems.get(i); } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java index 9ba8e5213177..ceba3e16e587 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java @@ -158,7 +158,7 @@ public class InjectedLanguageManagerImpl extends InjectedLanguageManager impleme Map injectors = new HashMap<>(); - List allInjectors = ContainerUtil.newArrayList(); + List allInjectors = new ArrayList<>(); allInjectors.addAll(myManualInjectors); Collections.addAll(allInjectors, MultiHostInjector.MULTIHOST_INJECTOR_EP_NAME.getExtensions(myProject)); if (LanguageInjector.EXTENSION_POINT_NAME.hasAnyExtensions()) { @@ -318,7 +318,7 @@ public class InjectedLanguageManagerImpl extends InjectedLanguageManager impleme @NotNull @Override public List getNonEditableFragments(@NotNull DocumentWindow window) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); int offset = 0; for (PsiLanguageInjectionHost.Shred shred : ((DocumentWindowImpl)window).getShreds()) { Segment hostRange = shred.getHostRangeMarker(); diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubSerializationHelper.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubSerializationHelper.java index 8058535d2c99..bd6fc026a56a 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubSerializationHelper.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubSerializationHelper.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.stubs; import com.intellij.openapi.Disposable; @@ -173,7 +159,7 @@ class StubSerializationHelper { } Stub baseStub = deserializeRoot(storage, inputStream); - final List stubs = ContainerUtil.newArrayListWithCapacity(stubFilesCount); + final List stubs = new ArrayList<>(stubFilesCount); if (baseStub instanceof PsiFileStub) stubs.add((PsiFileStub)baseStub); for (int j = 1; j < stubFilesCount; j++) { Stub deserialize = deserializeRoot(storage, inputStream); diff --git a/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java b/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java index 54750f24d3fc..a22e65500a36 100644 --- a/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java +++ b/platform/lang-impl/src/com/intellij/psi/templateLanguages/TemplateDataElementType.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.templateLanguages; import com.intellij.lang.ASTNode; @@ -196,7 +182,7 @@ public class TemplateDataElementType extends IFileElementType implements ITempla LeafElement currentLeaf = TreeUtil.findFirstLeaf(templateFileElement); - //we use manual offset counter because node.getStartOffset() is expensive here + //we use manual offset counter because node.getStartOffset() is expensive here int currentLeafOffset = 0; for (TextRange rangeToProcess: rangeCollector.myOuterAndRemoveRanges) { @@ -274,7 +260,7 @@ public class TemplateDataElementType extends IFileElementType implements ITempla @NotNull CharTable charTable) { @Nullable LeafElement nextLeaf = startLeaf; int nextLeafStartOffset = startLeafOffset; - Collection leavesToRemove = ContainerUtil.newArrayList(); + Collection leavesToRemove = new ArrayList<>(); while (nextLeaf != null && rangeToRemove.containsRange(nextLeafStartOffset, nextLeafStartOffset + nextLeaf.getTextLength())) { leavesToRemove.add(nextLeaf); nextLeafStartOffset += nextLeaf.getTextLength(); @@ -350,7 +336,7 @@ public class TemplateDataElementType extends IFileElementType implements ITempla } }; - // Since we're already inside a template language PSI that was built regardless of the file size (for whatever reason), + // Since we're already inside a template language PSI that was built regardless of the file size (for whatever reason), // there should also be no file size checks for template data files. SingleRootFileViewProvider.doNotCheckFileSizeLimit(virtualFile); @@ -415,7 +401,7 @@ public class TemplateDataElementType extends IFileElementType implements ITempla return; } assertRangeOrder(newRange); - + if (!myOuterAndRemoveRanges.isEmpty()) { int lastItemIndex = myOuterAndRemoveRanges.size() - 1; TextRange lastRange = myOuterAndRemoveRanges.get(lastItemIndex); diff --git a/platform/lang-impl/src/com/intellij/util/ui/tree/PerFileConfigurableBase.java b/platform/lang-impl/src/com/intellij/util/ui/tree/PerFileConfigurableBase.java index ea003ae35f43..d0ea096fbc7d 100644 --- a/platform/lang-impl/src/com/intellij/util/ui/tree/PerFileConfigurableBase.java +++ b/platform/lang-impl/src/com/intellij/util/ui/tree/PerFileConfigurableBase.java @@ -79,9 +79,9 @@ public abstract class PerFileConfigurableBase implements SearchableConfigurab private JBTable myTable; private MyModel myModel; - private final List myResetRunnables = ContainerUtil.newArrayList(); + private final List myResetRunnables = new ArrayList<>(); private final Map myDefaultVals = new HashMap<>(); - private final List, Consumer>> myDefaultProps = ContainerUtil.newArrayList(); + private final List, Consumer>> myDefaultProps = new ArrayList<>(); private VirtualFile myFileToSelect; protected interface Value extends Setter, Getter { @@ -768,7 +768,7 @@ public abstract class PerFileConfigurableBase implements SearchableConfigurab private static class MyModel extends AbstractTableModel { final String[] columnNames; - final List> data = ContainerUtil.newArrayList(); + final List> data = new ArrayList<>(); MyModel(String... names) { columnNames = names; diff --git a/platform/platform-api/src/com/intellij/execution/process/AnsiEscapeDecoder.java b/platform/platform-api/src/com/intellij/execution/process/AnsiEscapeDecoder.java index 58e058254ade..c711e299503e 100644 --- a/platform/platform-api/src/com/intellij/execution/process/AnsiEscapeDecoder.java +++ b/platform/platform-api/src/com/intellij/execution/process/AnsiEscapeDecoder.java @@ -1,27 +1,13 @@ -/* - * Copyright 2000-2013 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.process; import com.intellij.execution.process.AnsiStreamingLexer.AnsiElementType; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import static com.intellij.execution.process.AnsiStreamingLexer.SGR; @@ -105,7 +91,7 @@ public class AnsiEscapeDecoder { Key attributes = getCurrentOutputAttributes(outputType); if (textAcceptor instanceof ColoredChunksAcceptor) { if (buffer == null) { - buffer = ContainerUtil.newArrayListWithCapacity(1); + buffer = new ArrayList<>(1); } buffer.add(Pair.create(text, attributes)); } diff --git a/platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java b/platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java index 6a4bb39250be..6615d2b09b32 100644 --- a/platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java +++ b/platform/platform-api/src/com/intellij/execution/process/ColoredOutputTypeRegistry.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.process; import com.intellij.execution.ui.ConsoleViewContentType; @@ -303,7 +289,7 @@ public class ColoredOutputTypeRegistry { */ @NotNull private static List computeEffectTypes(@NotNull AnsiTerminalEmulator terminalEmulator) { - ArrayList result = ContainerUtil.newArrayList(); + ArrayList result = new ArrayList<>(); AnsiTerminalEmulator.Underline underline = terminalEmulator.getUnderline(); if (underline == AnsiTerminalEmulator.Underline.SINGLE_UNDERLINE) { result.add(EffectType.LINE_UNDERSCORE); diff --git a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java index 30f7fac5eccd..093875ff61fe 100644 --- a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java +++ b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.wizard; import com.intellij.CommonBundle; @@ -29,7 +15,6 @@ import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.JBCardLayout; import com.intellij.ui.components.panels.OpaquePanel; import com.intellij.ui.mac.TouchbarDataKeys; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.update.UiNotifyConnector; import org.jetbrains.annotations.NonNls; @@ -162,7 +147,7 @@ public abstract class AbstractWizard extends DialogWrapper { final GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup(); final GroupLayout.ParallelGroup vGroup = layout.createParallelGroup(); - final Collection buttons = ContainerUtil.newArrayListWithCapacity(5); + final Collection buttons = new ArrayList<>(5); final boolean helpAvailable = ApplicationInfo.contextHelpAvailable(); add(hGroup, vGroup, null, Box.createHorizontalGlue()); diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/LineTooltipRenderer.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/LineTooltipRenderer.java index dfa263a2609e..6dcf8b42eed7 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/LineTooltipRenderer.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/LineTooltipRenderer.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.hint; import com.intellij.ide.BrowserUtil; @@ -25,7 +11,6 @@ import com.intellij.openapi.actionSystem.IdeActions; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.ui.*; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.GridBag; import com.intellij.util.ui.Html; import com.intellij.util.ui.JBUI; @@ -56,7 +41,7 @@ public class LineTooltipRenderer extends ComparableObject.Impl implements Toolti /** * Html-like text for showing - * Please note that the tooltip size is calculated dynamically based on the html so + * Please note that the tooltip size is calculated dynamically based on the html so * if the html content doesn't allow soft line breaks the tooltip can be too big for showing * e.g. *
@@ -64,7 +49,7 @@ public class LineTooltipRenderer extends ComparableObject.Impl implements Toolti */ @NonNls @Nullable protected String myText; - //is used for suppressing some events while processing links + //is used for suppressing some events while processing links private volatile boolean myActiveLink; //mostly is used as a marker that we are in popup with description protected final int myCurrentWidth; @@ -157,7 +142,7 @@ public class LineTooltipRenderer extends ComparableObject.Impl implements Toolti editorPane.setFocusable(true); } - ArrayList actions = ContainerUtil.newArrayList(); + ArrayList actions = new ArrayList<>(); JPanel grid = createMainPanel(hintHint, scrollPane, editorPane); if (ScreenReader.isActive()) { grid.setFocusTraversalPolicyProvider(true); diff --git a/platform/platform-impl/src/com/intellij/execution/process/ColoredProcessHandler.java b/platform/platform-impl/src/com/intellij/execution/process/ColoredProcessHandler.java index 58d7febacd6b..41d87838ba52 100644 --- a/platform/platform-impl/src/com/intellij/execution/process/ColoredProcessHandler.java +++ b/platform/platform-impl/src/com/intellij/execution/process/ColoredProcessHandler.java @@ -1,27 +1,13 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.process; import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.openapi.util.Key; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.nio.charset.Charset; +import java.util.ArrayList; import java.util.List; /** @@ -32,7 +18,7 @@ import java.util.List; public class ColoredProcessHandler extends KillableProcessHandler implements AnsiEscapeDecoder.ColoredTextAcceptor { private final AnsiEscapeDecoder myAnsiEscapeDecoder = new AnsiEscapeDecoder(); - private final List myColoredTextListeners = ContainerUtil.newArrayList(); + private final List myColoredTextListeners = new ArrayList<>(); public ColoredProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException { super(commandLine); diff --git a/platform/platform-impl/src/com/intellij/execution/process/impl/ProcessListUtil.java b/platform/platform-impl/src/com/intellij/execution/process/impl/ProcessListUtil.java index b6098acd71dd..10b59fc21406 100644 --- a/platform/platform-impl/src/com/intellij/execution/process/impl/ProcessListUtil.java +++ b/platform/platform-impl/src/com/intellij/execution/process/impl/ProcessListUtil.java @@ -14,7 +14,6 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.NullableFunction; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.TIntObjectHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -207,7 +206,7 @@ public class ProcessListUtil { @Nullable private static List doParseMacOutput(String output) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); String[] lines = StringUtil.splitByLinesDontTrim(output); if (lines.length == 0) return null; @@ -321,7 +320,7 @@ public class ProcessListUtil { @Nullable static List parseWMICOutput(@NotNull String output) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); String[] lines = StringUtil.splitByLinesDontTrim(output); if (lines.length == 0) return null; @@ -370,7 +369,7 @@ public class ProcessListUtil { @Nullable static List parseListTasksOutput(@NotNull String output) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); CSVReader reader = new CSVReader(new StringReader(output)); try { diff --git a/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsAction.java index 76c5586e23f1..be5614795ce5 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsAction.java @@ -47,6 +47,7 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; import java.awt.event.*; +import java.util.ArrayList; import java.util.List; import static com.intellij.ui.speedSearch.SpeedSearchSupply.ENTERED_PREFIX_PROPERTY_NAME; @@ -74,7 +75,7 @@ public class RecentLocationsAction extends DumbAwareAction { return; } - RecentLocationsDataModel model = new RecentLocationsDataModel(project, ContainerUtil.newArrayList()); + RecentLocationsDataModel model = new RecentLocationsDataModel(project, new ArrayList<>()); JBList list = new JBList<>(JBList.createDefaultListModel(model.getPlaces(false))); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, diff --git a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java index ee3978a6f8fc..18af8935fd5a 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.actions; import com.intellij.featureStatistics.FeatureUsageTracker; @@ -338,7 +338,7 @@ public class Switcher extends AnAction implements DumbAware { twManager = ToolWindowManager.getInstance(project); CollectionListModel twModel = new CollectionListModel<>(); List actions = ToolWindowsGroup.getToolWindowActions(project, true); - List windows = ContainerUtil.newArrayList(); + List windows = new ArrayList<>(); for (ActivateToolWindowAction action : actions) { ToolWindow tw = twManager.getToolWindow(action.getToolWindowId()); if (tw.isAvailable()) { @@ -1004,14 +1004,14 @@ public class Switcher extends AnAction implements DumbAware { void toggleShowEditedFiles() { myShowOnlyEditedFilesCheckBox.doClick(); } - + void setShowOnlyEditedFiles(boolean onlyEdited) { if (myShowOnlyEditedFilesCheckBox.isSelected() != onlyEdited) { myShowOnlyEditedFilesCheckBox.setSelected(onlyEdited); } - + final boolean listWasSelected = files.getSelectedIndex() != -1; - + final Pair, Integer> filesAndSelection = getFilesToShowAndSelectionIndex( project, collectFiles(project, onlyEdited), toolWindows.getModel().getSize(), isPinnedMode()); final int selectionIndex = filesAndSelection.getSecond(); @@ -1323,7 +1323,7 @@ public class Switcher extends AnAction implements DumbAware { + ""; } } - + private static class VirtualFilesRenderer extends ColoredListCellRenderer { private final SwitcherPanel mySwitcherPanel; boolean open; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ToolWindowsGroup.java b/platform/platform-impl/src/com/intellij/ide/actions/ToolWindowsGroup.java index 305085b29f3d..2b2ab6a5842e 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ToolWindowsGroup.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ToolWindowsGroup.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.actions; import com.intellij.openapi.actionSystem.ActionGroup; @@ -8,10 +8,10 @@ import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.ToolWindowManager; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -57,7 +57,7 @@ public final class ToolWindowsGroup extends ActionGroup implements DumbAware { public static List getToolWindowActions(@NotNull Project project, boolean shouldSkipHidden) { ActionManager actionManager = ActionManager.getInstance(); ToolWindowManager manager = ToolWindowManager.getInstance(project); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (String id : manager.getToolWindowIds()) { if (shouldSkipHidden && !manager.getToolWindow(id).isShowStripeButton()) continue; String actionId = ActivateToolWindowAction.getActionIdForToolWindow(id); diff --git a/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java b/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java index a397af3ec28d..03e8e6c2807b 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.customize; import com.intellij.ide.WelcomeWizardUtil; @@ -25,7 +25,7 @@ import java.util.concurrent.ExecutionException; public class PluginGroups { static final String CORE = "Core"; private static final int MAX_DESCR_LENGTH = 55; - + public static final String IDEA_VIM_PLUGIN_ID = "IdeaVIM"; final Map>> myTree = new LinkedHashMap<>(); @@ -41,7 +41,7 @@ public class PluginGroups { private Runnable myLoadingCallback = null; public PluginGroups() { - myAllPlugins = PluginManagerCore.loadDescriptors(null, ContainerUtil.newArrayList()); + myAllPlugins = PluginManagerCore.loadDescriptors(null, new ArrayList<>()); SwingWorker worker = new SwingWorker, Object>() { @Override protected List doInBackground() throws Exception { diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java index f6e7d0660ce6..dc12f2a7c649 100644 --- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.errorTreeView; import com.intellij.icons.AllIcons; @@ -31,11 +29,9 @@ import com.intellij.ui.content.MessageView; import com.intellij.ui.treeStructure.Tree; import com.intellij.util.Alarm; import com.intellij.util.EditSourceOnDoubleClickHandler; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.MutableErrorTreeView; import com.intellij.util.ui.StatusText; -import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.tree.TreeUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -48,6 +44,7 @@ import java.awt.*; import java.awt.datatransfer.StringSelection; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -206,10 +203,10 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur public boolean isCopyVisible(@NotNull DataContext dataContext) { return true; } - + @NotNull public StatusText getEmptyText() { return myTree.getEmptyText(); - } + } @Override public Object getData(@NotNull String dataId) { @@ -357,7 +354,7 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur if (paths == null) { return Collections.emptyList(); } - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (TreePath path : paths) { DefaultMutableTreeNode lastPathNode = (DefaultMutableTreeNode)path.getLastPathComponent(); Object userObject = lastPathNode.getUserObject(); @@ -431,7 +428,7 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur messageView.getContentManager().removeContent(content, true); } } - + public void setProgress(final String s, float fraction) { initProgressPanel(); myProgressText = s; @@ -444,7 +441,7 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur myProgressText = s; updateProgress(); } - + public void setFraction(final float fraction) { initProgressPanel(); myFraction = fraction; @@ -477,7 +474,7 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur } - + private void initProgressPanel() { if (myProgressPanel == null) { myProgressPanel = new JPanel(new GridLayout(1, 2)); diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java index c9861f0a3768..08881c1ecff1 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java @@ -302,7 +302,7 @@ public abstract class PluginManagerMain implements Disposable { setDownloadStatus(true); ApplicationManager.getApplication().executeOnPooledThread(() -> { - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); Map errors = new LinkedHashMap<>(); ProgressIndicator indicator = new EmptyProgressIndicator(); diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginTableModel.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginTableModel.java index 981547c739b0..6ff029a7b3da 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginTableModel.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginTableModel.java @@ -1,23 +1,8 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.plugins; import com.intellij.ide.ui.search.SearchableOptionsRegistrar; import com.intellij.openapi.extensions.PluginId; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.ColumnInfo; import com.intellij.util.ui.SortableColumnModel; import org.jetbrains.annotations.NotNull; @@ -38,8 +23,8 @@ public abstract class PluginTableModel extends AbstractTableModel implements Sor protected static final String NAME = "Name"; protected ColumnInfo[] columns; - protected final List view = ContainerUtil.newArrayList(); - protected final List filtered = ContainerUtil.newArrayList(); + protected final List view = new ArrayList<>(); + protected final List filtered = new ArrayList<>(); private RowSorter.SortKey myDefaultSortKey; private boolean mySortByStatus; @@ -203,7 +188,7 @@ public abstract class PluginTableModel extends AbstractTableModel implements Sor } public List getAllPlugins() { - List list = ContainerUtil.newArrayListWithCapacity(view.size() + filtered.size()); + List list = new ArrayList<>(view.size() + filtered.size()); list.addAll(view); list.addAll(filtered); return list; diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryContentHandler.java b/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryContentHandler.java index 410a14be4d50..61615da4233e 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryContentHandler.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryContentHandler.java @@ -2,13 +2,13 @@ package com.intellij.ide.plugins; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.Stack; import org.jetbrains.annotations.NotNull; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -54,7 +54,7 @@ class RepositoryContentHandler extends DefaultHandler { @Override public void startDocument() { - plugins = ContainerUtil.newArrayList(); + plugins = new ArrayList<>(); categories = new Stack<>(); } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/InspectionsTopHitProvider.java b/platform/platform-impl/src/com/intellij/ide/ui/InspectionsTopHitProvider.java index 445790ba6ff2..3e537f3f66fb 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/InspectionsTopHitProvider.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/InspectionsTopHitProvider.java @@ -5,9 +5,9 @@ import com.intellij.codeInspection.ex.Tools; import com.intellij.ide.ui.search.OptionDescription; import com.intellij.openapi.project.Project; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -24,7 +24,7 @@ final class InspectionsTopHitProvider implements OptionsSearchTopHitProvider.Pro @NotNull @Override public Collection getOptions(@NotNull Project project) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); List tools = InspectionProjectProfileManager.getInstance(project).getCurrentProfile().getAllEnabledInspectionTools(project); for (Tools tool : tools) { result.add(new ToolOptionDescription(tool, project)); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java index d07270757827..d1daa7698638 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.ui.customization; import com.intellij.icons.AllIcons; @@ -26,7 +26,6 @@ import com.intellij.openapi.wm.ex.WindowManagerEx; import com.intellij.openapi.wm.impl.IdeFrameImpl; import com.intellij.ui.mac.touchbar.TouchBarsManager; import com.intellij.util.ImageLoader; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.JBImageIcon; import org.jdom.Element; import org.jetbrains.annotations.NonNls; @@ -37,8 +36,8 @@ import javax.swing.tree.DefaultMutableTreeNode; import java.awt.*; import java.io.File; import java.io.IOException; -import java.util.*; import java.util.List; +import java.util.*; @State(name = "com.intellij.ide.ui.customization.CustomActionsSchema", storages = @Storage("customization.xml")) public class CustomActionsSchema implements PersistentStateComponent { @@ -76,7 +75,7 @@ public class CustomActionsSchema implements PersistentStateComponent { if (TouchBarsManager.isTouchBarAvailable()) myIdToName.put(IdeActions.GROUP_TOUCHBAR, "Touch Bar"); - ArrayList> extList = ContainerUtil.newArrayList(); + ArrayList> extList = new ArrayList<>(); CustomizableActionGroupProvider.CustomizableActionGroupRegistrar registrar = (groupId, groupTitle) -> extList.add(Couple.of(groupId, groupTitle)); for (CustomizableActionGroupProvider provider : CustomizableActionGroupProvider.EP_NAME.getExtensions()) { diff --git a/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java b/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java index 8f262541dc7d..1ae56943ade4 100644 --- a/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java +++ b/platform/platform-impl/src/com/intellij/ide/util/TipDialog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.util; import com.intellij.CommonBundle; @@ -132,7 +132,7 @@ public class TipDialog extends DialogWrapper { VirtualFile[] pathToSelect = lastOpenedTip != null ? new VirtualFile[]{lastOpenedTip} : VirtualFile.EMPTY_ARRAY; VirtualFile[] choose = FileChooserFactory.getInstance().createFileChooser(descriptor, null, myTipPanel).choose(null, pathToSelect); if (choose.length > 0) { - ArrayList tips = ContainerUtil.newArrayList(); + ArrayList tips = new ArrayList<>(); for (VirtualFile file : choose) { TipAndTrickBean tip = new TipAndTrickBean(); tip.fileName = file.getPath(); diff --git a/platform/platform-impl/src/com/intellij/internal/cachedValueProfiler/CVPReader.java b/platform/platform-impl/src/com/intellij/internal/cachedValueProfiler/CVPReader.java index 76eec7b1abd9..1a02658be08c 100644 --- a/platform/platform-impl/src/com/intellij/internal/cachedValueProfiler/CVPReader.java +++ b/platform/platform-impl/src/com/intellij/internal/cachedValueProfiler/CVPReader.java @@ -2,7 +2,6 @@ package com.intellij.internal.cachedValueProfiler; import com.google.gson.stream.JsonReader; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -28,7 +27,7 @@ public class CVPReader { @NotNull private List read() throws IOException { - ArrayList list = ContainerUtil.newArrayList(); + ArrayList list = new ArrayList<>(); myReader.beginArray(); while (myReader.hasNext()) { list.add(readInfo()); diff --git a/platform/platform-impl/src/com/intellij/internal/cachedValueProfiler/CachedValueProfilerDumper.java b/platform/platform-impl/src/com/intellij/internal/cachedValueProfiler/CachedValueProfilerDumper.java index 73aa5014332b..679ec3c8278d 100644 --- a/platform/platform-impl/src/com/intellij/internal/cachedValueProfiler/CachedValueProfilerDumper.java +++ b/platform/platform-impl/src/com/intellij/internal/cachedValueProfiler/CachedValueProfilerDumper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.internal.cachedValueProfiler; import com.google.gson.stream.JsonWriter; @@ -16,10 +16,7 @@ import java.io.IOException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; +import java.util.*; import static java.time.temporal.ChronoField.*; @@ -51,7 +48,7 @@ public class CachedValueProfilerDumper { @NotNull private List prepareInfo() { - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); myStorage.entrySet().forEach((entry) -> list.add(new TotalInfo(entry.getKey(), entry.getValue()))); Collections.sort(list, Comparator.comparing(info -> ((double)info.getTotalUseCount()) / info.getInfos().size())); diff --git a/platform/platform-impl/src/com/intellij/internal/inspector/UiDropperAction.java b/platform/platform-impl/src/com/intellij/internal/inspector/UiDropperAction.java index 8cc08dac2f67..174f5bde0aed 100644 --- a/platform/platform-impl/src/com/intellij/internal/inspector/UiDropperAction.java +++ b/platform/platform-impl/src/com/intellij/internal/inspector/UiDropperAction.java @@ -829,7 +829,7 @@ public class UiDropperAction extends ToggleAction implements DumbAware { ); final Component myComponent; - final List myProperties = ContainerUtil.newArrayList(); + final List myProperties = new ArrayList<>(); InspectorTableModel(@NotNull Component c) { myComponent = c; diff --git a/platform/platform-impl/src/com/intellij/internal/inspector/UiInspectorAction.java b/platform/platform-impl/src/com/intellij/internal/inspector/UiInspectorAction.java index 300cc90d0fa4..500fefa9dd97 100644 --- a/platform/platform-impl/src/com/intellij/internal/inspector/UiInspectorAction.java +++ b/platform/platform-impl/src/com/intellij/internal/inspector/UiInspectorAction.java @@ -44,7 +44,6 @@ import com.intellij.util.ExceptionUtil; import com.intellij.util.Function; import com.intellij.util.ObjectUtils; import com.intellij.util.ReflectionUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.*; import com.intellij.util.ui.tree.TreeUtil; import net.miginfocom.layout.*; @@ -1165,7 +1164,7 @@ public class UiInspectorAction extends ToggleAction implements DumbAware { ); final Component myComponent; - final List myProperties = ContainerUtil.newArrayList(); + final List myProperties = new ArrayList<>(); InspectorTableModel(@NotNull List clickInfo) { myComponent = null; diff --git a/platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java b/platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java index 1565bb842a34..e32dbb9ca35f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java @@ -155,7 +155,7 @@ public class ConfigImportHelper { if (!homes.contains(configHome)) homes.add(configHome); } - List candidates = ContainerUtil.newArrayList(); + List candidates = new ArrayList<>(); for (Path dir : homes) { if (dir == null || !Files.isDirectory(dir)) continue; diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeImpl.java index 7e2a9951c0e0..8f6e021924c8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.fileChooser.ex; import com.intellij.ide.util.treeView.AbstractTreeBuilder; @@ -437,7 +437,7 @@ public class FileSystemTreeImpl implements FileSystemTree { final TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) return VirtualFile.EMPTY_ARRAY; - final List files = ContainerUtil.newArrayList(); + final List files = new ArrayList<>(); for (TreePath path : paths) { VirtualFile file = getVirtualFile(path); if (file != null && file.isValid()) { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java index 7dbae02959c8..9f6bb9572682 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableExtensionPointUtil.java @@ -35,7 +35,7 @@ public class ConfigurableExtensionPointUtil { public static List buildConfigurablesList(@NotNull List> extensions, @Nullable ConfigurableFilter filter) { final List result = new ArrayList<>(); final Map idToConfigurable = new HashMap<>(); - List idsInEpOrder = ContainerUtil.newArrayList(); + List idsInEpOrder = new ArrayList<>(); for (ConfigurableEP ep : extensions) { final Configurable configurable = ConfigurableWrapper.wrapConfigurable(ep); if (isSuppressed(configurable, filter)) continue; @@ -106,7 +106,7 @@ public class ConfigurableExtensionPointUtil { } List children = tree.get(parentId); if (children == null) { - children = ContainerUtil.newArrayListWithCapacity(5); + children = new ArrayList<>(5); tree.put(parentId, children); } children.add(id); @@ -315,11 +315,12 @@ public class ConfigurableExtensionPointUtil { private static List getConfigurables(Map> tree, Node node) { if (node.myChildren == null) { if (node.myValue == null) { - return ContainerUtil.newArrayList(); // for group only + // for group only + return new ArrayList<>(); } return null; } - List list = ContainerUtil.newArrayListWithCapacity(node.myChildren.size()); + List list = new ArrayList<>(node.myChildren.size()); for (Iterator iterator = node.myChildren.iterator(); iterator.hasNext(); iterator.remove()) { Object child = iterator.next(); if (child instanceof Configurable) { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/SortedConfigurableGroup.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/SortedConfigurableGroup.java index 7ff0237727ef..3ec28bfca738 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/SortedConfigurableGroup.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/SortedConfigurableGroup.java @@ -1,28 +1,14 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.options.ex; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurableGroup; import com.intellij.openapi.options.SearchableConfigurable; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -38,7 +24,7 @@ public final class SortedConfigurableGroup private final String myHelpTopic; int myWeight; // see ConfigurableExtensionPointUtil.getConfigurableToReplace - List myList = ContainerUtil.newArrayList(); + List myList = new ArrayList<>(); SortedConfigurableGroup(String id, String displayName, String helpTopic, int weight) { myId = id; diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java index b51303c9323a..fa8537637056 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java @@ -142,7 +142,7 @@ class UpdateInfoDialog extends AbstractUpdateDialog { @NotNull @Override protected Action[] createActions() { - List actions = ContainerUtil.newArrayList(); + List actions = new ArrayList<>(); if (myPatches != null || myTestPatch != null) { boolean canRestart = ApplicationManager.getApplication().isRestartCapable(); diff --git a/platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/HandleType.java b/platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/HandleType.java index a49d77423728..dbf3786b3387 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/HandleType.java +++ b/platform/platform-impl/src/com/intellij/openapi/vcs/readOnlyHandler/HandleType.java @@ -1,29 +1,15 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.readOnlyHandler; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.vcs.VcsBundle; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.RefreshQueue; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.io.ReadOnlyAttributeUtil; import org.jetbrains.annotations.Nullable; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -36,7 +22,7 @@ public abstract class HandleType { @Override public void processFiles(final Collection files, String changelist) { ApplicationManager.getApplication().runWriteAction(() -> { - List toRefresh = ContainerUtil.newArrayListWithCapacity(files.size()); + List toRefresh = new ArrayList<>(files.size()); for (VirtualFile file : files) { try { @@ -89,11 +75,11 @@ public abstract class HandleType { } public abstract void processFiles(final Collection virtualFiles, @Nullable String changelist); - + public List getChangelists() { return Collections.emptyList(); } - + @Nullable public String getDefaultChangelist() { return null; diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java index 56a7111b84e3..0adc9d184c76 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/jar/JarHandler.java @@ -20,7 +20,6 @@ import com.intellij.openapi.vfs.impl.ZipHandler; import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; import com.intellij.openapi.vfs.newvfs.persistent.FlushingDaemon; import com.intellij.util.CommonProcessors; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import com.intellij.util.io.*; import gnu.trove.THashSet; @@ -31,10 +30,7 @@ import java.io.DataOutputStream; import java.io.*; import java.nio.charset.Charset; import java.security.MessageDigest; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.zip.ZipFile; import static com.intellij.util.ObjectUtils.assertNotNull; @@ -355,8 +351,8 @@ public class JarHandler extends ZipHandler { } }))); - final List invalidLibraryFilePaths = ContainerUtil.newArrayList(); - final List allLibraryFilePaths = ContainerUtil.newArrayList(); + final List invalidLibraryFilePaths = new ArrayList<>(); + final List allLibraryFilePaths = new ArrayList<>(); MultiMap jarSnapshotFileToLibraryFilePaths = new MultiMap<>(); Set validLibraryFilePathToJarSnapshotFilePaths = new THashSet<>(); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java index d2c88771817c..210d3b469895 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java @@ -20,7 +20,6 @@ import com.intellij.openapi.vfs.local.FileWatcherNotificationSink; import com.intellij.openapi.vfs.local.PluggableFileWatcher; import com.intellij.openapi.vfs.newvfs.ManagingFS; import com.intellij.util.TimeoutUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.io.BaseDataReader; import com.intellij.util.io.BaseOutputReader; import com.sun.jna.Platform; @@ -269,7 +268,7 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher { private class MyProcessHandler extends OSProcessHandler { private final BufferedWriter myWriter; private WatcherOp myLastOp; - private final List myLines = ContainerUtil.newArrayList(); + private final List myLines = new ArrayList<>(); private MyProcessHandler(@NotNull Process process, @NotNull String commandLine) { super(process, commandLine, CHARSET); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowShadowPainter.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowShadowPainter.java index aadd3176f3d1..39346357ec5f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowShadowPainter.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/WindowShadowPainter.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.wm.impl; import com.intellij.openapi.ui.AbstractPainter; @@ -22,12 +8,12 @@ import com.intellij.util.ui.UIUtil; import javax.swing.*; import java.awt.*; import java.awt.event.AWTEventListener; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; import static com.intellij.icons.AllIcons.Ide.Shadow.*; -import static com.intellij.util.containers.ContainerUtil.newArrayList; /** * @author Sergey.Malenkov @@ -98,7 +84,7 @@ final class WindowShadowPainter extends AbstractPainter { for (Window window : windows) { Rectangle bounds = getShadowBounds(point, window); if (bounds != null) { - if (list == null) list = newArrayList(); + if (list == null) list = new ArrayList<>(); list.add(bounds); } list = getShadows(list, point, window.getOwnedWindows()); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/TabContentLayout.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/TabContentLayout.java index a564790f6796..8ef7230ad6e0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/TabContentLayout.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/TabContentLayout.java @@ -45,7 +45,7 @@ class TabContentLayout extends ContentLayout { return myLastLayout.moreRect; } }; - List myDoubleClickActions = ContainerUtil.newArrayList(); + List myDoubleClickActions = new ArrayList<>(); TabContentLayout(ToolWindowContentUi ui) { super(ui); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java index bf7e81ae39f6..1e09ab3f79a8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/content/ToolWindowContentUi.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.wm.impl.content; import com.intellij.ide.IdeEventQueue; @@ -26,7 +26,6 @@ import com.intellij.ui.content.tabs.PinToolwindowTabAction; import com.intellij.ui.content.tabs.TabbedContentAction; import com.intellij.util.Alarm; import com.intellij.util.ContentUtilEx; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.EmptyIterator; import com.intellij.util.containers.JBIterable; import com.intellij.util.containers.Predicate; @@ -545,7 +544,7 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh final Content selectedContent = manager.getSelectedContent(); final List> tabs = new ArrayList<>(); int selectedTab = -1; - List mergedContent = ContainerUtil.newArrayList(); + List mergedContent = new ArrayList<>(); for (Content content : manager.getContents()) { if (tabPrefix.equals(content.getUserData(Content.TAB_GROUP_NAME_KEY))) { final String label = content.getTabName().substring(tabPrefix.length() + 2); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java index e158f9bbd3de..2af22cbb293f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/FlatWelcomeFrame.java @@ -44,7 +44,6 @@ import com.intellij.ui.mac.TouchbarDataKeys; import com.intellij.ui.popup.PopupFactoryImpl; import com.intellij.ui.popup.list.GroupedItemsListRenderer; import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.MouseEventAdapter; @@ -1077,7 +1076,7 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac } private static List flattenActionGroups(@NotNull final ActionGroup action) { - final ArrayList groups = ContainerUtil.newArrayList(); + final ArrayList groups = new ArrayList<>(); String groupName; for (AnAction anAction : action.getChildren(null)) { if (anAction instanceof ActionGroup) { diff --git a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java index c8923ddc77ea..f93f657f233c 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java +++ b/platform/platform-impl/src/com/intellij/util/ui/SwingHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui; import com.intellij.ide.BrowserUtil; @@ -341,7 +341,7 @@ public class SwingHelper { boolean mergeWithPrevHistory) { Set newHistorySet = new HashSet<>(history); List prevHistory = textFieldWithHistory.getHistory(); - List mergedHistory = ContainerUtil.newArrayListWithCapacity(history.size()); + List mergedHistory = new ArrayList<>(history.size()); if (mergeWithPrevHistory) { for (String item : prevHistory) { if (!newHistorySet.contains(item)) { diff --git a/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ReformatOnlyVcsChangedTextTest.java b/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ReformatOnlyVcsChangedTextTest.java index c98e7fcddaee..c546788d1f86 100644 --- a/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ReformatOnlyVcsChangedTextTest.java +++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ReformatOnlyVcsChangedTextTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.actions; import com.intellij.lang.LanguageFormatting; @@ -37,11 +23,11 @@ import com.intellij.testFramework.LightPlatformTestCase; import com.intellij.testFramework.TestActionEvent; import com.intellij.testFramework.vcs.MockChangeListManager; import com.intellij.testFramework.vcs.MockVcsContextFactory; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.picocontainer.MutablePicoContainer; +import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; @@ -96,7 +82,7 @@ public class ReformatOnlyVcsChangedTextTest extends LightPlatformTestCase { LanguageFormatting.INSTANCE.addExplicitExtension(PlainTextLanguage.INSTANCE, new MockPlainTextFormattingModelBuilder(), getTestRootDisposable()); - + myMockPlainTextImportOptimizer = new MockPlainTextImportOptimizer(); LanguageImportStatements.INSTANCE.addExplicitExtension(PlainTextLanguage.INSTANCE, myMockPlainTextImportOptimizer, getTestRootDisposable()); } @@ -320,7 +306,7 @@ public class ReformatOnlyVcsChangedTextTest extends LightPlatformTestCase { finally { OptimizeImportsAction.setProcessVcsChangedFilesInTests(false); } - + assertTrue(isImportsOptimized(toModify)); assertTrue(isImportsOptimized(toModify2)); assertTrue(!isImportsOptimized(toKeep)); @@ -369,7 +355,7 @@ public class ReformatOnlyVcsChangedTextTest extends LightPlatformTestCase { assertTrue(getErrorMessage(expected, formatted), Arrays.equals(expected, formatted)); } - + private boolean isImportsOptimized(@NotNull PsiFile file) { return myMockPlainTextImportOptimizer.getProcessedFiles().contains(file); } @@ -413,7 +399,7 @@ public class ReformatOnlyVcsChangedTextTest extends LightPlatformTestCase { @NotNull private List createChanges(@NotNull String committed, @NotNull PsiFile... files) { - List changes = ContainerUtil.newArrayList(); + List changes = new ArrayList<>(); for (PsiFile file : files) { changes.add(createChange(committed, file)); } diff --git a/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java b/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java index c5faf3b9f375..9639cd0c24b3 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/process/AnsiEscapeDecoderTest.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.process; import com.intellij.openapi.util.Key; @@ -197,7 +198,7 @@ public class AnsiEscapeDecoderTest extends LightPlatformTestCase { private static void check(boolean testCharByCharProcessing, @NotNull List texts) { AnsiEscapeDecoder decoder = new AnsiEscapeDecoder(); - List> actualColoredChunks = ContainerUtil.newArrayList(); + List> actualColoredChunks = new ArrayList<>(); AnsiEscapeDecoder.ColoredTextAcceptor acceptor = (text, attributes) -> actualColoredChunks.add(Pair.create(text, StringUtil.trimStart(attributes.toString(), "\u001b[0;"))); for (ColoredText text : texts) { diff --git a/platform/platform-tests/testSrc/com/intellij/ide/codeStyleSettings/CodeSamplesCorrectnessTest.java b/platform/platform-tests/testSrc/com/intellij/ide/codeStyleSettings/CodeSamplesCorrectnessTest.java index dd761d1c81c6..1f24f1d9d226 100644 --- a/platform/platform-tests/testSrc/com/intellij/ide/codeStyleSettings/CodeSamplesCorrectnessTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ide/codeStyleSettings/CodeSamplesCorrectnessTest.java @@ -9,14 +9,10 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.junit.Assert; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import static com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider.SettingsType; @@ -27,7 +23,7 @@ public class CodeSamplesCorrectnessTest extends LightPlatformCodeInsightFixtureT @Override public void setUp() throws Exception { super.setUp(); - myErrorReports = ContainerUtil.newArrayList(); + myErrorReports = new ArrayList<>(); mySettingValues = SettingsType.values(); } @@ -69,7 +65,7 @@ public class CodeSamplesCorrectnessTest extends LightPlatformCodeInsightFixtureT private List getSamplesToTest(@NotNull LanguageCodeStyleSettingsProvider provider) { Set processedSamples = new HashSet<>(); - List sampleInfos = ContainerUtil.newArrayList(); + List sampleInfos = new ArrayList<>(); for (SettingsType setting : mySettingValues) { String sample = provider.getCodeSample(setting); @@ -90,7 +86,7 @@ public class CodeSamplesCorrectnessTest extends LightPlatformCodeInsightFixtureT if (file == null) { Language language = provider.getLanguage(); LanguageFileType type = language.getAssociatedFileType(); - if (type == null) return ContainerUtil.newArrayList(); + if (type == null) return new ArrayList<>(); file = myFixture.configureByText(type, sample); } diff --git a/platform/platform-tests/testSrc/com/intellij/ide/settings/ConfigurableExtensionPointUtilTest.java b/platform/platform-tests/testSrc/com/intellij/ide/settings/ConfigurableExtensionPointUtilTest.java index 1799a0ea00fa..6b2944ff10ea 100644 --- a/platform/platform-tests/testSrc/com/intellij/ide/settings/ConfigurableExtensionPointUtilTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ide/settings/ConfigurableExtensionPointUtilTest.java @@ -476,7 +476,7 @@ public class ConfigurableExtensionPointUtilTest extends LightPlatformTestCase { private static List build(Configurable... configurables) { Map> map = ConfigurableExtensionPointUtil.groupConfigurables(Arrays.asList(configurables)); - List children = ContainerUtil.newArrayList(); + List children = new ArrayList<>(); for (Map.Entry> entry : new TreeMap<>(map).entrySet()) { children.add(node(entry.getKey(), entry.getValue())); } @@ -503,7 +503,7 @@ public class ConfigurableExtensionPointUtilTest extends LightPlatformTestCase { } private static Node node(String id, List configurables) { - List children = ContainerUtil.newArrayList(); + List children = new ArrayList<>(); for (Configurable configurable : configurables) { children.add(node(configurable)); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/impl/FileNameCacheMicroBenchmark.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/impl/FileNameCacheMicroBenchmark.java index 3bf268434950..29254c3419fb 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/impl/FileNameCacheMicroBenchmark.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/newvfs/impl/FileNameCacheMicroBenchmark.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vfs.newvfs.impl; import com.intellij.openapi.application.ApplicationManager; @@ -20,13 +6,13 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.testFramework.LightProjectDescriptor; import com.intellij.testFramework.fixtures.IdeaTestFixture; import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.TIntObjectHashMap; import gnu.trove.TLongArrayList; import org.jetbrains.annotations.NotNull; import org.junit.Assert; import javax.swing.*; +import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.ExecutionException; @@ -191,7 +177,7 @@ public class FileNameCacheMicroBenchmark { private static long runThreads(final int[] ids, int threadCount, final int queryCount, final TestIteration testIteration) throws InterruptedException, ExecutionException { long start = System.currentTimeMillis(); - List> futures = ContainerUtil.newArrayList(); + List> futures = new ArrayList<>(); Random seedRandom = new Random(); for (int i = 0; i < threadCount; i++) { final Random threadRandom = new Random(seedRandom.nextInt()); diff --git a/platform/platform-tests/testSrc/com/intellij/util/containers/TreeTraverserTest.java b/platform/platform-tests/testSrc/com/intellij/util/containers/TreeTraverserTest.java index 6eac4a46dd93..a3e2e763f994 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/containers/TreeTraverserTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/containers/TreeTraverserTest.java @@ -169,7 +169,7 @@ public class TreeTraverserTest extends TestCase { } public void testCursorIterableContract() { - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); JBIterable orig = JBIterable.generate(1, INCREMENT).take(5); for (JBIterator it : JBIterator.cursor(JBIterator.from(orig.iterator()))) { it.current(); @@ -183,7 +183,7 @@ public class TreeTraverserTest extends TestCase { JBIterable orig = JBIterable.generate(1, INCREMENT).take(5); JBIterator> it = JBIterator.from(JBIterator.cursor( JBIterator.from(orig.iterator())).iterator()); - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); while (it.advance()) { it.hasNext(); list.add(it.current().current()); @@ -691,7 +691,7 @@ public class TreeTraverserTest extends TestCase { @NotNull public List simpleTraverseExpand(TreeTraversal traversal) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); JBIterable> iter = traversal.traversal((Function, Iterable>>)integers -> JBIterable.from(integers).skip(1).transform(WRAP_TO_LIST)).fun(ContainerUtil.newArrayList(1)); for (List integers : iter) { @@ -705,7 +705,7 @@ public class TreeTraverserTest extends TestCase { } public void testTracingBfsLaziness() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); TreeTraversal.TracingIt> it = TreeTraversal.TRACING_BFS.traversal((Function, Iterable>>)integers -> JBIterable.from(integers).skip(1).transform(WRAP_TO_LIST)).fun(ContainerUtil.newArrayList(1)).typedIterator(); while (it.advance()) { diff --git a/platform/platform-tests/testSrc/com/intellij/util/ui/update/MergingUpdateQueueTest.java b/platform/platform-tests/testSrc/com/intellij/util/ui/update/MergingUpdateQueueTest.java index 1c38b4e54c2d..04b90c97e6c7 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/ui/update/MergingUpdateQueueTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/ui/update/MergingUpdateQueueTest.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui.update; import com.intellij.concurrency.JobScheduler; @@ -23,9 +9,9 @@ import com.intellij.util.ExceptionUtil; import com.intellij.util.TimeoutUtil; import com.intellij.util.WaitFor; import com.intellij.util.concurrency.AppExecutorUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; @@ -371,7 +357,7 @@ public class MergingUpdateQueueTest extends UsefulTestCase { final AtomicInteger count = new AtomicInteger(); ScheduledExecutorService executor = JobScheduler.getScheduler(); - List futures = ContainerUtil.newArrayList(); + List futures = new ArrayList<>(); for (int i = 0; i < 10; i++) { ScheduledFuture future = executor.schedule(() -> { for (int j = 0; j < 100; j++) { diff --git a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/runner/SMTestProxyTest.java b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/runner/SMTestProxyTest.java index b9aff9a6292a..7273a1cce6f0 100644 --- a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/runner/SMTestProxyTest.java +++ b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/runner/SMTestProxyTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.testframework.sm.runner; import com.intellij.execution.Location; @@ -32,6 +18,7 @@ import com.intellij.util.containers.ContainerUtil; import org.easymock.EasyMock; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -1087,7 +1074,7 @@ public class SMTestProxyTest extends BaseSMTRunnerTestCase { public static final String TEST_LOCATION_TEXT = ""; private final Location myLocation; - private final List myCalledSearchScopes = ContainerUtil.newArrayList(); + private final List myCalledSearchScopes = new ArrayList<>(); MockTestLocator(@NotNull Location location) { myLocation = location; diff --git a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java index d7c2d7b66fba..d7e28e85f3bb 100644 --- a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.testFramework; import com.intellij.ide.DataManager; @@ -230,8 +230,8 @@ public class EditorTestUtil { } public static void setEditorVisibleSize(Editor editor, int widthInChars, int heightInChars) { - setEditorVisibleSizeInPixels(editor, - widthInChars * EditorUtil.getSpaceWidth(Font.PLAIN, editor), + setEditorVisibleSizeInPixels(editor, + widthInChars * EditorUtil.getSpaceWidth(Font.PLAIN, editor), heightInChars * editor.getLineHeight()); } @@ -263,7 +263,7 @@ public class EditorTestUtil { @NotNull public static CaretAndSelectionState extractCaretAndSelectionMarkersImpl(@NotNull Document document, boolean processBlockSelection) { - List carets = ContainerUtil.newArrayList(); + List carets = new ArrayList<>(); String fileText = document.getText(); RangeMarker blockSelectionStartMarker = null; diff --git a/platform/testRunner/src/com/intellij/execution/testframework/autotest/AbstractAutoTestManager.java b/platform/testRunner/src/com/intellij/execution/testframework/autotest/AbstractAutoTestManager.java index 1bf6498ab57c..599cca6bc38c 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/autotest/AbstractAutoTestManager.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/autotest/AbstractAutoTestManager.java @@ -32,6 +32,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -85,7 +86,7 @@ public abstract class AbstractAutoTestManager implements PersistentStateComponen } public static List loadConfigurations(State state, Project project) { - List configurations = ContainerUtil.newArrayList(); + List configurations = new ArrayList<>(); RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project); List descriptors = ContainerUtil.notNullize(state.myEnabledRunConfigurations); for (RunConfigurationDescriptor descriptor : descriptors) { @@ -233,7 +234,7 @@ public abstract class AbstractAutoTestManager implements PersistentStateComponen public static class State { @Tag("enabled-run-configurations") @XCollection - List myEnabledRunConfigurations = ContainerUtil.newArrayList(); + List myEnabledRunConfigurations = new ArrayList<>(); } @Tag("run-configuration") diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageGroupingRuleProviderImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageGroupingRuleProviderImpl.java index 229756b6bd55..1fd41ed48225 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageGroupingRuleProviderImpl.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageGroupingRuleProviderImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.usages.impl; import com.intellij.icons.AllIcons; @@ -92,7 +92,7 @@ public class UsageGroupingRuleProviderImpl implements UsageGroupingRuleProvider GroupByPackageAction groupByPackageAction = new GroupByPackageAction(impl); groupByPackageAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK)), component, impl); - ArrayList result = ContainerUtil.newArrayList(); + ArrayList result = new ArrayList<>(); if (view.getPresentation().isUsageTypeFilteringAvailable()) { GroupByUsageTypeAction groupByUsageTypeAction = new GroupByUsageTypeAction(impl); diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java index 031050c2c7e6..1b6ff391247f 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java @@ -1823,7 +1823,7 @@ public class UsageViewImpl implements UsageViewEx { public Collection getTextLinesToCopy() { final Node[] selectedNodes = getSelectedNodes(); if (selectedNodes != null && selectedNodes.length > 0) { - ArrayList lines = ContainerUtil.newArrayList(); + ArrayList lines = new ArrayList<>(); for (Node node : selectedNodes) { lines.add(node.getText(UsageViewImpl.this)); } diff --git a/platform/util/src/com/intellij/execution/CommandLineUtil.java b/platform/util/src/com/intellij/execution/CommandLineUtil.java index cf1575d801d1..0b19dbc0b2ac 100644 --- a/platform/util/src/com/intellij/execution/CommandLineUtil.java +++ b/platform/util/src/com/intellij/execution/CommandLineUtil.java @@ -8,6 +8,7 @@ import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import java.io.File; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; @@ -45,7 +46,7 @@ public class CommandLineUtil { // please keep an implementation in sync with [junit-rt] ProcessBuilder.createProcess() @NotNull public static List toCommandLine(@NotNull String command, @NotNull List parameters, @NotNull Platform platform) { - List commandLine = ContainerUtil.newArrayListWithCapacity(parameters.size() + 1); + List commandLine = new ArrayList<>(parameters.size() + 1); commandLine.add(FileUtilRt.toSystemDependentName(command, platform.fileSeparator)); diff --git a/platform/util/src/com/intellij/openapi/util/JDOMExternalizerUtil.java b/platform/util/src/com/intellij/openapi/util/JDOMExternalizerUtil.java index cf94a7e1cc3e..f6772d808529 100644 --- a/platform/util/src/com/intellij/openapi/util/JDOMExternalizerUtil.java +++ b/platform/util/src/com/intellij/openapi/util/JDOMExternalizerUtil.java @@ -1,12 +1,12 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.util; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.Constants; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -95,7 +95,7 @@ public class JDOMExternalizerUtil { String value = children.iterator().next().getAttributeValue(Constants.VALUE); return value == null ? Collections.emptyList() : Collections.singletonList(value); } - List values = ContainerUtil.newArrayListWithCapacity(children.size()); + List values = new ArrayList<>(children.size()); for (Element child : children) { String value = child.getAttributeValue(Constants.VALUE); if (value != null) { diff --git a/platform/util/src/com/intellij/openapi/util/text/Pluralizer.java b/platform/util/src/com/intellij/openapi/util/text/Pluralizer.java index 1064b617cdea..7ddb83c421cd 100644 --- a/platform/util/src/com/intellij/openapi/util/text/Pluralizer.java +++ b/platform/util/src/com/intellij/openapi/util/text/Pluralizer.java @@ -32,6 +32,7 @@ import com.intellij.util.text.CaseInsensitiveStringHashingStrategy; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; @@ -60,8 +61,8 @@ class Pluralizer { private final Map irregularSingles = ContainerUtil.newTroveMap(CaseInsensitiveStringHashingStrategy.INSTANCE); private final Map irregularPlurals = ContainerUtil.newTroveMap(CaseInsensitiveStringHashingStrategy.INSTANCE); private final Set uncountables = ContainerUtil.newTroveSet(CaseInsensitiveStringHashingStrategy.INSTANCE); - private final List> pluralRules = ContainerUtil.newArrayList(); - private final List> singularRules = ContainerUtil.newArrayList(); + private final List> pluralRules = new ArrayList<>(); + private final List> singularRules = new ArrayList<>(); /** * Pass in a word token to produce a function that can replicate the case on @@ -182,8 +183,8 @@ class Pluralizer { } static { - final Pluralizer pluralizer = new Pluralizer(); - + final Pluralizer pluralizer = new Pluralizer(); + /* * Irregular rules. */ diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java index 27e68cdad6bf..ee3f27326adf 100644 --- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java +++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java @@ -2755,7 +2755,7 @@ public class StringUtil extends StringUtilRt { @NotNull @Contract(pure = true) public static List> getWordsWithOffset(@NotNull String s) { - List> res = ContainerUtil.newArrayList(); + List> res = new ArrayList<>(); s += " "; StringBuilder name = new StringBuilder(); int startInd = -1; diff --git a/platform/util/src/com/intellij/util/AbstractPathMapper.java b/platform/util/src/com/intellij/util/AbstractPathMapper.java index 70cb9a206359..7c9819873078 100644 --- a/platform/util/src/com/intellij/util/AbstractPathMapper.java +++ b/platform/util/src/com/intellij/util/AbstractPathMapper.java @@ -1,24 +1,10 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -61,7 +47,7 @@ public abstract class AbstractPathMapper implements PathMapper { @NotNull @Override public final List convertToRemote(@NotNull Collection paths) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (String p : paths) { result.add(convertToRemote(p)); } diff --git a/platform/util/src/com/intellij/util/PathMappingSettings.java b/platform/util/src/com/intellij/util/PathMappingSettings.java index 8122135993ce..6917b85dbda5 100644 --- a/platform/util/src/com/intellij/util/PathMappingSettings.java +++ b/platform/util/src/com/intellij/util/PathMappingSettings.java @@ -1,24 +1,9 @@ -/* - * Copyright 2000-2013 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.XmlSerializer; import com.intellij.util.xmlb.annotations.Attribute; import com.intellij.util.xmlb.annotations.Tag; @@ -27,10 +12,7 @@ import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * @author traff @@ -46,7 +28,7 @@ public class PathMappingSettings extends AbstractPathMapper implements Cloneable @NotNull private static List create(@Nullable final List mappings) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); if (mappings != null) { for (PathMapping m : mappings) { if (m != null && !isAnyEmpty(m.getLocalRoot(), m.getRemoteRoot())) { @@ -58,7 +40,7 @@ public class PathMappingSettings extends AbstractPathMapper implements Cloneable } public PathMappingSettings() { - myPathMappings = ContainerUtil.newArrayList(); + myPathMappings = new ArrayList<>(); } @NotNull diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java index 9954b2d6ecb1..1f674b0ee5da 100644 --- a/platform/util/src/com/intellij/util/ReflectionUtil.java +++ b/platform/util/src/com/intellij/util/ReflectionUtil.java @@ -13,10 +13,7 @@ import org.jetbrains.annotations.Nullable; import java.lang.annotation.Annotation; import java.lang.reflect.*; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Set; +import java.util.*; public class ReflectionUtil { private static final Logger LOG = Logger.getInstance("#com.intellij.util.ReflectionUtil"); @@ -125,7 +122,7 @@ public class ReflectionUtil { @NotNull public static List collectFields(@NotNull Class clazz) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (Class c : classTraverser(clazz)) { ContainerUtil.addAll(result, c.getDeclaredFields()); } @@ -283,7 +280,7 @@ public class ReflectionUtil { @NotNull private static List filterRealMethods(@NotNull Method[] methods) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (Method method : methods) { if (!method.isSynthetic()) { result.add(method); diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java index 868412962737..0083ff7df626 100644 --- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java +++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java @@ -182,8 +182,12 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newLinkedList(elements); } + /** + * @deprecated Use {@link ArrayList#ArrayList()} + */ @NotNull @Contract(pure=true) + @Deprecated public static ArrayList newArrayList() { return new ArrayList<>(); } @@ -201,8 +205,12 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newArrayList(iterable); } + /** + * @deprecated Use {@link ArrayList#ArrayList(int)} + */ @NotNull @Contract(pure=true) + @Deprecated public static ArrayList newArrayListWithCapacity(int size) { return new ArrayList<>(size); } diff --git a/platform/util/src/com/intellij/util/text/TextRanges.java b/platform/util/src/com/intellij/util/text/TextRanges.java index bf2403a04693..01712e6d871a 100644 --- a/platform/util/src/com/intellij/util/text/TextRanges.java +++ b/platform/util/src/com/intellij/util/text/TextRanges.java @@ -1,24 +1,9 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.text; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.TextRange; import com.intellij.util.UnmodifiableIterator; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -26,7 +11,7 @@ import java.util.*; public class TextRanges implements Iterable { private static final Comparator START_COMP = (o1, o2) -> Comparing.compare(o1.getStartOffset(), o2.getStartOffset()); private static final Comparator END_COMP = (o1, o2) -> Comparing.compare(o1.getEndOffset(), o2.getEndOffset()); - private final List myRanges = ContainerUtil.newArrayList(); + private final List myRanges = new ArrayList<>(); public TextRanges union(@Nullable TextRange range) { if (range == null || range.isEmpty()) return this; diff --git a/platform/util/testSrc/com/intellij/util/keyFMap/KeyFMapTest.java b/platform/util/testSrc/com/intellij/util/keyFMap/KeyFMapTest.java index 46b034b50a3a..5912e23eea7a 100644 --- a/platform/util/testSrc/com/intellij/util/keyFMap/KeyFMapTest.java +++ b/platform/util/testSrc/com/intellij/util/keyFMap/KeyFMapTest.java @@ -1,23 +1,8 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.keyFMap; import com.intellij.openapi.util.Key; import com.intellij.util.ArrayUtil; -import com.intellij.util.containers.ContainerUtil; import junit.framework.TestCase; import java.util.*; @@ -39,7 +24,7 @@ public class KeyFMapTest extends TestCase { } private static void doTestGetKeys(int size) { - List values = ContainerUtil.newArrayList(); + List values = new ArrayList<>(); for (int i = 0; i < size; i++) { values.add("Value#" + i); } diff --git a/platform/util/testSrc/com/intellij/util/lang/UrlClassLoaderTest.java b/platform/util/testSrc/com/intellij/util/lang/UrlClassLoaderTest.java index d70dd879c653..1341c4bb171c 100644 --- a/platform/util/testSrc/com/intellij/util/lang/UrlClassLoaderTest.java +++ b/platform/util/testSrc/com/intellij/util/lang/UrlClassLoaderTest.java @@ -1,30 +1,18 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.lang; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.util.*; -import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.ConcurrencyUtil; +import com.intellij.util.ObjectUtils; +import com.intellij.util.ThrowableConsumer; import org.junit.Test; import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; +import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Random; @@ -81,8 +69,8 @@ public class UrlClassLoaderTest { @Test public void testConcurrentResourceLoading() throws Exception { - List resourceNames = ContainerUtil.newArrayList(); - List urls = ContainerUtil.newArrayList(); + List resourceNames = new ArrayList<>(); + List urls = new ArrayList<>(); File[] libs = ObjectUtils.assertNotNull(new File(PathManager.getHomePathFor(UrlClassLoader.class) + "/lib").listFiles()); for (File file : libs) { @@ -109,12 +97,12 @@ public class UrlClassLoaderTest { for (int attempt = 0; attempt < attemptCount; attempt++) { // fails also without cache pool (but with cache enabled), but takes much longer UrlClassLoader loader = UrlClassLoader.build().urls(urls).parent(null).allowLock(true).useCache(pool, (url) -> true).get(); - List namesToLoad = ContainerUtil.newArrayList(); + List namesToLoad = new ArrayList<>(); for (int j = 0; j < resourceCount; j++) { namesToLoad.add(resourceNames.get(random.nextInt(resourceNames.size()))); } - List futures = ContainerUtil.newArrayList(); + List futures = new ArrayList<>(); for (int i = 0; i < threadCount; i++) { futures.add(executor.submit(() -> { for (String name : namesToLoad) { diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java index 55cd90c0f956..902a21101400 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs; import com.intellij.ide.todo.TodoPanelSettings; @@ -10,7 +10,6 @@ import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings; import com.intellij.util.PlatformUtils; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.XmlSerializerUtil; import com.intellij.util.xmlb.annotations.OptionTag; import com.intellij.util.xmlb.annotations.Property; @@ -76,7 +75,7 @@ public final class VcsConfiguration implements PersistentStateComponent IGNORED_UNREGISTERED_ROOTS = ContainerUtil.newArrayList(); + public List IGNORED_UNREGISTERED_ROOTS = new ArrayList<>(); public enum StandardOption { ADD(VcsBundle.message("vcs.command.name.add")), diff --git a/platform/vcs-impl/src/com/intellij/codeInsight/actions/VcsAwareFormatChangedTextUtil.java b/platform/vcs-impl/src/com/intellij/codeInsight/actions/VcsAwareFormatChangedTextUtil.java index e2d98b976e32..dff13d959bfa 100644 --- a/platform/vcs-impl/src/com/intellij/codeInsight/actions/VcsAwareFormatChangedTextUtil.java +++ b/platform/vcs-impl/src/com/intellij/codeInsight/actions/VcsAwareFormatChangedTextUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.actions; import com.intellij.openapi.application.ApplicationManager; @@ -21,6 +21,7 @@ import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.BitSet; import java.util.List; import java.util.function.Function; @@ -30,7 +31,7 @@ class VcsAwareFormatChangedTextUtil extends FormatChangedTextUtil { @NotNull public List getChangedTextRanges(@NotNull Project project, @NotNull PsiFile file) { ChangedRangesInfo helper = getChangedRangesInfo(file); - return helper != null ? helper.allChangedRanges : ContainerUtil.newArrayList(); + return helper != null ? helper.allChangedRanges : new ArrayList<>(); } @Override @@ -211,8 +212,8 @@ class VcsAwareFormatChangedTextUtil extends FormatChangedTextUtil { @NotNull private static ChangedRangesInfo getChangedTextRanges(@NotNull Document document, @NotNull List changedRanges) { - final List ranges = ContainerUtil.newArrayList(); - final List insertedRanges = ContainerUtil.newArrayList(); + final List ranges = new ArrayList<>(); + final List insertedRanges = new ArrayList<>(); for (Range range : changedRanges) { if (range.getType() != Range.DELETED) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java index 33f176e52f69..fa5eb3e2b122 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.diff.impl.patch.formove; import com.intellij.openapi.application.ApplicationManager; @@ -113,7 +113,7 @@ public class PathsVerifier { @CalledInAwt public List nonWriteActionPreCheck() { - List failedToApply = ContainerUtil.newArrayList(); + List failedToApply = new ArrayList<>(); myDelayedPrecheckContext = new DelayedPrecheckContext(myProject); for (FilePatch patch : myPatches) { final CheckPath checker = getChecker(patch); @@ -134,7 +134,7 @@ public class PathsVerifier { } public List execute() { - List failedPatches = ContainerUtil.newArrayList(); + List failedPatches = new ArrayList<>(); try { final List checkers = new ArrayList<>(myPatches.size()); for (FilePatch patch : myPatches) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeManagerImpl.java index c3ffbd32b723..20361e612908 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeManagerImpl.java @@ -270,7 +270,7 @@ public class VcsDirtyScopeManagerImpl extends VcsDirtyScopeManager implements Pr VcsInvalidated invalidated = calculateInvalidated(dirtBuilder); VcsInvalidated inProgress = calculateInvalidated(dirtBuilderInProgress); - Collection result = ContainerUtil.newArrayList(); + Collection result = new ArrayList<>(); for (FilePath fp : files) { if (invalidated.isFileDirty(fp) || inProgress.isFileDirty(fp)) { result.add(fp); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffContext.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffContext.java index 43cefb1777f7..dc311d1babed 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffContext.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ShowDiffContext.java @@ -9,10 +9,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class ShowDiffContext { @NotNull private final DiffDialogHints myDialogHints; @@ -54,12 +51,12 @@ public class ShowDiffContext { } public void addActions(@NotNull List action) { - if (myActions == null) myActions = ContainerUtil.newArrayList(); + if (myActions == null) myActions = new ArrayList<>(); myActions.addAll(action); } public void addAction(@NotNull AnAction action) { - if (myActions == null) myActions = ContainerUtil.newArrayList(); + if (myActions == null) myActions = new ArrayList<>(); myActions.add(action); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedListsSequencesZipper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedListsSequencesZipper.java index 9b48dd348d55..3856b7c98b3c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedListsSequencesZipper.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedListsSequencesZipper.java @@ -20,7 +20,7 @@ public class CommittedListsSequencesZipper { public CommittedListsSequencesZipper(@NotNull VcsCommittedListsZipper vcsPartner) { myVcsPartner = vcsPartner; - myInLocations = ContainerUtil.newArrayList(); + myInLocations = new ArrayList<>(); myInLists = new HashMap<>(); myComparator = (o1, o2) -> Comparing.compare(myVcsPartner.getNumber(o1), myVcsPartner.getNumber(o2)); } @@ -34,7 +34,7 @@ public class CommittedListsSequencesZipper { @NotNull public List execute() { Pair, List> groupingResult = myVcsPartner.groupLocations(myInLocations); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); result.addAll(ContainerUtil.flatten(collectChangeLists(groupingResult.getSecond()))); for (RepositoryLocationGroup group : groupingResult.getFirst()) { @@ -46,7 +46,7 @@ public class CommittedListsSequencesZipper { @NotNull private List> collectChangeLists(@NotNull List locations) { - List> result = ContainerUtil.newArrayListWithCapacity(locations.size()); + List> result = new ArrayList<>(locations.size()); for (RepositoryLocation location : locations) { result.add(myInLists.get(location.toPresentableString())); @@ -57,8 +57,8 @@ public class CommittedListsSequencesZipper { @NotNull private List mergeLocationGroupChangeLists(@NotNull RepositoryLocationGroup group) { - List result = ContainerUtil.newArrayList(); - List equalLists = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); + List equalLists = new ArrayList<>(); CommittedChangeList previousList = null; for (CommittedChangeList list : Iterables.mergeSorted(collectChangeLists(group.getLocations()), myComparator)) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java index 5bb81d7f3293..27e1664e6a77 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.committed; import com.intellij.openapi.diagnostic.Logger; @@ -27,13 +13,13 @@ import one.util.streamex.StreamEx; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import static com.intellij.openapi.util.text.StringUtil.join; import static com.intellij.util.containers.ContainerUtil.addAll; -import static com.intellij.util.containers.ContainerUtil.newArrayList; import static com.intellij.vcsUtil.VcsUtil.getFilePath; import static java.util.function.Function.identity; @@ -76,7 +62,7 @@ public class RootsCalculator { @NotNull private List getRootsFromMappings() { - List result = newArrayList(); + List result = new ArrayList<>(); for (VcsDirectoryMapping mapping : myPlManager.getDirectoryMappings(myVcs)) { if (mapping.isDefaultMapping()) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/SelectFilteringAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/SelectFilteringAction.java index a94be55828df..c9ae802fb703 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/SelectFilteringAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/SelectFilteringAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.committed; import com.intellij.openapi.actionSystem.AnAction; @@ -28,6 +14,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import javax.swing.*; +import java.util.ArrayList; import java.util.List; /** @@ -66,7 +53,7 @@ public class SelectFilteringAction extends LabeledComboBoxAction implements Dumb @NotNull private List collectStrategies() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); result.add(ChangeListFilteringStrategy.NONE); result.add(new StructureFilteringStrategy(myProject)); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/SelectGroupingAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/SelectGroupingAction.java index 4aaee88af9dd..b917ecbc70db 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/SelectGroupingAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/SelectGroupingAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.committed; import com.intellij.openapi.actionSystem.AnAction; @@ -29,6 +15,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import javax.swing.*; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -67,7 +54,7 @@ public class SelectGroupingAction extends LabeledComboBoxAction implements DumbA @NotNull private List collectStrategies() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); result.add(new DateChangeListGroupingStrategy()); result.add(ChangeListGroupingStrategy.USER); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/reference/IgnoreReferenceSet.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/reference/IgnoreReferenceSet.java index 5146df81d6aa..5dfbaba7fb00 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/reference/IgnoreReferenceSet.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/reference/IgnoreReferenceSet.java @@ -46,6 +46,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.SystemIndependent; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -147,7 +148,7 @@ public class IgnoreReferenceSet extends FileReferenceSet { protected void reparse() { ProgressManager.checkCanceled(); String str = StringUtil.trimEnd(getPathString(), getSeparatorString()); - List referencesList = ContainerUtil.newArrayList(); + List referencesList = new ArrayList<>(); String separatorString = getSeparatorString(); // separator's length can be more then 1 char int sepLen = separatorString.length(); @@ -238,7 +239,7 @@ public class IgnoreReferenceSet extends FileReferenceSet { VirtualFile root = parent != null ? parent.getVirtualFile() : null; PsiManager psiManager = getElement().getManager(); - List files = ContainerUtil.newArrayList(); + List files = new ArrayList<>(); files.addAll(myIgnorePatternsMatchedFilesCache.getFilesForPattern(pattern)); if (files.isEmpty()) { files.addAll(ContainerUtil.filter( diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/util/RegexUtil.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/util/RegexUtil.java index 04d6160c0fc5..6a2b50a8c24d 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/util/RegexUtil.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ignore/util/RegexUtil.java @@ -25,10 +25,10 @@ package com.intellij.openapi.vcs.changes.ignore.util; import com.intellij.util.ArrayUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; @@ -120,7 +120,7 @@ public class RegexUtil { return ArrayUtil.EMPTY_STRING_ARRAY; } - List parts = ContainerUtil.newArrayList(); + List parts = new ArrayList<>(); String sPattern = pattern.toString(); StringBuilder part = new StringBuilder(); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java index 637f374b5217..ed7528f71b03 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.patch; import com.intellij.diff.DiffDialogHints; @@ -325,7 +325,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper { @NotNull private List getOriginalRemaining() { Collection notIncluded = ContainerUtil.subtract(myPatches, getIncluded()); - List remainingOriginal = ContainerUtil.newArrayList(); + List remainingOriginal = new ArrayList<>(); for (AbstractFilePatchInProgress progress : notIncluded) { progress.reset(); remainingOriginal.add(progress.getPatch()); @@ -380,7 +380,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper { if (author != null) { myChangeListChooser.setData(new ChangeListData(author)); } - List filePatches = ContainerUtil.newArrayList(); + List filePatches = new ArrayList<>(); if (myReader != null) { filePatches.addAll(myReader.getAllPatches()); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java index 0dbbcd12cdcb..3931872602b0 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java @@ -338,7 +338,7 @@ public class ShelveChangesManager implements PersistentStateComponent, */ @NotNull public Collection checkAndMigrateOldPatchResourcesToNewSchemeStorage() { - Collection nonMigratedPaths = newArrayList(); + Collection nonMigratedPaths = new ArrayList<>(); for (ShelvedChangeList list : mySchemeManager.getAllSchemes()) { File newPatchDir = new File(getShelfResourcesDirectory(), list.getName()); // it should be enough for migration to check if resource directory exists. If any bugs appeared add isAncestor checks for each path @@ -353,7 +353,7 @@ public class ShelveChangesManager implements PersistentStateComponent, private static Collection migrateResourcesTo(@NotNull ShelvedChangeList list, @NotNull File targetDirectory, boolean deleteOld) { - Collection nonMigratedPaths = newArrayList(); + Collection nonMigratedPaths = new ArrayList<>(); //try to copy/move .patch file File patchFile = new File(list.PATH); if (patchFile.exists()) { @@ -848,7 +848,7 @@ public class ShelveChangesManager implements PersistentStateComponent, @CalledInAwt public void shelveSilentlyUnderProgress(@NotNull List changes) { - final List result = newArrayList(); + final List result = new ArrayList<>(); new Task.Backgroundable(myProject, VcsBundle.getString("shelve.changes.progress.title"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { @@ -882,9 +882,9 @@ public class ShelveChangesManager implements PersistentStateComponent, @NotNull private List shelveChangesInSeparatedLists(@NotNull Collection changes) { - List failedChangeLists = newArrayList(); - List result = newArrayList(); - List shelvedChanges = newArrayList(); + List failedChangeLists = new ArrayList<>(); + List result = new ArrayList<>(); + List shelvedChanges = new ArrayList<>(); try { SHELVED_FILES_LOCK.writeLock().lock(); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java index b636b79e41cd..8439f39fe9e0 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.shelf; import com.intellij.diff.DiffContentFactoryEx; @@ -250,7 +250,7 @@ public class ShelvedChangesViewManager implements Disposable { private void createShelvedListsWithChangesNode(@NotNull List shelvedLists, @NotNull MutableTreeNode parentNode) { shelvedLists.forEach(changeList -> { - List shelvedChanges = newArrayList(); + List shelvedChanges = new ArrayList<>(); changeList.getChanges(myProject).stream().map(ShelvedWrapper::new).forEach(shelvedChanges::add); changeList.getBinaryFiles().stream().map(ShelvedWrapper::new).forEach(shelvedChanges::add); @@ -456,7 +456,7 @@ public class ShelvedChangesViewManager implements Disposable { @NotNull public static List getShelvedLists(@NotNull final DataContext dataContext) { - List shelvedChangeLists = newArrayList(); + List shelvedChangeLists = new ArrayList<>(); addAll(shelvedChangeLists, notNullize(SHELVED_CHANGELIST_KEY.getData(dataContext))); addAll(shelvedChangeLists, notNullize(SHELVED_RECYCLED_CHANGELIST_KEY.getData(dataContext))); addAll(shelvedChangeLists, notNullize(SHELVED_DELETED_CHANGELIST_KEY.getData(dataContext))); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java index d91c4f8dcfd8..79300fb2f1ee 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java @@ -93,7 +93,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj @NotNull private final Set> myAffectedVcses; @NotNull private final List myExecutors; - @NotNull private final List myHandlers = newArrayList(); + @NotNull private final List myHandlers = new ArrayList<>(); @NotNull private final String myCommitActionName; @NotNull private final Map myListComments = new HashMap<>(); @@ -234,7 +234,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj @NotNull public static List collectExecutors(@NotNull Project project, @NotNull Collection changes) { - List result = newArrayList(); + List result = new ArrayList<>(); for (AbstractVcs vcs : ChangesUtil.getAffectedVcses(changes, project)) { result.addAll(vcs.getCommitExecutors()); } @@ -396,7 +396,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj @NotNull private List createExecutorActions(@NotNull List executors) { if(executors.isEmpty()) return emptyList(); - List result = newArrayList(); + List result = new ArrayList<>(); if (myShowVcsCommit && UISettings.getShadowInstance().getAllowMergeButtons()) { ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction("Vcs.CommitExecutor.Actions"); @@ -511,7 +511,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj @Override @NotNull protected Action[] createActions() { - List result = newArrayList(); + List result = new ArrayList<>(); if (myCommitAction != null) { result.add(myCommitAction); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsManagerConfigurable.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsManagerConfigurable.java index 9a7bdf6e96dc..1feaff24a010 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsManagerConfigurable.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsManagerConfigurable.java @@ -18,12 +18,14 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.ArrayList; import java.util.List; import java.util.Set; import static com.intellij.openapi.options.ex.ConfigurableWrapper.wrapConfigurable; import static com.intellij.util.ObjectUtils.notNull; -import static com.intellij.util.containers.ContainerUtil.*; +import static com.intellij.util.containers.ContainerUtil.addIfNotNull; +import static com.intellij.util.containers.ContainerUtil.map2Set; public class VcsManagerConfigurable extends SearchableConfigurable.Parent.Abstract implements Configurable.NoScroll { @NotNull private final Project myProject; @@ -95,7 +97,7 @@ public class VcsManagerConfigurable extends SearchableConfigurable.Parent.Abstra protected Configurable[] buildConfigurables() { myGeneralPanel = new VcsGeneralConfigurationConfigurable(myProject, this); - List result = newArrayList(); + List result = new ArrayList<>(); result.add(myGeneralPanel); result.add(new VcsBackgroundOperationsConfigurable(myProject)); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/BasicDefaultVcsRootPolicy.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/BasicDefaultVcsRootPolicy.java index 141723de0889..79aade3c45cc 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/BasicDefaultVcsRootPolicy.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/BasicDefaultVcsRootPolicy.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.impl; import com.intellij.openapi.project.Project; @@ -6,10 +6,10 @@ import com.intellij.openapi.vcs.impl.projectlevelman.NewMappings; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.platform.ProjectBaseDirectory; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -29,7 +29,7 @@ public class BasicDefaultVcsRootPolicy extends DefaultVcsRootPolicy { @Override @NotNull public Collection getDefaultVcsRoots(@NotNull NewMappings mappingList, @NotNull String vcsName) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); final VirtualFile baseDir = ProjectBaseDirectory.getInstance(myProject).getBaseDir(myBaseDir); if (baseDir != null && vcsName.equals(mappingList.getVcsFor(baseDir))) { result.add(baseDir); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java index 4f03b1cd8b5f..3aba4ffbf95b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/ProjectLevelVcsManagerImpl.java @@ -55,7 +55,6 @@ import com.intellij.ui.content.ContentFactory; import com.intellij.ui.content.ContentManager; import com.intellij.util.ContentUtilEx; import com.intellij.util.Processor; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.text.DateFormatUtil; import com.intellij.vcs.ViewUpdateInfoNotification; @@ -101,7 +100,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme private final Set myBackgroundRunningTasks = new HashSet<>(); - private final List> myPendingOutput = ContainerUtil.newArrayList(); + private final List> myPendingOutput = new ArrayList<>(); private final VcsHistoryCache myVcsHistoryCache; private final ContentRevisionCache myContentRevisionCache; diff --git a/platform/vcs-impl/src/com/intellij/vcs/commit/CommitMessageInspectionsPanel.java b/platform/vcs-impl/src/com/intellij/vcs/commit/CommitMessageInspectionsPanel.java index b47df5618be4..8363cd3f8b8d 100644 --- a/platform/vcs-impl/src/com/intellij/vcs/commit/CommitMessageInspectionsPanel.java +++ b/platform/vcs-impl/src/com/intellij/vcs/commit/CommitMessageInspectionsPanel.java @@ -29,6 +29,7 @@ import javax.swing.*; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -36,12 +37,11 @@ import java.util.Map; import static com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel.areToolDescriptorsChanged; import static com.intellij.util.ObjectUtils.notNull; import static com.intellij.util.containers.ContainerUtil.exists; -import static com.intellij.util.containers.ContainerUtil.newArrayList; public class CommitMessageInspectionsPanel extends BorderLayoutPanel implements Disposable, UnnamedConfigurable { @NotNull private final Project myProject; @NotNull private final CommitMessageInspectionProfile myProfile; - @NotNull private final List myInitialToolDescriptors = newArrayList(); + @NotNull private final List myInitialToolDescriptors = new ArrayList<>(); @NotNull private final Map myToolDetails = new HashMap<>(); @NotNull private final InspectionConfigTreeNode myRoot = new InspectionConfigTreeNode.Group(""); private InspectionProfileModifiableModel myModifiableModel; diff --git a/platform/vcs-impl/src/com/intellij/vcsUtil/VcsFileUtil.java b/platform/vcs-impl/src/com/intellij/vcsUtil/VcsFileUtil.java index 72857c8b2058..25e1dce71633 100644 --- a/platform/vcs-impl/src/com/intellij/vcsUtil/VcsFileUtil.java +++ b/platform/vcs-impl/src/com/intellij/vcsUtil/VcsFileUtil.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcsUtil; import com.google.common.collect.ArrayListMultimap; @@ -32,7 +18,6 @@ import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ThrowableConsumer; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -66,7 +51,7 @@ public class VcsFileUtil { int groupSize, @NotNull ThrowableNotNullFunction, ? extends List, ? extends VcsException> processor) throws VcsException { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); foreachChunk(arguments, groupSize, chunk -> { result.addAll(processor.fun(chunk)); diff --git a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProvider.java b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProvider.java index acaf8885528c..d2030dfcbd8f 100644 --- a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProvider.java +++ b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogProvider.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log; import com.intellij.openapi.Disposable; @@ -8,12 +9,12 @@ import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.VcsKey; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Consumer; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBus; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; @@ -102,7 +103,7 @@ public interface VcsLogProvider { @Deprecated default List readFullDetails(@NotNull VirtualFile root, @NotNull List hashes) throws VcsException { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); readFullDetails(root, hashes, result::add); return result; } diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/SimpleGraphInfo.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/SimpleGraphInfo.java index 2f0705e42879..681b51febdb7 100644 --- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/SimpleGraphInfo.java +++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/SimpleGraphInfo.java @@ -55,8 +55,8 @@ public class SimpleGraphInfo implements PermanentGraphInfo { int start = Math.max(0, visibleRow - visibleRange); int end = Math.min(linearGraph.nodesCount(), start + 2 * visibleRange); // no more than 2*visibleRange commits; - List> graphCommits = ContainerUtil.newArrayListWithCapacity(end - start); - List commitsIdMap = ContainerUtil.newArrayListWithCapacity(end - start); + List> graphCommits = new ArrayList<>(end - start); + List commitsIdMap = new ArrayList<>(end - start); for (int row = start; row < end; row++) { int nodeId = linearGraph.getNodeId(row); @@ -76,7 +76,7 @@ public class SimpleGraphInfo implements PermanentGraphInfo { PermanentLinearGraphImpl newLinearGraph = PermanentLinearGraphBuilder.newInstance(graphCommits).build(); int[] layoutIndexes = new int[end - start]; - List headNodeIndexes = ContainerUtil.newArrayList(); + List headNodeIndexes = new ArrayList<>(); TObjectIntHashMap commitIdToInteger = reverseCommitIdMap(permanentCommitsInfo, permanentGraphSize); for (int row = start; row < end; row++) { diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchCreator.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchCreator.java index e1d67216ce0b..171a8a4b2a71 100644 --- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchCreator.java +++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchCreator.java @@ -1,22 +1,7 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.graph.impl.facade.bek; import com.intellij.openapi.util.Pair; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.graph.api.LinearGraph; import com.intellij.vcs.log.graph.impl.permanent.GraphLayoutImpl; import com.intellij.vcs.log.graph.utils.Dfs; @@ -25,6 +10,7 @@ import com.intellij.vcs.log.graph.utils.Flags; import com.intellij.vcs.log.graph.utils.impl.BitSetFlags; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; import static com.intellij.vcs.log.graph.utils.LinearGraphUtils.getDownNodes; @@ -45,7 +31,7 @@ class BekBranchCreator { @NotNull public Pair, BekEdgeRestrictions> getResult() { - List bekBranches = ContainerUtil.newArrayList(); + List bekBranches = new ArrayList<>(); for (int headNode : myGraphLayout.getHeadNodeIndex()) { List nextBranch = createNextBranch(headNode); @@ -55,7 +41,7 @@ class BekBranchCreator { } public List createNextBranch(int headNode) { - final List nodeIndexes = ContainerUtil.newArrayList(); + final List nodeIndexes = new ArrayList<>(); assert !myDoneNodes.get(headNode); myDoneNodes.set(headNode, true); diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchMerger.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchMerger.java index b60c15815d84..420f12eeb973 100644 --- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchMerger.java +++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/facade/bek/BekBranchMerger.java @@ -1,24 +1,11 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.graph.impl.facade.bek; import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.graph.utils.TimestampGetter; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; class BekBranchMerger { @@ -26,7 +13,7 @@ class BekBranchMerger { @NotNull private final BekEdgeRestrictions myEdgeRestrictions; @NotNull private final TimestampGetter myTimestampGetter; - @NotNull private final List myInverseResultList = ContainerUtil.newArrayList(); + @NotNull private final List myInverseResultList = new ArrayList<>(); BekBranchMerger(@NotNull List bekBranches, @NotNull BekEdgeRestrictions edgeRestrictions, diff --git a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/DuplicateParentFixer.java b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/DuplicateParentFixer.java index a7292e09f764..5d091d884a13 100644 --- a/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/DuplicateParentFixer.java +++ b/platform/vcs-log/graph/src/com/intellij/vcs/log/graph/impl/permanent/DuplicateParentFixer.java @@ -1,23 +1,8 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.graph.impl.permanent; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.graph.GraphCommit; import org.jetbrains.annotations.NotNull; @@ -85,7 +70,7 @@ public class DuplicateParentFixer { Set allParents = new HashSet<>(parents); if (parents.size() == allParents.size()) return commit; - List correctParents = ContainerUtil.newArrayList(); + List correctParents = new ArrayList<>(); for (CommitId commitId : parents) { if (allParents.remove(commitId)) { correctParents.add(commitId); diff --git a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/LinearGraphParser.java b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/LinearGraphParser.java index 830f85630c30..83561d29add5 100644 --- a/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/LinearGraphParser.java +++ b/platform/vcs-log/graph/test/com/intellij/vcs/log/graph/parser/LinearGraphParser.java @@ -117,7 +117,7 @@ public class LinearGraphParser { @NotNull @Override public List getAdjacentEdges(int nodeIndex, @NotNull EdgeFilter filter) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (GraphEdge upEdge : myUpEdges.get(nodeIndex)) { if (upEdge.getType().isNormalEdge() && filter.upNormal) result.add(upEdge); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/AbstractDataGetter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/AbstractDataGetter.java index bba4a22c4d90..1d125badb6fd 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/AbstractDataGetter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/AbstractDataGetter.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.data; import com.intellij.openapi.Disposable; @@ -119,7 +120,7 @@ abstract class AbstractDataGetter implements Di @NotNull Consumer> consumer, @NotNull Consumer errorConsumer, @Nullable ProgressIndicator indicator) { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); final TIntHashSet toLoad = new TIntHashSet(); long taskNumber = myCurrentTaskIndex++; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/ContainingBranchesGetter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/ContainingBranchesGetter.java index dbca31657b17..0808314db872 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/ContainingBranchesGetter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/ContainingBranchesGetter.java @@ -36,7 +36,7 @@ public class ContainingBranchesGetter { @NotNull private final VcsLogData myLogData; // other fields accessed only from EDT - @NotNull private final List myLoadingFinishedListeners = ContainerUtil.newArrayList(); + @NotNull private final List myLoadingFinishedListeners = new ArrayList<>(); @NotNull private SLRUMap> myCache = createCache(); @NotNull private Map> myConditions = new HashMap<>(); private int myCurrentBranchesChecksum; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/TopCommitsCache.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/TopCommitsCache.java index 7876ef299b34..fe9e2f6fa095 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/TopCommitsCache.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/TopCommitsCache.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.data; import com.google.common.collect.Iterators; @@ -24,6 +10,7 @@ import com.intellij.vcs.log.VcsCommitMetadata; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -31,7 +18,7 @@ public class TopCommitsCache { private static final Logger LOG = Logger.getInstance(TopCommitsCache.class); @NotNull private final VcsLogStorage myStorage; @NotNull private final IntObjectMap myCache = ContainerUtil.createConcurrentIntObjectMap(); - @NotNull private List mySortedDetails = ContainerUtil.newArrayList(); + @NotNull private List mySortedDetails = new ArrayList<>(); public TopCommitsCache(@NotNull VcsLogStorage storage) { myStorage = storage; @@ -46,7 +33,7 @@ public class TopCommitsCache { if (newDetails.isEmpty()) return; Iterator it = new MergingIterator(mySortedDetails, newDetails); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); boolean isBroken = false; while (it.hasNext()) { VcsCommitMetadata detail = it.next(); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogProgress.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogProgress.java index d10b2aa4eace..8c962cc98af0 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogProgress.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogProgress.java @@ -19,7 +19,7 @@ import java.util.function.Consumer; public class VcsLogProgress implements Disposable { @NotNull private final Object myLock = new Object(); - @NotNull private final List myListeners = ContainerUtil.newArrayList(); + @NotNull private final List myListeners = new ArrayList<>(); @NotNull private final Set myTasksWithVisibleProgress = new HashSet<>(); @NotNull private final Set myTasksWithSilentProgress = new HashSet<>(); private boolean myDisposed = false; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogRefresherImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogRefresherImpl.java index 412947855cd9..6e8d733a0aed 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogRefresherImpl.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogRefresherImpl.java @@ -215,7 +215,7 @@ public class VcsLogRefresherImpl implements VcsLogRefresher, Disposable { @NotNull private Collection getRootsToRefresh(@NotNull List requests) { - Collection rootsToRefresh = ContainerUtil.newArrayList(); + Collection rootsToRefresh = new ArrayList<>(); for (RefreshRequest request : requests) { if (request == RefreshRequest.RELOAD_ALL) { myCurrentDataPack = DataPack.EMPTY; @@ -342,7 +342,7 @@ public class VcsLogRefresherImpl implements VcsLogRefresher, Disposable { new ProviderIterator() { @Override void each(@NotNull final VirtualFile root, @NotNull VcsLogProvider provider) throws VcsException { - final List> graphCommits = ContainerUtil.newArrayList(); + final List> graphCommits = new ArrayList<>(); VcsLogProvider.LogData data = provider.readAllHashes(root, commit -> graphCommits.add(compactCommit(commit, root))); logInfo.put(root, graphCommits); logInfo.put(root, data.getRefs()); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/IndexDataGetter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/IndexDataGetter.java index 2b5285c7f43e..e71605f1747d 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/IndexDataGetter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/IndexDataGetter.java @@ -103,7 +103,7 @@ public class IndexDataGetter { return executeAndCatch(() -> { List parentsIndexes = myIndexStorage.parents.get(index); if (parentsIndexes == null) return null; - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (int parentIndex : parentsIndexes) { CommitId id = myLogStorage.getCommitId(parentIndex); if (id == null) return null; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryFilterer.kt b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryFilterer.kt index 4a37dd1a3cc5..4c1ffaf5a80a 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryFilterer.kt +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryFilterer.kt @@ -10,7 +10,6 @@ import com.intellij.openapi.vcs.history.VcsCachingHistory import com.intellij.openapi.vcs.history.VcsFileRevision import com.intellij.openapi.vcs.history.VcsFileRevisionEx import com.intellij.openapi.vfs.VirtualFile -import com.intellij.util.containers.ContainerUtil import com.intellij.vcs.log.CommitId import com.intellij.vcs.log.Hash import com.intellij.vcs.log.VcsLogFilterCollection @@ -134,7 +133,7 @@ internal class FileHistoryFilterer(logData: VcsLogData) : VcsLogFilterer { return FileHistoryVisiblePack(dataPack, visibleGraph, false, filters, pathsMap) } - val commits = ContainerUtil.newArrayListWithCapacity>(revisions.size) + val commits = ArrayList>(revisions.size) val pathsMap = HashMap() for (revision in revisions) { @@ -154,7 +153,7 @@ internal class FileHistoryFilterer(logData: VcsLogData) : VcsLogFilterer { private fun getFilteredRefs(dataPack: DataPack): Map { val compressedRefs = dataPack.refsModel.allRefsByRoot[root] ?: CompressedRefs(emptySet(), storage) - return mapOf(kotlin.Pair(root, compressedRefs)) + return mapOf(Pair(root, compressedRefs)) } private fun getIndex(revision: VcsFileRevision): Int { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryUiProperties.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryUiProperties.java index 3b3bbc7437fc..ad8ee4f70a3c 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryUiProperties.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryUiProperties.java @@ -6,7 +6,6 @@ import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.openapi.components.StoragePathMacros; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtilRt; import com.intellij.vcs.log.impl.VcsLogUiProperties; import org.jetbrains.annotations.NotNull; @@ -27,7 +26,7 @@ public class FileHistoryUiProperties implements VcsLogUiProperties, PersistentSt public boolean SHOW_DETAILS = false; public boolean SHOW_OTHER_BRANCHES = false; public Map COLUMN_WIDTH = new HashMap<>(); - public List COLUMN_ORDER = ContainerUtil.newArrayList(); + public List COLUMN_ORDER = new ArrayList<>(); public boolean SHOW_DIFF_PREVIEW = true; } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/HeavyAwareExecutor.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/HeavyAwareExecutor.java index 1929bcebedfe..ade90dd29a88 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/HeavyAwareExecutor.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/HeavyAwareExecutor.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.impl; import com.google.common.util.concurrent.Futures; @@ -35,6 +21,7 @@ import com.intellij.util.io.storage.HeavyProcessLatch; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.Future; @@ -181,7 +168,7 @@ public class HeavyAwareExecutor implements Disposable { } private static class ExecutingHeavyOrPowerSaveListener implements PowerSaveMode.Listener { - @NotNull private final AtomicReference> myTasksToRun = new AtomicReference<>(ContainerUtil.newArrayList()); + @NotNull private final AtomicReference> myTasksToRun = new AtomicReference<>(new ArrayList<>()); private final int myDelayMs; ExecutingHeavyOrPowerSaveListener(@NotNull Project project, int delayMs, @NotNull Disposable parent) { @@ -218,7 +205,7 @@ public class HeavyAwareExecutor implements Disposable { if (!PowerSaveMode.isEnabled()) { HeavyProcessLatch.INSTANCE.executeOutOfHeavyProcess(() -> JobScheduler.getScheduler().schedule(() -> { if (!HeavyProcessLatch.INSTANCE.isRunning() && !PowerSaveMode.isEnabled()) { - List tasks = myTasksToRun.getAndSet(ContainerUtil.newArrayList()); + List tasks = myTasksToRun.getAndSet(new ArrayList<>()); tasks.forEach(Runnable::run); } else { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/SimpleRefGroup.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/SimpleRefGroup.java index e8b60c6f19e5..dfb859ce3fa6 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/SimpleRefGroup.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/SimpleRefGroup.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.impl; import com.intellij.util.ObjectUtils; @@ -76,7 +62,7 @@ public class SimpleRefGroup implements RefGroup { return multiple ? Arrays.asList(color, color) : Collections.singletonList(color); } else { - List colorsList = ContainerUtil.newArrayList(); + List colorsList = new ArrayList<>(); for (VcsRefType type : referencesByType.keySet()) { if (referencesByType.get(type).size() > 1) { colorsList.add(type.getBackgroundColor()); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsChangesLazilyParsedDetails.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsChangesLazilyParsedDetails.java index 4fcd095766ac..6198403a88c0 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsChangesLazilyParsedDetails.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsChangesLazilyParsedDetails.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.impl; import com.google.common.base.Supplier; @@ -168,7 +154,7 @@ public class VcsChangesLazilyParsedDetails extends VcsCommitMetadataImpl impleme return Collections.singletonList(mergedChanges); } else { - List> changes = ContainerUtil.newArrayListWithCapacity(myChangesOutput.size()); + List> changes = new ArrayList<>(myChangesOutput.size()); for (int i = 0; i < myChangesOutput.size(); i++) { changes.add(myParser.apply(myChangesOutput.get(i), i)); } @@ -199,7 +185,7 @@ public class VcsChangesLazilyParsedDetails extends VcsCommitMetadataImpl impleme @NotNull BiFunction, Integer, List> parser) { super(change); mySourceChanges = Suppliers.memoize(() -> { - List sourceChanges = ContainerUtil.newArrayList(); + List sourceChanges = new ArrayList<>(); for (int parent = 0; parent < statusInfo.getMergedStatusInfos().size(); parent++) { List statusInfos = Collections.singletonList(statusInfo.getMergedStatusInfos().get(parent)); sourceChanges.addAll(parser.apply(statusInfos, parent)); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogProjectTabsProperties.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogProjectTabsProperties.java index 4bd497f178b8..d55e78af5fae 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogProjectTabsProperties.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogProjectTabsProperties.java @@ -64,7 +64,7 @@ public class VcsLogProjectTabsProperties implements PersistentStateComponent values) { List recentGroups = stateField.get(filterName); if (recentGroups == null) { - recentGroups = newArrayList(); + recentGroups = new ArrayList<>(); stateField.put(filterName, recentGroups); } RecentGroup group = new RecentGroup(values); @@ -92,7 +92,7 @@ public class VcsLogProjectTabsProperties implements PersistentStateComponent FILTER_VALUES = newArrayList(); + public List FILTER_VALUES = new ArrayList<>(); public RecentGroup() { } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUiPropertiesImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUiPropertiesImpl.java index 1600337cdcf2..97e9b543ca3e 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUiPropertiesImpl.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUiPropertiesImpl.java @@ -43,7 +43,7 @@ public abstract class VcsLogUiPropertiesImpl> FILTERS = new TreeMap<>(); public TextFilterSettings TEXT_FILTER_SETTINGS = new TextFilterSettings(); public Map COLUMN_WIDTH = new HashMap<>(); - public List COLUMN_ORDER = ContainerUtil.newArrayList(); + public List COLUMN_ORDER = new ArrayList<>(); } @NotNull diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUiImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUiImpl.java index 835e647ff2ca..7113ddc4fe0c 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUiImpl.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/VcsLogUiImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.ui; import com.google.common.util.concurrent.SettableFuture; @@ -10,7 +10,6 @@ import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; import com.intellij.ui.navigation.History; import com.intellij.util.EventDispatcher; import com.intellij.util.PairFunction; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.VcsLogFilterCollection; import com.intellij.vcs.log.VcsLogFilterUi; import com.intellij.vcs.log.data.VcsLogData; @@ -31,6 +30,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; import java.util.EventListener; import java.util.List; @@ -117,7 +117,7 @@ public class VcsLogUiImpl extends AbstractVcsLogUi { return; } - List runnables = ContainerUtil.newArrayList(); + List runnables = new ArrayList<>(); runnables.add(new NamedRunnable("View and Reset Filters") { @Override public void run() { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/HighlightersActionGroup.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/HighlightersActionGroup.java index 8b8ce4fd5e80..3ec923095fa3 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/HighlightersActionGroup.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/actions/HighlightersActionGroup.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.ui.actions; import com.intellij.openapi.actionSystem.ActionGroup; @@ -6,7 +6,6 @@ import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.Separator; import com.intellij.openapi.project.DumbAware; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.impl.VcsLogUiProperties; import com.intellij.vcs.log.ui.AbstractVcsLogUi; import com.intellij.vcs.log.ui.VcsLogInternalDataKeys; @@ -14,6 +13,7 @@ import com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import static com.intellij.vcs.log.impl.MainVcsLogUiProperties.VcsLogHighlighterProperty; @@ -22,7 +22,7 @@ public class HighlightersActionGroup extends ActionGroup implements DumbAware { @NotNull @Override public AnAction[] getChildren(@Nullable AnActionEvent e) { - List actions = ContainerUtil.newArrayList(); + List actions = new ArrayList<>(); if (e != null) { if (e.getData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES) != null) { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/BranchPopupBuilder.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/BranchPopupBuilder.java index d05dc5770ee9..7114a0dc77df 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/BranchPopupBuilder.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/BranchPopupBuilder.java @@ -107,7 +107,7 @@ public abstract class BranchPopupBuilder { private static class Groups { private final TreeMap> favoriteGroups = new TreeMap<>(); private final TreeMap> singletonGroups = new TreeMap<>(); - private final List> recentGroups = ContainerUtil.newArrayList(); + private final List> recentGroups = new ArrayList<>(); private final TreeMap>> expandedGroups = new TreeMap<>(); private final TreeMap>> collapsedGroups = diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/FilterModel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/FilterModel.java index 6829bde775f5..52eca2bf0730 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/FilterModel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/FilterModel.java @@ -1,9 +1,8 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.ui.filter; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.VcsLogDataPack; import com.intellij.vcs.log.VcsLogFilter; import com.intellij.vcs.log.VcsLogFilterCollection; @@ -13,6 +12,7 @@ import org.apache.commons.lang.ObjectUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.function.Function; @@ -20,7 +20,7 @@ import java.util.function.Function; abstract class FilterModel { @NotNull protected final MainVcsLogUiProperties myUiProperties; @NotNull private final Computable myDataPackProvider; - @NotNull private final Collection mySetFilterListeners = ContainerUtil.newArrayList(); + @NotNull private final Collection mySetFilterListeners = new ArrayList<>(); @Nullable protected Filter myFilter; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java index 95473e9eb142..61957424f3cc 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/VcsLogClassicFilterUi.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.ui.filter; import com.intellij.openapi.Disposable; @@ -363,9 +363,9 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi { @Nullable BranchFilters createFilterFromPresentation(@NotNull List values) { - List hashes = ContainerUtil.newArrayList(); - List branches = ContainerUtil.newArrayList(); - List ranges = ContainerUtil.newArrayList(); + List hashes = new ArrayList<>(); + List branches = new ArrayList<>(); + List ranges = new ArrayList<>(); for (String s : values) { int twoDots = s.indexOf(".."); if (twoDots > 0 && twoDots == s.lastIndexOf("..")) { @@ -577,7 +577,7 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi { @Override @Nullable protected VcsLogRootFilter createFilter2(@NotNull List values) { - List selectedRoots = ContainerUtil.newArrayList(); + List selectedRoots = new ArrayList<>(); for (String path : values) { VirtualFile root = LocalFileSystem.getInstance().findFileByPath(path); if (root != null) { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java index 145851b7af56..0987430b7a94 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java @@ -291,7 +291,7 @@ public class DetailsPanel extends JPanel implements EditorColorsListener, Dispos rebuildCommitPanels(selection); List currentSelection = mySelection; ApplicationManager.getApplication().executeOnPooledThread(() -> { - List> result = ContainerUtil.newArrayList(); + List> result = new ArrayList<>(); for (Integer row : currentSelection) { result.add(myGraphTable.getModel().getRefsAtRow(row)); } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/ProgressStripeIcon.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/ProgressStripeIcon.java index 07546cec6e1d..b787bccb723f 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/ProgressStripeIcon.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/ProgressStripeIcon.java @@ -1,10 +1,9 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.ui.frame; import com.intellij.ide.ui.laf.intellij.MacIntelliJProgressBarUI; import com.intellij.openapi.ui.GraphicsConfig; import com.intellij.ui.JBColor; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.AsyncProcessIcon; import com.intellij.util.ui.GraphicsUtil; import com.intellij.util.ui.JBUI; @@ -15,6 +14,7 @@ import javax.swing.*; import java.awt.*; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; +import java.util.ArrayList; import java.util.List; import static com.intellij.ui.JBColor.namedColor; @@ -101,7 +101,7 @@ public abstract class ProgressStripeIcon implements Icon { @NotNull public static AsyncProcessIcon generateIcon(@NotNull JComponent component) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (int i = 0; i < 2 * JBUI.scale(GradientIcon.GRADIENT); i += JBUI.scale(TRANSLATE)) { result.add(new GradientIcon(component, i)); } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangesBrowser.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangesBrowser.java index 908d5636bcf7..f038c840d30c 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangesBrowser.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogChangesBrowser.java @@ -76,7 +76,7 @@ public class VcsLogChangesBrowser extends ChangesBrowserBase implements Disposab @NotNull private final VcsLogUiProperties.PropertiesChangeListener myListener; @NotNull private final Set myRoots = new HashSet<>(); - @NotNull private final List myChanges = ContainerUtil.newArrayList(); + @NotNull private final List myChanges = new ArrayList<>(); @NotNull private final Map> myChangesToParents = new HashMap<>(); @Nullable private Collection myAffectedPaths; @NotNull private final Wrapper myToolbarWrapper; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java index d618b0aa458e..1654c9e4ba3d 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java @@ -26,10 +26,8 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.awt.geom.RoundRectangle2D; -import java.util.Collection; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; +import java.util.*; import static com.intellij.openapi.vcs.changes.ui.CurrentBranchComponent.getBranchPresentationBackground; @@ -52,7 +50,7 @@ public class LabelPainter { @NotNull private final JComponent myComponent; @NotNull private final LabelIconCache myIconCache; - @NotNull private List> myLabels = ContainerUtil.newArrayList(); + @NotNull private List> myLabels = new ArrayList<>(); private int myHeight = JBUI.scale(22); private int myWidth = 0; @NotNull private Color myBackground = UIUtil.getTableBackground(); @@ -116,7 +114,7 @@ public class LabelPainter { boolean compact) { int width = LEFT_PADDING.get() + RIGHT_PADDING.get(); - List> labels = ContainerUtil.newArrayList(); + List> labels = new ArrayList<>(); if (refGroups.isEmpty()) return Pair.create(labels, width); if (compact) return calculateCompactPresentation(refGroups, fontMetrics, background, availableWidth); @@ -131,7 +129,7 @@ public class LabelPainter { int availableWidth) { int width = LEFT_PADDING.get() + RIGHT_PADDING.get(); - List> labels = ContainerUtil.newArrayList(); + List> labels = new ArrayList<>(); if (refGroups.isEmpty()) return Pair.create(labels, width); for (RefGroup group : refGroups) { @@ -156,7 +154,7 @@ public class LabelPainter { int availableWidth) { int width = LEFT_PADDING.get() + RIGHT_PADDING.get(); - List> labels = ContainerUtil.newArrayList(); + List> labels = new ArrayList<>(); if (refGroups.isEmpty()) return Pair.create(labels, width); int height = fontMetrics.getHeight(); @@ -210,7 +208,7 @@ public class LabelPainter { } } - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (Map.Entry entry : usedColors.entrySet()) { result.add(entry.getKey()); if (entry.getValue() > 1) { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/table/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/table/VcsLogGraphTable.java index 71a2d86352cc..083d569192fd 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/table/VcsLogGraphTable.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/table/VcsLogGraphTable.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.ui.table; import com.google.common.primitives.Ints; @@ -109,7 +95,7 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider, @Nullable private Selection mySelection = null; - @NotNull private final Collection myHighlighters = ContainerUtil.newArrayList(); + @NotNull private final Collection myHighlighters = new ArrayList<>(); // BasicTableUI.viewIndexForColumn uses reference equality, so we should not change TableColumn during DnD. private final List myTableColumns = new ArrayList<>(); @@ -255,7 +241,7 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider, @NotNull private List getVisibleColumns() { - List columnOrder = ContainerUtil.newArrayList(); + List columnOrder = new ArrayList<>(); for (int i = 0; i < getColumnModel().getColumnCount(); i++) { columnOrder.add(getColumnModel().getColumn(i).getModelIndex()); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java index b5d52b7226b7..28bb411596e7 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/util/VcsLogUtil.java @@ -212,7 +212,7 @@ public class VcsLogUtil { public static List getDetails(@NotNull VcsLogProvider logProvider, @NotNull VirtualFile root, @NotNull List hashes) throws VcsException { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); logProvider.readFullDetails(root, hashes, result::add); return result; } @@ -265,7 +265,7 @@ public class VcsLogUtil { @NotNull public static List collectChanges(@NotNull List detailsList, @NotNull Function> getChanges) { - List changes = ContainerUtil.newArrayList(); + List changes = new ArrayList<>(); List detailsListReversed = ContainerUtil.reverse(detailsList); for (VcsFullCommitDetails details : detailsListReversed) { changes.addAll(getChanges.fun(details)); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/visible/VisiblePackRefresherImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/visible/VisiblePackRefresherImpl.java index b9c29630dfa1..f1535c524e7d 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/visible/VisiblePackRefresherImpl.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/visible/VisiblePackRefresherImpl.java @@ -24,6 +24,7 @@ import kotlin.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -165,10 +166,10 @@ public class VisiblePackRefresherImpl implements VisiblePackRefresher, Disposabl } } - List requestsToRun = ContainerUtil.newArrayList(); + List requestsToRun = new ArrayList<>(); if (state.getVisiblePack() != myState.getVisiblePack() && state.isValid()) { requestsToRun.addAll(state.getRequestsToRun()); - state = state.withRequests(ContainerUtil.newArrayList()); + state = state.withRequests(new ArrayList<>()); } myTaskController.taskCompleted(state); @@ -282,7 +283,7 @@ public class VisiblePackRefresherImpl implements VisiblePackRefresher, Disposabl private final boolean myIsValid; State(@NotNull VcsLogFilterCollection filters, @NotNull PermanentGraph.SortType sortType) { - this(filters, sortType, CommitCountStage.INITIAL, ContainerUtil.newArrayList(), VisiblePack.EMPTY, true); + this(filters, sortType, CommitCountStage.INITIAL, new ArrayList<>(), VisiblePack.EMPTY, true); } State(@NotNull VcsLogFilterCollection filters, diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/TimedCommitParser.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/TimedCommitParser.java index be5e5c3bdf9e..89ceef2025be 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/TimedCommitParser.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/TimedCommitParser.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log; import com.intellij.util.containers.ContainerUtil; @@ -22,6 +8,7 @@ import com.intellij.vcs.log.impl.HashImpl; import com.intellij.vcs.log.impl.TimedVcsCommitImpl; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -48,7 +35,7 @@ public class TimedCommitParser { throw new IllegalArgumentException("bad timestamp in line: " + line); } GraphCommit commit = CommitParser.parseCommitParentsAsInteger(line.substring(firstSeparatorIndex + 2)); - List parents = ContainerUtil.newArrayList(); + List parents = new ArrayList<>(); for (int p : commit.getParents()) { parents.add(intToHash(p)); } diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/VcsLogUserFilterTest.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/VcsLogUserFilterTest.java index 60cfb3d3bf07..6a151605c643 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/VcsLogUserFilterTest.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/VcsLogUserFilterTest.java @@ -47,7 +47,7 @@ public abstract class VcsLogUserFilterTest { } public void testWeirdCharacters() throws Exception { - List names = ContainerUtil.newArrayList(); + List names = new ArrayList<>(); for (Character c : UserNameRegex.EXTENDED_REGEX_CHARS) { String name = "user" + c + "userovich" + c.hashCode(); // hashCode is required so that uses wont be synonyms @@ -80,7 +80,7 @@ public abstract class VcsLogUserFilterTest { } public void testSynonyms(@NotNull Set excludes) throws Exception { - List names = ContainerUtil.newArrayList(); + List names = new ArrayList<>(); Set synonyms = new HashSet<>(); for (char c = ' '; c <= '~'; c++) { @@ -96,7 +96,7 @@ public abstract class VcsLogUserFilterTest { MultiMap commits = generateHistory(ArrayUtil.toStringArray(names)); List metadata = generateMetadata(commits); - List synonymCommits = ContainerUtil.newArrayList(); + List synonymCommits = new ArrayList<>(); for (VcsUser user : commits.keySet()) { if (synonyms.contains(user.getName())) synonymCommits.addAll(commits.get(user)); } @@ -228,7 +228,7 @@ public abstract class VcsLogUserFilterTest { @NotNull private List generateMetadata(@NotNull MultiMap commits) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (VcsUser user : commits.keySet()) { for (String commit : commits.get(user)) { @@ -246,7 +246,7 @@ public abstract class VcsLogUserFilterTest { private MultiMap generateHistory(String... names) throws IOException { TestCase.assertTrue("Incorrect user names (should be pairs of users and emails) " + Arrays.toString(names), names.length % 2 == 0); - List users = ContainerUtil.newArrayList(); + List users = new ArrayList<>(); for (int i = 0; i < names.length / 2; i++) { users.add(myObjectsFactory.createUser(names[2 * i], names[2 * i + 1])); } diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogRefresherTest.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogRefresherTest.java index a85328f10026..ee823fc10256 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogRefresherTest.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VcsLogRefresherTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.data; import com.intellij.openapi.diagnostic.Logger; @@ -133,7 +119,7 @@ public class VcsLogRefresherTest extends VcsPlatformTest { myLoader.refresh(Collections.singletonList(projectRoot)); DataPack result = myDataWaiter.get(); - List allCommits = ContainerUtil.newArrayList(); + List allCommits = new ArrayList<>(); allCommits.add(newCommit); allCommits.addAll(myCommits); assertDataPack(log(allCommits), result.getPermanentGraph().getAllCommits()); diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/HashSerializeTest.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/HashSerializeTest.java index 3b504df492a1..315cc9faca07 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/HashSerializeTest.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/HashSerializeTest.java @@ -1,27 +1,13 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.vcs.log.impl; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.io.DataOutputStream; import org.jetbrains.annotations.NotNull; import org.junit.Test; import java.io.*; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -44,7 +30,7 @@ public class HashSerializeTest { HashImpl newHash = readFromFile(file).get(0); assertEquals(hash, newHash); } - + @Test public void two_different_hashes() throws IOException { HashImpl hash1 = (HashImpl)HashImpl.build("d35ee91"); @@ -68,7 +54,7 @@ public class HashSerializeTest { @NotNull private static List readFromFile(@NotNull File file) throws IOException { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); try (DataInputStream in = new DataInputStream(new FileInputStream(file))) { while (in.available() > 0) { result.add((HashImpl)HashImpl.read(in)); diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java b/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java index 3f57aab15548..0830d70a3364 100644 --- a/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java +++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/impl/TestVcsLogProvider.java @@ -63,7 +63,7 @@ public class TestVcsLogProvider implements VcsLogProvider { public TestVcsLogProvider(@NotNull VirtualFile root) { myRoot = root; - myCommits = ContainerUtil.newArrayList(); + myCommits = new ArrayList<>(); myRefs = new HashSet<>(); myRefManager = new MockRefManager(); myFullLogSemaphore = new ReducibleSemaphore(); diff --git a/platform/vcs-tests/src/com/intellij/openapi/vcs/TestVcsNotifier.java b/platform/vcs-tests/src/com/intellij/openapi/vcs/TestVcsNotifier.java index a2f51131b051..721b6d74d23f 100644 --- a/platform/vcs-tests/src/com/intellij/openapi/vcs/TestVcsNotifier.java +++ b/platform/vcs-tests/src/com/intellij/openapi/vcs/TestVcsNotifier.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs; import com.intellij.notification.Notification; @@ -7,13 +7,14 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; public class TestVcsNotifier extends VcsNotifier { private static final String TEST_NOTIFICATION_GROUP = "Test"; - private final List myNotifications = ContainerUtil.newArrayList(); + private final List myNotifications = new ArrayList<>(); public TestVcsNotifier(@NotNull Project project) { super(project); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessActionBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessActionBase.java index 8a69092a835f..a93f3b7e05f7 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessActionBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/AttachToProcessActionBase.java @@ -162,7 +162,7 @@ public abstract class AttachToProcessActionBase extends AnAction { public List collectAttachHostsItems(@NotNull final Project project, @NotNull ProgressIndicator indicator) { - List currentItems = ContainerUtil.newArrayList(); + List currentItems = new ArrayList<>(); UserDataHolderBase dataHolder = new UserDataHolderBase(); @@ -189,7 +189,7 @@ public abstract class AttachToProcessActionBase extends AnAction { @NotNull XAttachHost host, @NotNull Project project, @NotNull UserDataHolder dataHolder) { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); final List recentItems = getRecentItems(host, project); for (int i = recentItems.size() - 1; i >= 0; i--) { @@ -255,7 +255,7 @@ public abstract class AttachToProcessActionBase extends AnAction { @NotNull List providers) { UserDataHolderBase dataHolder = new UserDataHolderBase(); - List currentItems = ContainerUtil.newArrayList(); + List currentItems = new ArrayList<>(); for (ProcessInfo process : processInfos) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java index e45928a0a51e..c9d0b38b6d6c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.xdebugger.impl.ui.tree.nodes; import com.intellij.util.ArrayUtil; @@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.tree.TreeNode; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -54,7 +55,7 @@ public class WatchesRootNode extends XValueContainerNode { } }); myWatchesView = watchesView; - myChildren = ContainerUtil.newArrayList(); + myChildren = new ArrayList<>(); for (XExpression watchExpression : expressions) { myChildren.add(new WatchNodeImpl(myTree, this, watchExpression, stackFrame)); } diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/JavaOverridingMethodUtil.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/JavaOverridingMethodUtil.java index e3fd772eb76c..83ecbb22ba19 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/JavaOverridingMethodUtil.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/JavaOverridingMethodUtil.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.siyeh.ig; import com.intellij.openapi.progress.ProgressManager; @@ -25,10 +11,10 @@ import com.intellij.psi.search.GlobalSearchScopeUtil; import com.intellij.psi.search.SearchScope; import com.intellij.psi.stubs.StubIndex; import com.intellij.psi.util.PsiSuperMethodUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; import java.util.stream.Stream; @@ -57,7 +43,7 @@ public class JavaOverridingMethodUtil { effectiveSearchScope = effectiveSearchScope.intersectWith(searchScope); } - List methods = ContainerUtil.newArrayList(); + List methods = new ArrayList<>(); if (!StubIndex.getInstance().processElements(JavaStubIndexKeys.METHODS, name, project, diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/MethodMatcher.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/MethodMatcher.java index 594787eb50b2..0784f4c6d7f0 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/MethodMatcher.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/MethodMatcher.java @@ -9,12 +9,12 @@ import com.intellij.psi.PsiClass; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiMethodCallExpression; import com.intellij.psi.util.InheritanceUtil; -import com.intellij.util.containers.ContainerUtil; import com.siyeh.ig.BaseInspection; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -27,8 +27,8 @@ import java.util.regex.PatternSyntaxException; */ public class MethodMatcher { - private final List myMethodNamePatterns = ContainerUtil.newArrayList(); - private final List myClassNames = ContainerUtil.newArrayList(); + private final List myMethodNamePatterns = new ArrayList<>(); + private final List myClassNames = new ArrayList<>(); private final Map myPatternCache = new HashMap<>(); private final boolean myWriteDefaults; private final String myOptionName; diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/InjectionsSettingsUI.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/InjectionsSettingsUI.java index 770dac643b1c..daf76ad2349b 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/InjectionsSettingsUI.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/InjectionsSettingsUI.java @@ -69,7 +69,7 @@ public final class InjectionsSettingsUI extends SearchableConfigurable.Parent.Ab private final InjectionsTable myInjectionsTable; private final Map mySupports = new LinkedHashMap<>(); private final Map myEditActions = new LinkedHashMap<>(); - private final List myAddActions = ContainerUtil.newArrayList(); + private final List myAddActions = new ArrayList<>(); private final JLabel myCountLabel; private final Configuration myConfiguration; diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java index b29e1a996fe0..02758ee10ff1 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.intellij.plugins.intelliLang.inject; @@ -25,7 +25,6 @@ import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.ArrayUtil; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.text.CharArrayUtil; import com.intellij.util.text.StringSearcher; import gnu.trove.TIntArrayList; @@ -80,7 +79,7 @@ public class InjectorUtils { InjectedLanguage.create(injection.getInjectedLanguageId(), injection.getPrefix(), injection.getSuffix(), false); List ranges = injection.getInjectedArea(host); - List> list = ContainerUtil.newArrayListWithCapacity(ranges.size()); + List> list = new ArrayList<>(ranges.size()); for (TextRange range : ranges) { list.add(Trinity.create(host, injectedLanguage, range)); diff --git a/plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjector.java b/plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjector.java index 5d5d1ce77a7e..0bbb683b4865 100644 --- a/plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjector.java +++ b/plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjector.java @@ -33,7 +33,6 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.xml.*; import com.intellij.util.PairProcessor; import com.intellij.util.PatternValuesIndex; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashMap; import org.intellij.plugins.intelliLang.Configuration; import org.intellij.plugins.intelliLang.inject.InjectedLanguage; @@ -114,7 +113,7 @@ public final class XmlLanguageInjector implements MultiHostInjector { if (language == null) continue; final boolean separateFiles = !injection.isSingleFile() && StringUtil.isNotEmpty(injection.getValuePattern()); - final List> result = ContainerUtil.newArrayList(); + final List> result = new ArrayList<>(); xmlTag.acceptChildren(new PsiElementVisitor() { @Override diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/exceptions/ReplaceArmWithTryFinallyIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/exceptions/ReplaceArmWithTryFinallyIntention.java index 122f54791e2b..1a288f02f335 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/exceptions/ReplaceArmWithTryFinallyIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/exceptions/ReplaceArmWithTryFinallyIntention.java @@ -1,14 +1,12 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.siyeh.ipp.exceptions; import com.intellij.psi.*; -import com.intellij.util.containers.ContainerUtil; import com.siyeh.ipp.base.Intention; import com.siyeh.ipp.base.PsiElementPredicate; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; /** @@ -34,7 +32,7 @@ public class ReplaceArmWithTryFinallyIntention extends Intention { if (resourceList == null) { return; } - final List resources = ContainerUtil.newArrayList(); + final List resources = new ArrayList<>(); final StringBuilder newTryStatement = new StringBuilder("{"); for (PsiResourceListElement resource : resourceList) { if (resource instanceof PsiResourceVariable) { diff --git a/plugins/coverage-common/src/com/intellij/coverage/CoverageOptionsConfigurable.java b/plugins/coverage-common/src/com/intellij/coverage/CoverageOptionsConfigurable.java index 8c925c656696..329d28534bba 100644 --- a/plugins/coverage-common/src/com/intellij/coverage/CoverageOptionsConfigurable.java +++ b/plugins/coverage-common/src/com/intellij/coverage/CoverageOptionsConfigurable.java @@ -1,16 +1,16 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.coverage; import com.intellij.openapi.options.CompositeConfigurable; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.project.Project; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; import java.util.List; public class CoverageOptionsConfigurable extends CompositeConfigurable implements SearchableConfigurable { @@ -55,7 +55,7 @@ public class CoverageOptionsConfigurable extends CompositeConfigurable collectExtensionOptionsComponents() { - List additionalPanels = ContainerUtil.newArrayList(); + List additionalPanels = new ArrayList<>(); for (CoverageOptions coverageOptions : getConfigurables()) { additionalPanels.add(coverageOptions.createComponent()); } diff --git a/plugins/editorconfig/src/org/editorconfig/Utils.java b/plugins/editorconfig/src/org/editorconfig/Utils.java index a67bb5fa5391..ce03d65646c8 100644 --- a/plugins/editorconfig/src/org/editorconfig/Utils.java +++ b/plugins/editorconfig/src/org/editorconfig/Utils.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.editorconfig; import com.intellij.application.options.CodeStyle; @@ -20,7 +20,6 @@ import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.search.FileTypeIndex; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.LineSeparator; -import com.intellij.util.containers.ContainerUtil; import org.editorconfig.configmanagement.EditorConfigIndentOptionsProvider; import org.editorconfig.configmanagement.EncodingManager; import org.editorconfig.configmanagement.LineEndingsManager; @@ -253,7 +252,7 @@ public class Utils { @NotNull public static List pathsToFiles(@NotNull List paths) { - List files = ContainerUtil.newArrayList(); + List files = new ArrayList<>(); for (String path : paths) { VirtualFile file = VfsUtil.findFile(Paths.get(path), true); if (file != null) { diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigActionUtil.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigActionUtil.java index 36b90a182c88..d4827bc56e9b 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigActionUtil.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigActionUtil.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.editorconfig.configmanagement; import com.intellij.application.options.CodeStyle; @@ -14,12 +15,12 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CodeStyleSettingsManager; -import com.intellij.util.containers.ContainerUtil; import org.editorconfig.language.messages.EditorConfigBundle; import org.editorconfig.settings.EditorConfigSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; public class EditorConfigActionUtil { @@ -28,7 +29,7 @@ public class EditorConfigActionUtil { public static AnAction[] createNavigationActions(@NotNull PsiFile file) { - List actions = ContainerUtil.newArrayList(); + List actions = new ArrayList<>(); EditorConfigNavigationActionsFactory navigationActionsFactory = EditorConfigNavigationActionsFactory.getInstance(file.getVirtualFile()); actions.addAll(navigationActionsFactory.getNavigationActions(file.getProject())); diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigFilesCollector.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigFilesCollector.java index cab76af00a21..6b0913a4d5da 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigFilesCollector.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigFilesCollector.java @@ -2,16 +2,16 @@ package org.editorconfig.configmanagement; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import org.editorconfig.Utils; import org.editorconfig.core.DefaultParserCallback; import org.jetbrains.annotations.NotNull; import java.io.File; +import java.util.ArrayList; import java.util.List; public class EditorConfigFilesCollector extends DefaultParserCallback { - private final List myEditorConfigFilePaths = ContainerUtil.newArrayList(); + private final List myEditorConfigFilePaths = new ArrayList<>(); @Override public boolean processEditorConfig(File configFile) { diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigNavigationActionsFactory.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigNavigationActionsFactory.java index 4fb54f1821b7..dbd751bafff9 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigNavigationActionsFactory.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigNavigationActionsFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.editorconfig.configmanagement; import com.intellij.ide.actions.OpenFileAction; @@ -9,20 +9,20 @@ import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import org.editorconfig.Utils; import org.editorconfig.language.messages.EditorConfigBundle; import org.editorconfig.language.util.EditorConfigPresentationUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; public class EditorConfigNavigationActionsFactory { private static final Key NAVIGATION_FACTORY_KEY = Key.create("editor.config.navigation.factory"); - private final List myEditorConfigFilePaths = ContainerUtil.newArrayList(); + private final List myEditorConfigFilePaths = new ArrayList<>(); private static final Object INSTANCE_LOCK = new Object(); @@ -31,7 +31,7 @@ public class EditorConfigNavigationActionsFactory { @NotNull public List getNavigationActions(@NotNull Project project) { - final List actions = ContainerUtil.newArrayList(); + final List actions = new ArrayList<>(); synchronized (myEditorConfigFilePaths) { List editorConfigFiles = Utils.pathsToFiles(myEditorConfigFilePaths); for (VirtualFile editorConfigFile : editorConfigFiles) { diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/EditorConfigIntellijNameUtil.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/EditorConfigIntellijNameUtil.java index cc7eecee6b1c..2b633c01fc10 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/EditorConfigIntellijNameUtil.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/EditorConfigIntellijNameUtil.java @@ -1,12 +1,12 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.editorconfig.configmanagement.extended; import com.intellij.application.options.codeStyle.properties.AbstractCodeStylePropertyMapper; import com.intellij.application.options.codeStyle.properties.LanguageCodeStylePropertyMapper; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -31,7 +31,7 @@ public class EditorConfigIntellijNameUtil { } break; case COMMON: - List names = ContainerUtil.newArrayList(); + List names = new ArrayList<>(); names.add(GENERIC_OPTION_KEY_PREFIX + propertyName); names.add(getLanguageProperty(mapper, propertyName)); return names; diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijConfigOptionDescriptorProvider.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijConfigOptionDescriptorProvider.java index 18081ae2db10..188ca08c0c67 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijConfigOptionDescriptorProvider.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijConfigOptionDescriptorProvider.java @@ -1,9 +1,8 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.editorconfig.configmanagement.extended; import com.intellij.application.options.CodeStyle; import com.intellij.application.options.codeStyle.properties.*; -import com.intellij.psi.PsiElement; import com.intellij.util.containers.ContainerUtil; import org.editorconfig.Utils; import org.editorconfig.language.extensions.EditorConfigOptionDescriptorProvider; @@ -12,6 +11,7 @@ import org.editorconfig.language.schema.descriptors.impl.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -32,8 +32,8 @@ public class IntellijConfigOptionDescriptorProvider implements EditorConfigOptio } private static List getAllOptions() { - List descriptors = ContainerUtil.newArrayList(); - List mappers = ContainerUtil.newArrayList(); + List descriptors = new ArrayList<>(); + List mappers = new ArrayList<>(); CodeStylePropertiesUtil.collectMappers(CodeStyle.getDefaultSettings(), mapper -> mappers.add(mapper)); for (AbstractCodeStylePropertyMapper mapper : mappers) { for (String property : mapper.enumProperties()) { diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijPropertyKindMap.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijPropertyKindMap.java index 8da3c8d20662..6af079c3bb4b 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijPropertyKindMap.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/extended/IntellijPropertyKindMap.java @@ -5,10 +5,10 @@ import com.intellij.application.options.codeStyle.properties.AbstractCodeStylePr import com.intellij.lang.Language; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -51,7 +51,7 @@ public class IntellijPropertyKindMap { @NotNull @Override protected List getSupportedFields() { - List descriptors = ContainerUtil.newArrayList(); + List descriptors = new ArrayList<>(); descriptors.add(new CodeStyleObjectDescriptor(new CommonCodeStyleSettings(Language.ANY), null)); descriptors.add(new CodeStyleObjectDescriptor(new CommonCodeStyleSettings.IndentOptions(), null)); return descriptors; diff --git a/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java b/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java index 02aaa69c9259..47a753b724b2 100644 --- a/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java +++ b/plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.actions; import com.intellij.dvcs.actions.DvcsCompareWithBranchAction; @@ -21,7 +7,6 @@ import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcsUtil.VcsUtil; import git4idea.GitBranch; import git4idea.GitContentRevision; @@ -63,7 +48,7 @@ public class GitCompareWithBranchAction extends DvcsCompareWithBranchAction branchNames = ContainerUtil.newArrayList(); + List branchNames = new ArrayList<>(); for (GitBranch branch : localBranches) { branchNames.add(branch.getName()); } diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java b/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java index cee3d46e04db..f785b3e823a2 100644 --- a/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java +++ b/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java @@ -402,7 +402,7 @@ public class GitBranchUtil { } } - Collection branches = ContainerUtil.newArrayList(); + Collection branches = new ArrayList<>(); // standard situation. output example: // master //* my_feature diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java index 1890bd60ed1e..16b2ffa3e95b 100644 --- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java +++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java @@ -17,7 +17,6 @@ import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ArrayUtil; import com.intellij.util.Consumer; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.TimedVcsCommit; import com.intellij.vcs.log.VcsCommitMetadata; import com.intellij.vcs.log.VcsLogObjectsFactory; @@ -92,7 +91,7 @@ public class GitHistoryUtils { public static List collectTimedCommits(@NotNull Project project, @NotNull VirtualFile root, @NotNull String... parameters) throws VcsException { - List commits = ContainerUtil.newArrayList(); + List commits = new ArrayList<>(); loadTimedCommits(project, root, commits::add, parameters); return commits; } @@ -139,7 +138,7 @@ public class GitHistoryUtils { return Collections.emptyList(); } - List commits = ContainerUtil.newArrayList(); + List commits = new ArrayList<>(); try { GitLogUtil.readFullDetails(project, root, commits::add, parameters); } @@ -163,7 +162,7 @@ public class GitHistoryUtils { */ @NotNull public static String[] formHashParameters(@NotNull GitVcs vcs, @NotNull Collection hashes) { - List parameters = ContainerUtil.newArrayList(); + List parameters = new ArrayList<>(); parameters.add(GitLogUtil.getNoWalkParameter(vcs)); parameters.addAll(hashes); diff --git a/plugins/git4idea/src/git4idea/history/GitLogParser.java b/plugins/git4idea/src/git4idea/history/GitLogParser.java index 261d4f3cdb06..d69537e6743d 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogParser.java +++ b/plugins/git4idea/src/git4idea/history/GitLogParser.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.history; import com.intellij.openapi.diagnostic.Logger; @@ -15,10 +15,7 @@ import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicInteger; @@ -113,7 +110,7 @@ public class GitLogParser { @NotNull public List parse(@NotNull CharSequence output) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); List lines = StringUtil.split(output, "\n", true, false); for (CharSequence line : lines) { @@ -445,7 +442,7 @@ public class GitLogParser { } private static class PartialResult { - @NotNull private List myResult = ContainerUtil.newArrayList(); + @NotNull private List myResult = new ArrayList<>(); @NotNull private final StringBuilder myCurrentItem = new StringBuilder(); public void append(char c) { @@ -464,7 +461,7 @@ public class GitLogParser { public void clear() { myCurrentItem.setLength(0); - myResult = ContainerUtil.newArrayList(); + myResult = new ArrayList<>(); } public boolean isEmpty() { diff --git a/plugins/git4idea/src/git4idea/history/GitLogRecord.java b/plugins/git4idea/src/git4idea/history/GitLogRecord.java index 68254d704a29..662bf1c83d73 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogRecord.java +++ b/plugins/git4idea/src/git4idea/history/GitLogRecord.java @@ -1,31 +1,10 @@ -/* - * Copyright 2000-2010 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.history; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.VcsException; -import com.intellij.openapi.vcs.changes.Change; -import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ArrayUtil; import com.intellij.util.containers.ContainerUtil; -import com.intellij.vcs.log.impl.VcsFileStatusInfo; -import com.intellij.vcsUtil.VcsUtil; import git4idea.GitUtil; import git4idea.commands.GitHandler; import org.jetbrains.annotations.NotNull; @@ -180,7 +159,7 @@ class GitLogRecord { if ((startParentheses == -1) || (endParentheses == -1)) return Collections.emptyList(); String refs = decoration.substring(startParentheses + 1, endParentheses); String[] names = refs.split(", "); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (String item : names) { final String POINTER = " -> "; // HEAD -> refs/heads/master in Git 2.4.3+ if (item.contains(POINTER)) { diff --git a/plugins/git4idea/src/git4idea/history/GitLogUtil.java b/plugins/git4idea/src/git4idea/history/GitLogUtil.java index e4c0681cb339..ed33552eb227 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogUtil.java +++ b/plugins/git4idea/src/git4idea/history/GitLogUtil.java @@ -28,10 +28,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; +import java.util.*; import static git4idea.history.GitLogParser.GitLogOption.*; @@ -142,7 +139,7 @@ public class GitLogUtil { } Set refs = new OpenTHashSet<>(GitLogProvider.DONT_CONSIDER_SHA); - List commits = ContainerUtil.newArrayList(); + List commits = new ArrayList<>(); Consumer recordConsumer = record -> { VcsCommitMetadata commit = createMetadata(root, record, factory); commits.add(commit); @@ -192,7 +189,7 @@ public class GitLogUtil { @NotNull VirtualFile root, String... parameters) throws VcsException { - List commits = ContainerUtil.newArrayList(); + List commits = new ArrayList<>(); try { readFullDetails(project, root, commits::add, parameters); } diff --git a/plugins/git4idea/src/git4idea/log/GitLogProvider.java b/plugins/git4idea/src/git4idea/log/GitLogProvider.java index 6c25d6ce42d5..1e25700a831d 100644 --- a/plugins/git4idea/src/git4idea/log/GitLogProvider.java +++ b/plugins/git4idea/src/git4idea/log/GitLogProvider.java @@ -433,7 +433,7 @@ public class GitLogProvider implements VcsLogProvider, VcsIndexableLogProvider { return Collections.emptyList(); } - List filterParameters = ContainerUtil.newArrayList(); + List filterParameters = new ArrayList<>(); VcsLogBranchFilter branchFilter = filterCollection.get(BRANCH_FILTER); VcsLogRevisionFilter revisionFilter = filterCollection.get(REVISION_FILTER); @@ -529,7 +529,7 @@ public class GitLogProvider implements VcsLogProvider, VcsIndexableLogProvider { } } - List commits = ContainerUtil.newArrayList(); + List commits = new ArrayList<>(); GitLogUtil.readTimedCommits(myProject, root, filterParameters, EmptyConsumer.getInstance(), EmptyConsumer.getInstance(), new CollectConsumer<>(commits)); return commits; diff --git a/plugins/git4idea/src/git4idea/log/GitRefManager.java b/plugins/git4idea/src/git4idea/log/GitRefManager.java index 005f8d106586..0944e7ff312f 100644 --- a/plugins/git4idea/src/git4idea/log/GitRefManager.java +++ b/plugins/git4idea/src/git4idea/log/GitRefManager.java @@ -98,8 +98,8 @@ public class GitRefManager implements VcsLogRefManager { @NotNull @Override public List groupForBranchFilter(@NotNull Collection refs) { - List simpleGroups = ContainerUtil.newArrayList(); - List localBranches = ContainerUtil.newArrayList(); + List simpleGroups = new ArrayList<>(); + List localBranches = new ArrayList<>(); MultiMap remoteRefGroups = MultiMap.create(); MultiMap refsByRoot = groupRefsByRoot(refs); @@ -135,7 +135,7 @@ public class GitRefManager implements VcsLogRefManager { } } - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); result.addAll(simpleGroups); if (!localBranches.isEmpty()) result.add(new SimpleRefGroup("Local", localBranches, false)); for (Map.Entry> entry : remoteRefGroups.entrySet()) { @@ -150,7 +150,7 @@ public class GitRefManager implements VcsLogRefManager { List sortedReferences = ContainerUtil.sorted(references, myLabelsComparator); MultiMap groupedRefs = ContainerUtil.groupBy(sortedReferences, VcsRef::getType); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); if (groupedRefs.isEmpty()) return result; VcsRef head = null; @@ -192,7 +192,7 @@ public class GitRefManager implements VcsLogRefManager { @NotNull private static List getTrackedRefs(@NotNull MultiMap groupedRefs, @NotNull GitRepository repository) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); Collection locals = groupedRefs.get(LOCAL_BRANCH); Collection remotes = groupedRefs.get(REMOTE_BRANCH); diff --git a/plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java b/plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java index c74b815617c4..487b83a7d1c5 100644 --- a/plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java +++ b/plugins/git4idea/src/git4idea/log/GitShowExternalLogAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.log; import com.intellij.openapi.Disposable; @@ -56,10 +42,8 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; import java.io.File; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; import java.util.List; +import java.util.*; public class GitShowExternalLogAction extends DumbAwareAction { private static final String EXTERNAL = "EXTERNAL"; @@ -164,7 +148,7 @@ public class GitShowExternalLogAction extends DumbAwareAction { return Collections.emptyList(); } - List correctRoots = ContainerUtil.newArrayList(); + List correctRoots = new ArrayList<>(); for (VirtualFile vf : virtualFiles) { if (GitUtil.isGitRoot(new File(vf.getPath()))) { correctRoots.add(vf); diff --git a/plugins/git4idea/src/git4idea/push/GitPushNativeResultParser.java b/plugins/git4idea/src/git4idea/push/GitPushNativeResultParser.java index 0e230559558f..8dd66109755b 100644 --- a/plugins/git4idea/src/git4idea/push/GitPushNativeResultParser.java +++ b/plugins/git4idea/src/git4idea/push/GitPushNativeResultParser.java @@ -1,25 +1,11 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.push; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -97,7 +83,7 @@ public class GitPushNativeResultParser { @NotNull public static List parse(@NotNull List output) { - List results = ContainerUtil.newArrayList(); + List results = new ArrayList<>(); for (String line : output) { Matcher matcher = PATTERN.matcher(line); if (matcher.matches()) { diff --git a/plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java b/plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java index 6c1b6ecc273a..ccb5c3675c79 100644 --- a/plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java +++ b/plugins/git4idea/src/git4idea/rebase/GitAbortRebaseProcess.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.rebase; import com.intellij.dvcs.DvcsUtil; @@ -24,7 +10,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vcs.VcsNotifier; -import com.intellij.util.containers.ContainerUtil; import git4idea.DialogManager; import git4idea.GitUtil; import git4idea.commands.Git; @@ -36,6 +21,7 @@ import git4idea.util.GitFreezingProcess; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -153,7 +139,7 @@ class GitAbortRebaseProcess { private void doAbort(final boolean rollback) { new GitFreezingProcess(myProject, "rebase", () -> { - List repositoriesToRefresh = ContainerUtil.newArrayList(); + List repositoriesToRefresh = new ArrayList<>(); try (AccessToken ignore = DvcsUtil.workingTreeChangeStarted(myProject, "Rebase")) { if (myRepositoryToAbort != null) { myIndicator.setText2("git rebase --abort" + GitUtil.mention(myRepositoryToAbort)); diff --git a/plugins/git4idea/src/git4idea/rebase/GitInteractiveRebaseFile.java b/plugins/git4idea/src/git4idea/rebase/GitInteractiveRebaseFile.java index bc1aec3555c3..337e72336e83 100644 --- a/plugins/git4idea/src/git4idea/rebase/GitInteractiveRebaseFile.java +++ b/plugins/git4idea/src/git4idea/rebase/GitInteractiveRebaseFile.java @@ -1,25 +1,10 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.rebase; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import git4idea.GitUtil; import git4idea.config.GitConfigUtil; import git4idea.config.GitVersionSpecialty; @@ -28,6 +13,7 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import java.io.*; +import java.util.ArrayList; import java.util.List; class GitInteractiveRebaseFile { @@ -46,7 +32,7 @@ class GitInteractiveRebaseFile { @NotNull public List load() throws IOException, NoopException { String encoding = GitConfigUtil.getLogEncoding(myProject, myRoot); - List entries = ContainerUtil.newArrayList(); + List entries = new ArrayList<>(); final StringScanner s = new StringScanner(FileUtil.loadFile(new File(myFile), encoding)); boolean noop = false; while (s.hasMoreData()) { diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java b/plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java index 5315cc38405c..38a239757cf2 100644 --- a/plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java +++ b/plugins/git4idea/src/git4idea/rebase/GitRebaseEditor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.rebase; import com.intellij.icons.AllIcons; @@ -32,10 +32,7 @@ import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumn; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.*; /** * Interactive rebase editor. It allows reordering of the entries and changing commit status. @@ -444,7 +441,7 @@ public class GitRebaseEditor extends DialogWrapper implements DataProvider { @Override public Collection getTextLinesToCopy() { if (myCommitsTable.getSelectedRowCount() > 0) { - List lines = ContainerUtil.newArrayList(); + List lines = new ArrayList<>(); for (int row : myCommitsTable.getSelectedRows()) { lines.add(myTableModel.getStringToCopy(row)); } diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java b/plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java index df44e33afa3e..7e34180a029b 100644 --- a/plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java +++ b/plugins/git4idea/src/git4idea/rebase/GitRebaseSpec.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.rebase; import com.intellij.dvcs.DvcsUtil; @@ -146,7 +132,7 @@ public class GitRebaseSpec { */ @NotNull public List getIncompleteRepositories() { - List incompleteRepositories = ContainerUtil.newArrayList(); + List incompleteRepositories = new ArrayList<>(); final GitRepository ongoingRebase = getOngoingRebase(); if (ongoingRebase != null) incompleteRepositories.add(ongoingRebase); incompleteRepositories.addAll(DvcsUtil.sortRepositories(ContainerUtil.filter(myStatuses.keySet(), diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java index ebb451c4195b..4c710baf6a71 100644 --- a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java +++ b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java @@ -39,10 +39,7 @@ import git4idea.util.GitPreservingProcess; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.intellij.dvcs.DvcsUtil.getShortRepositoryName; import static git4idea.GitUtil.getRootsFromRepositories; @@ -196,7 +193,7 @@ public class GitUpdateProcess { } // save local changes if needed (update via merge may perform without saving). - final Collection myRootsToSave = ContainerUtil.newArrayList(); + final Collection myRootsToSave = new ArrayList<>(); LOG.info("updateImpl: identifying if save is needed..."); for (Map.Entry entry : updaters.entrySet()) { GitRepository repo = entry.getKey(); @@ -330,7 +327,7 @@ public class GitUpdateProcess { LOG.info("checking tracked branch configuration..."); Map currentBranches = new LinkedHashMap<>(); - List detachedHeads = ContainerUtil.newArrayList(); + List detachedHeads = new ArrayList<>(); for (GitRepository repository : myRepositories) { if (mySubmodulesInDetachedHead.containsKey(repository)) { LOG.debug("Repository " + repository + " is a submodule in detached HEAD state, not checking its tracked branch"); @@ -358,7 +355,7 @@ public class GitUpdateProcess { } Map trackedBranches = new LinkedHashMap<>(); - List noTrackedBranch = ContainerUtil.newArrayList(); + List noTrackedBranch = new ArrayList<>(); for (GitRepository repository: currentBranches.keySet()) { GitLocalBranch branch = currentBranches.get(repository); GitBranchTrackInfo trackInfo = GitBranchUtil.getTrackInfoForBranch(repository, branch); diff --git a/plugins/git4idea/src/git4idea/vfs/GitVFSListener.java b/plugins/git4idea/src/git4idea/vfs/GitVFSListener.java index 35df83555a89..b0370bd29ecd 100644 --- a/plugins/git4idea/src/git4idea/vfs/GitVFSListener.java +++ b/plugins/git4idea/src/git4idea/vfs/GitVFSListener.java @@ -34,7 +34,8 @@ import java.io.File; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; -import static com.intellij.util.containers.ContainerUtil.*; +import static com.intellij.util.containers.ContainerUtil.map; +import static com.intellij.util.containers.ContainerUtil.map2Map; public class GitVFSListener extends VcsVFSListener { /** @@ -204,9 +205,9 @@ public class GitVFSListener extends VcsVFSListener { @Override protected void performMoveRename(@NotNull final List movedFiles) { - List toAdd = newArrayList(); - List toRemove = newArrayList(); - List toForceMove = newArrayList(); + List toAdd = new ArrayList<>(); + List toRemove = new ArrayList<>(); + List toForceMove = new ArrayList<>(); for (MovedFileInfo movedInfo : movedFiles) { String oldPath = movedInfo.myOldPath; String newPath = movedInfo.myNewPath; @@ -223,8 +224,8 @@ public class GitVFSListener extends VcsVFSListener { @Override public void run(@NotNull ProgressIndicator indicator) { try { - List dirtyPaths = newArrayList(); - List toRefresh = newArrayList(); + List dirtyPaths = new ArrayList<>(); + List toRefresh = new ArrayList<>(); //perform adding for (Map.Entry> toAddEntry : GitUtil.sortFilePathsByGitRootIgnoringMissing(myProject, toAdd).entrySet()) { List files = toAddEntry.getValue(); diff --git a/plugins/git4idea/tests/git4idea/log/GitLogProviderTest.java b/plugins/git4idea/tests/git4idea/log/GitLogProviderTest.java index 84a361e099d2..6070bb28de56 100644 --- a/plugins/git4idea/tests/git4idea/log/GitLogProviderTest.java +++ b/plugins/git4idea/tests/git4idea/log/GitLogProviderTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.log; import com.intellij.openapi.components.ServiceManager; @@ -102,7 +102,7 @@ public class GitLogProviderTest extends GitSingleRepoTest { prepareSomeHistory(); createTaggedBranch(); List expectedLog = log(); - List collector = ContainerUtil.newArrayList(); + List collector = new ArrayList<>(); myLogProvider.readAllHashes(projectRoot, new CollectConsumer<>(collector)); assertOrderedEquals(expectedLog, collector); } @@ -257,7 +257,7 @@ public class GitLogProviderTest extends GitSingleRepoTest { prepareLongHistory(15); List log = log(); - final List hashes = ContainerUtil.newArrayList(); + final List hashes = new ArrayList<>(); myLogProvider.readAllHashes(projectRoot, timedVcsCommit -> hashes.add(timedVcsCommit.getId().asString())); List shortDetails = myLogProvider.readMetadata(projectRoot, hashes); @@ -270,10 +270,10 @@ public class GitLogProviderTest extends GitSingleRepoTest { prepareLongHistory(15); List log = log(); - final List hashes = ContainerUtil.newArrayList(); + final List hashes = new ArrayList<>(); myLogProvider.readAllHashes(projectRoot, timedVcsCommit -> hashes.add(timedVcsCommit.getId().asString())); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); myLogProvider.readFullDetails(projectRoot, hashes, result::add); // we do not check for changes here @@ -305,7 +305,7 @@ public class GitLogProviderTest extends GitSingleRepoTest { * @param takeAllUsers if true, don't filter by users, otherwise filter by default user. */ private List generateHistoryForFilters(boolean takeAllUsers, boolean allBranches) { - List hashes = ContainerUtil.newArrayList(); + List hashes = new ArrayList<>(); hashes.add(last(repo)); GitTestUtil.setupUsername(myProject, "bob.smith", "bob.smith@example.com"); diff --git a/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java b/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java index 80a8f6cacd88..e16036696568 100644 --- a/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java +++ b/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.log; import com.intellij.openapi.components.ServiceManager; @@ -13,6 +14,7 @@ import git4idea.test.GitSingleRepoTest; import git4idea.test.GitTestUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; @@ -23,7 +25,7 @@ public abstract class GitRefManagerTest extends GitSingleRepoTest { @NotNull protected Collection given(@NotNull String... refs) { - Collection result = ContainerUtil.newArrayList(); + Collection result = new ArrayList<>(); cd(projectRoot); Hash hash = HashImpl.build(git("rev-parse HEAD")); for (String refName : refs) { diff --git a/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java b/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java index 46b69be8a92a..782285e0853d 100644 --- a/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java +++ b/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.repo; import com.intellij.openapi.application.PluginPathManager; @@ -40,6 +26,7 @@ import org.junit.runners.Parameterized; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -149,7 +136,7 @@ public class GitRepositoryReaderTest extends GitPlatformTest { @NotNull private static Collection readBranches(@NotNull File resultDir, boolean local) throws IOException { String content = FileUtil.loadFile(new File(resultDir, local ? "local-branches.txt" : "remote-branches.txt")); - Collection branches = ContainerUtil.newArrayList(); + Collection branches = new ArrayList<>(); for (String line : StringUtil.splitByLines(content)) { branches.add(readBranchFromLine(line)); } diff --git a/plugins/git4idea/tests/git4idea/validators/GitRefNameValidatorTest.java b/plugins/git4idea/tests/git4idea/validators/GitRefNameValidatorTest.java index 0bd6ba7e14bf..4fffd4ecff83 100644 --- a/plugins/git4idea/tests/git4idea/validators/GitRefNameValidatorTest.java +++ b/plugins/git4idea/tests/git4idea/validators/GitRefNameValidatorTest.java @@ -1,26 +1,12 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package git4idea.validators; import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import java.util.ArrayList; import java.util.Collection; import static org.junit.Assert.assertFalse; @@ -100,7 +86,7 @@ public class GitRefNameValidatorTest { @Parameterized.Parameters(name = "{0}") public static Collection data() { - Collection data = ContainerUtil.newArrayList(); + Collection data = new ArrayList<>(); populateData(data, createValidData(), true); populateData(data, createInvalidData(), false); populateData(data, createInvalidCharsData(), false); @@ -128,7 +114,7 @@ public class GitRefNameValidatorTest { assertInvalid(myRefNameToTest); } } - + private static void assertValid(String branchName) { assertTrue("Should be valid", GitRefNameValidator.getInstance().checkInput(branchName)); assertTrue("Should be valid", GitRefNameValidator.getInstance().canClose(branchName)); diff --git a/plugins/gradle/java/src/codeInspection/MultipleRepositoryUrlsInspection.java b/plugins/gradle/java/src/codeInspection/MultipleRepositoryUrlsInspection.java index e4bdb0e10391..563176f904de 100644 --- a/plugins/gradle/java/src/codeInspection/MultipleRepositoryUrlsInspection.java +++ b/plugins/gradle/java/src/codeInspection/MultipleRepositoryUrlsInspection.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.codeInspection; import com.intellij.codeInspection.LocalQuickFix; @@ -21,7 +7,6 @@ import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.ArrayUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.gradle.util.GradleConstants; @@ -32,6 +17,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethod import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrCallExpression; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -101,7 +87,7 @@ public class MultipleRepositoryUrlsInspection extends GradleBaseInspection { GrCallExpression[] applicationStatements = PsiTreeUtil.getChildrenOfType(closure, GrCallExpression.class); if (applicationStatements == null) return Collections.emptyList(); - List statements = ContainerUtil.newArrayList(); + List statements = new ArrayList<>(); for (GrCallExpression statement : applicationStatements) { GrReferenceExpression[] referenceExpressions = PsiTreeUtil.getChildrenOfType(statement, GrReferenceExpression.class); if (referenceExpressions == null) continue; diff --git a/plugins/gradle/java/src/compiler/GradleBuildProcessParametersProvider.java b/plugins/gradle/java/src/compiler/GradleBuildProcessParametersProvider.java index b716a78d65ee..f2b711505874 100644 --- a/plugins/gradle/java/src/compiler/GradleBuildProcessParametersProvider.java +++ b/plugins/gradle/java/src/compiler/GradleBuildProcessParametersProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.compiler; import com.google.gson.Gson; @@ -30,6 +16,7 @@ import org.jetbrains.plugins.gradle.settings.GradleSettings; import org.slf4j.Logger; import org.slf4j.impl.Log4jLoggerFactory; +import java.util.ArrayList; import java.util.List; /** @@ -49,7 +36,7 @@ public class GradleBuildProcessParametersProvider extends BuildProcessParameters @Override @NotNull public List getClassPath() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); if (!GradleSettings.getInstance(myProject).getLinkedProjectsSettings().isEmpty()) { addGradleClassPath(result); addOtherClassPath(result); @@ -59,7 +46,7 @@ public class GradleBuildProcessParametersProvider extends BuildProcessParameters private void addGradleClassPath(@NotNull final List classpath) { if (myGradleClasspath == null) { - myGradleClasspath = ContainerUtil.newArrayList(); + myGradleClasspath = new ArrayList<>(); String gradleToolingApiJarPath = PathUtil.getJarPathForClass(ProjectConnection.class); if (!StringUtil.isEmpty(gradleToolingApiJarPath)) { myGradleClasspath.add(gradleToolingApiJarPath); diff --git a/plugins/gradle/java/src/integrations/javaee/JavaEEGradleProjectResolverExtension.java b/plugins/gradle/java/src/integrations/javaee/JavaEEGradleProjectResolverExtension.java index 3756cfc8bbbf..21bfe0617ccc 100644 --- a/plugins/gradle/java/src/integrations/javaee/JavaEEGradleProjectResolverExtension.java +++ b/plugins/gradle/java/src/integrations/javaee/JavaEEGradleProjectResolverExtension.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.integrations.javaee; import com.intellij.openapi.externalSystem.model.DataNode; @@ -121,7 +107,7 @@ public class JavaEEGradleProjectResolverExtension extends AbstractProjectResolve if (projectDataNode != null) { List, EarConfiguration>> ears = projectDataNode.getUserData(EAR_CONFIGURATIONS); if (ears == null) { - ears = ContainerUtil.newArrayList(); + ears = new ArrayList<>(); projectDataNode.putUserData(EAR_CONFIGURATIONS, ears); } ears.add(Pair.create(findTargetModuleNode.getValue(), earConfiguration)); diff --git a/plugins/gradle/java/src/integrations/maven/ImportMavenRepositoriesTask.java b/plugins/gradle/java/src/integrations/maven/ImportMavenRepositoriesTask.java index f0ec225ac5e3..8797e807f689 100644 --- a/plugins/gradle/java/src/integrations/maven/ImportMavenRepositoriesTask.java +++ b/plugins/gradle/java/src/integrations/maven/ImportMavenRepositoriesTask.java @@ -33,10 +33,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals import java.net.URI; import java.net.URISyntaxException; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; /** @@ -61,7 +58,7 @@ class ImportMavenRepositoriesTask { private void performTask() { final LocalFileSystem localFileSystem = LocalFileSystem.getInstance(); - final List psiFileList = ContainerUtil.newArrayList(); + final List psiFileList = new ArrayList<>(); final ModuleManager moduleManager = ModuleManager.getInstance(myProject); for (Module module : moduleManager.getModules()) { @@ -87,7 +84,7 @@ class ImportMavenRepositoriesTask { final Set mavenRemoteRepositories = ReadAction.compute(() -> { Set myRemoteRepositories = new HashSet<>(); for (PsiFile psiFile : psiFiles) { - List repositoriesBlocks = ContainerUtil.newArrayList(); + List repositoriesBlocks = new ArrayList<>(); repositoriesBlocks.addAll(findClosableBlocks(psiFile, "repositories")); for (GrClosableBlock closableBlock : findClosableBlocks(psiFile, "buildscript", "subprojects", "allprojects", "project", diff --git a/plugins/gradle/java/src/service/GradleBuildClasspathManager.java b/plugins/gradle/java/src/service/GradleBuildClasspathManager.java index cc6c9f40a3c4..8261dc518106 100644 --- a/plugins/gradle/java/src/service/GradleBuildClasspathManager.java +++ b/plugins/gradle/java/src/service/GradleBuildClasspathManager.java @@ -40,7 +40,7 @@ public class GradleBuildClasspathManager { public GradleBuildClasspathManager(@NotNull Project project) { myProject = project; - allFilesCache = ContainerUtil.newArrayList(); + allFilesCache = new ArrayList<>(); } @NotNull @@ -57,7 +57,7 @@ public class GradleBuildClasspathManager { final JarFileSystem jarFileSystem = JarFileSystem.getInstance(); for (final ExternalProjectBuildClasspathPojo projectBuildClasspathPojo : localSettings.getProjectBuildClasspath().values()) { - final List projectBuildClasspath = ContainerUtil.newArrayList(); + final List projectBuildClasspath = new ArrayList<>(); for (String path : projectBuildClasspathPojo.getProjectBuildClasspath()) { final VirtualFile virtualFile = ExternalSystemUtil.findLocalFileByPath(path); ContainerUtil.addIfNotNull(projectBuildClasspath, diff --git a/plugins/gradle/java/src/service/project/data/BuildClasspathModuleGradleDataService.java b/plugins/gradle/java/src/service/project/data/BuildClasspathModuleGradleDataService.java index 319e6aa44bc9..76da6f89c142 100644 --- a/plugins/gradle/java/src/service/project/data/BuildClasspathModuleGradleDataService.java +++ b/plugins/gradle/java/src/service/project/data/BuildClasspathModuleGradleDataService.java @@ -120,7 +120,7 @@ public class BuildClasspathModuleGradleDataService extends AbstractProjectDataSe ExternalProjectBuildClasspathPojo projectBuildClasspathPojo = localProjectBuildClasspath.get(linkedExternalProjectPath); if (projectBuildClasspathPojo == null) { projectBuildClasspathPojo = new ExternalProjectBuildClasspathPojo( - moduleDataNode.getData().getExternalName(), ContainerUtil.newArrayList(), new HashMap<>()); + moduleDataNode.getData().getExternalName(), new ArrayList<>(), new HashMap<>()); localProjectBuildClasspath.put(linkedExternalProjectPath, projectBuildClasspathPojo); } diff --git a/plugins/gradle/java/src/service/project/wizard/GradleFrameworksWizardStep.java b/plugins/gradle/java/src/service/project/wizard/GradleFrameworksWizardStep.java index 534fb7ac3cf3..fac39907f4e8 100644 --- a/plugins/gradle/java/src/service/project/wizard/GradleFrameworksWizardStep.java +++ b/plugins/gradle/java/src/service/project/wizard/GradleFrameworksWizardStep.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.service.project.wizard; import com.intellij.framework.addSupport.FrameworkSupportInModuleProvider; @@ -26,6 +26,7 @@ import org.jetbrains.plugins.gradle.frameworkSupport.KotlinDslGradleFrameworkSup import javax.swing.*; import java.awt.*; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; @@ -86,13 +87,13 @@ public class GradleFrameworksWizardStep extends ModuleWizardStep implements Disp } private void setKotlinDslGradleFrameworkSupportProviders(Set selectedNodeIds) { - List providers = ContainerUtil.newArrayList(); + List providers = new ArrayList<>(); Collections.addAll(providers, KotlinDslGradleFrameworkSupportProvider.EP_NAME.getExtensions()); myFrameworksPanel.setProviders(providers, Collections.emptySet(), selectedNodeIds); } private void setGradleFrameworkSupportProviders(Set selectedNodeIds) { - List providers = ContainerUtil.newArrayList(); + List providers = new ArrayList<>(); Collections.addAll(providers, GradleFrameworkSupportProvider.EP_NAME.getExtensions()); myFrameworksPanel.setProviders(providers, Collections.emptySet(), selectedNodeIds); } diff --git a/plugins/gradle/java/testSources/importing/GradleFindUsagesTest.java b/plugins/gradle/java/testSources/importing/GradleFindUsagesTest.java index c7c1a1e7516c..9413ade7b592 100644 --- a/plugins/gradle/java/testSources/importing/GradleFindUsagesTest.java +++ b/plugins/gradle/java/testSources/importing/GradleFindUsagesTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.importing; import com.intellij.openapi.module.Module; @@ -11,7 +11,6 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiMethod; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.usageView.UsageInfo; -import com.intellij.util.containers.ContainerUtil; import org.gradle.initialization.BuildLayoutParameters; import org.gradle.wrapper.PathAssembler; import org.jetbrains.annotations.NotNull; @@ -21,6 +20,7 @@ import org.junit.runners.Parameterized; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -224,7 +224,7 @@ public class GradleFindUsagesTest extends GradleImportingTestCase { PsiClass aClass = psiClasses[0]; if (methodName != null) { PsiMethod[] methods = runInEdtAndGet(() -> aClass.findMethodsByName(methodName, false)); - List actualUsages = ContainerUtil.newArrayList(); + List actualUsages = new ArrayList<>(); for (PsiMethod method : methods) { actualUsages.addAll(findUsages(method)); } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/BuildScriptDataBuilder.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/BuildScriptDataBuilder.java index f0903b7a4f35..9e583e6872bc 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/BuildScriptDataBuilder.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/frameworkSupport/BuildScriptDataBuilder.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.frameworkSupport; import com.intellij.openapi.util.text.StringUtil; @@ -22,6 +8,7 @@ import com.intellij.util.containers.ContainerUtil; import org.gradle.util.GradleVersion; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -78,7 +65,7 @@ public class BuildScriptDataBuilder { } public String buildConfigurationPart() { - List lines = ContainerUtil.newArrayList(); + List lines = new ArrayList<>(); addBuildscriptLines(lines, BuildScriptDataBuilder::padding); if (!pluginsInGroup.isEmpty()) { lines.add("plugins {"); @@ -90,7 +77,7 @@ public class BuildScriptDataBuilder { } public String buildMainPart() { - List lines = ContainerUtil.newArrayList(); + List lines = new ArrayList<>(); addPluginsLines(lines, BuildScriptDataBuilder::padding); if (!properties.isEmpty()) { lines.addAll(properties); diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/internal/daemon/DaemonsUi.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/internal/daemon/DaemonsUi.java index 54aceed5a9bd..2012a4641bb8 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/internal/daemon/DaemonsUi.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/internal/daemon/DaemonsUi.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.internal.daemon; import com.intellij.execution.util.ListTableWithButtons; @@ -31,6 +31,7 @@ import javax.swing.event.ListSelectionListener; import javax.swing.table.TableCellRenderer; import java.awt.*; import java.awt.event.ActionEvent; +import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.List; @@ -195,7 +196,7 @@ public class DaemonsUi implements Disposable { } }; ColumnInfo[] columnInfos = new ColumnInfo[]{pidColumn, statusColumn, infoColumn, timeColumn}; - return new ListTableModel(columnInfos, ContainerUtil.newArrayList(), 3, SortOrder.DESCENDING); + return new ListTableModel(columnInfos, new ArrayList<>(), 3, SortOrder.DESCENDING); } @Override diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/model/data/CompositeBuildData.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/model/data/CompositeBuildData.java index 06ce4c263be5..fe55c8e8d0bb 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/model/data/CompositeBuildData.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/model/data/CompositeBuildData.java @@ -1,26 +1,12 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.model.data; import com.intellij.openapi.externalSystem.model.Key; import com.intellij.openapi.externalSystem.model.ProjectKeys; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -32,7 +18,7 @@ public class CompositeBuildData implements Serializable { public static final Key KEY = Key.create(CompositeBuildData.class, ProjectKeys.PROJECT.getProcessingWeight() + 1); private final String myRootProjectPath; - @NotNull private final List myCompositeParticipants = ContainerUtil.newArrayList(); + @NotNull private final List myCompositeParticipants = new ArrayList<>(); public CompositeBuildData(String rootProjectPath) { myRootProjectPath = rootProjectPath; diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleArgumentsCompletionProvider.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleArgumentsCompletionProvider.java index 7491a674065b..7eb9bed44027 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleArgumentsCompletionProvider.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleArgumentsCompletionProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.service.execution; import com.intellij.codeInsight.lookup.LookupElement; @@ -12,12 +12,12 @@ import com.intellij.openapi.externalSystem.service.execution.TaskCompletionProvi import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil; import com.intellij.openapi.project.Project; import com.intellij.ui.TextAccessor; -import com.intellij.util.containers.ContainerUtil; import icons.ExternalSystemIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.gradle.service.execution.cmd.GradleCommandLineOptionsProvider; import org.jetbrains.plugins.gradle.util.GradleConstants; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -41,7 +41,7 @@ public class GradleArgumentsCompletionProvider extends TaskCompletionProvider { final ModuleData moduleData = moduleDataNode.getData(); final boolean isRoot = projectDataNode.getData().getLinkedExternalProjectPath().equals(moduleData.getLinkedExternalProjectPath()); final Collection> tasks = ExternalSystemApiUtil.getChildren(moduleDataNode, ProjectKeys.TASK); - List elements = ContainerUtil.newArrayListWithCapacity(tasks.size()); + List elements = new ArrayList<>(tasks.size()); for (DataNode taskDataNode : tasks) { final TaskData taskData = taskDataNode.getData(); diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java index 4c411a04d5c8..d4b6bfb6db54 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java @@ -144,7 +144,7 @@ public class GradleExecutionHelper { } } - List filteredArgs = ContainerUtil.newArrayList(); + List filteredArgs = new ArrayList<>(); if (!settings.getArguments().isEmpty()) { String loggableArgs = StringUtil.join(obfuscatePasswordParameters(settings.getArguments()), " "); LOG.info("Passing command-line args to Gradle Tooling API: " + loggableArgs); @@ -718,7 +718,7 @@ public class GradleExecutionHelper { @NotNull ExternalSystemTaskNotificationListener listener, @NotNull List extraJvmArgs) { ModelBuilder result = connection.model(modelType); - prepare(result, id, settings, listener, extraJvmArgs, ContainerUtil.newArrayList(), connection); + prepare(result, id, settings, listener, extraJvmArgs, new ArrayList<>(), connection); return result; } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java index ae5ea4656fed..f4e6379e303e 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java @@ -599,7 +599,7 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver if (dependencies == null) return; - List orphanModules = ContainerUtil.newArrayList(); + List orphanModules = new ArrayList<>(); Map modulesIndex = new HashMap<>(); for (DataNode dataNode : ExternalSystemApiUtil.getChildren(ideProject, ProjectKeys.MODULE)) { @@ -659,7 +659,7 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver @NotNull DataNode ideProject) throws IllegalArgumentException, IllegalStateException { - final Collection tasks = ContainerUtil.newArrayList(); + final Collection tasks = new ArrayList<>(); final String moduleConfigPath = ideModule.getData().getLinkedExternalProjectPath(); ExternalProject externalProject = resolverCtx.getExtraProject(gradleModule, ExternalProject.class); @@ -772,7 +772,7 @@ public class BaseGradleProjectResolverExtension implements GradleProjectResolver @Override public List> getExtraJvmArgs() { if (ExternalSystemApiUtil.isInProcessMode(GradleConstants.SYSTEM_ID)) { - final List> extraJvmArgs = ContainerUtil.newArrayList(); + final List> extraJvmArgs = new ArrayList<>(); final HttpConfigurable httpConfigurable = HttpConfigurable.getInstance(); if (!StringUtil.isEmpty(httpConfigurable.PROXY_EXCEPTIONS)) { diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleBuildSrcProjectsResolver.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleBuildSrcProjectsResolver.java index e2f550f0a301..5c35b6908ad8 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleBuildSrcProjectsResolver.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleBuildSrcProjectsResolver.java @@ -258,7 +258,7 @@ public class GradleBuildSrcProjectsResolver { if (!buildSrcRuntimeSourcesPaths.isEmpty() || !buildSrcRuntimeClassesPaths.isEmpty()) { buildClasspathNodes.forEach(classpathNode -> { BuildScriptClasspathData data = classpathNode.getData(); - List classpathEntries = ContainerUtil.newArrayList(); + List classpathEntries = new ArrayList<>(); classpathEntries.addAll(data.getClasspathEntries()); classpathEntries.add(new BuildScriptClasspathData.ClasspathEntry( new HashSet<>(buildSrcRuntimeClassesPaths), diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverUtil.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverUtil.java index f49dee17fa3a..58243787378b 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverUtil.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverUtil.java @@ -537,7 +537,7 @@ public class GradleProjectResolverUtil { final ExternalProjectDependency projectDependency = (ExternalProjectDependency)mergedDependency; - Collection projectDependencyInfos = ContainerUtil.newArrayList(); + Collection projectDependencyInfos = new ArrayList<>(); String selectionReason = projectDependency.getSelectionReason(); if ("composite build substitution".equals(selectionReason) && resolverCtx.getSettings() != null) { GradleExecutionWorkspace executionWorkspace = resolverCtx.getSettings().getExecutionWorkspace(); diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/GradleConfigLocator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/GradleConfigLocator.java index 354ee23ca3c7..f0069a318bcf 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/GradleConfigLocator.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/GradleConfigLocator.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.service.settings; import com.intellij.openapi.externalSystem.model.ProjectSystemId; @@ -5,13 +6,13 @@ import com.intellij.openapi.externalSystem.service.settings.ExternalSystemConfig import com.intellij.openapi.externalSystem.settings.ExternalProjectSettings; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import org.gradle.tooling.GradleConnector; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.gradle.util.GradleConstants; import java.io.File; +import java.util.ArrayList; import java.util.List; /** @@ -63,7 +64,7 @@ public class GradleConfigLocator implements ExternalSystemConfigLocator { @NotNull @Override public List findAll(@NotNull ExternalProjectSettings externalProjectSettings) { - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); for (String path : externalProjectSettings.getModules()) { VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path)); if (vFile != null) { diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java index c6725c3a48a4..9e0484b2e23d 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java @@ -155,7 +155,7 @@ public class GradleTaskManager extends BaseExternalSystemTaskManager taskNames, @Nullable String jvmAgentSetup, @NotNull GradleExecutionSettings effectiveSettings) { - final List initScripts = newArrayList(); + final List initScripts = new ArrayList<>(); final GradleProjectResolverExtension projectResolverChain = GradleProjectResolver.createProjectResolverChain(effectiveSettings); for (GradleProjectResolverExtension resolverExtension = projectResolverChain; resolverExtension != null; diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleExecutionWorkspace.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleExecutionWorkspace.java index 7a5ea5d0cf91..35d7615880f0 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleExecutionWorkspace.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleExecutionWorkspace.java @@ -1,25 +1,10 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.settings; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.externalSystem.model.DataNode; import com.intellij.openapi.externalSystem.model.project.ModuleData; import com.intellij.openapi.util.Pair; -import com.intellij.util.containers.ContainerUtil; import org.gradle.tooling.model.idea.IdeaModule; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,10 +13,7 @@ import org.jetbrains.plugins.gradle.service.project.ProjectResolverContext; import java.io.File; import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -42,7 +24,7 @@ public class GradleExecutionWorkspace implements Serializable { private static final Logger LOG = Logger.getInstance(GradleExecutionWorkspace.class); @NotNull - private final List myBuildParticipants = ContainerUtil.newArrayList(); + private final List myBuildParticipants = new ArrayList<>(); private Map, IdeaModule>>> myModuleNameIndex = Collections.emptyMap(); private Map, IdeaModule>> myModuleIdIndex; diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleProjectSettings.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleProjectSettings.java index 4633213acdb5..65fc922f281d 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleProjectSettings.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/settings/GradleProjectSettings.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.settings; import com.intellij.openapi.externalSystem.service.execution.ExternalSystemJdkUtil; @@ -18,6 +18,7 @@ import org.jetbrains.plugins.gradle.model.data.BuildParticipant; import org.jetbrains.plugins.gradle.service.GradleInstallationManager; import org.jetbrains.plugins.gradle.service.settings.GradleSettingsService; +import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -206,7 +207,7 @@ public class GradleProjectSettings extends ExternalProjectSettings { @NotNull public CompositeBuild copy() { CompositeBuild result = new CompositeBuild(); - result.myCompositeParticipants = ContainerUtil.newArrayList(); + result.myCompositeParticipants = new ArrayList<>(); for (BuildParticipant participant : myCompositeParticipants) { result.myCompositeParticipants.add(participant.copy()); } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectCompositeSelectorDialog.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectCompositeSelectorDialog.java index 80a89fc9cf6c..8073f1f52b10 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectCompositeSelectorDialog.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/ui/GradleProjectCompositeSelectorDialog.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.ui; import com.intellij.icons.AllIcons; @@ -42,6 +28,7 @@ import javax.swing.*; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeModel; import javax.swing.tree.TreeNode; +import java.util.ArrayList; import java.util.List; import static com.intellij.openapi.util.io.FileUtil.pathsEqual; @@ -121,7 +108,7 @@ public class GradleProjectCompositeSelectorDialog extends DialogWrapper { private CheckboxTree createTree() { final CheckedTreeNode root = new CheckedTreeNode(); if (myCompositeRootSettings != null) { - List nodes = ContainerUtil.newArrayList(); + List nodes = new ArrayList<>(); for (GradleProjectSettings projectSettings : GradleSettings.getInstance(myProject).getLinkedProjectsSettings()) { if (projectSettings == myCompositeRootSettings) continue; if (projectSettings.getCompositeBuild() != null && diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleDependenciesImportingTest.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleDependenciesImportingTest.java index 276e9f7a4c68..ed3f23366082 100644 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleDependenciesImportingTest.java +++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleDependenciesImportingTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.importing; import com.intellij.execution.executors.DefaultRunExecutor; @@ -25,14 +11,10 @@ import com.intellij.openapi.externalSystem.service.notification.ExternalSystemPr import com.intellij.openapi.externalSystem.util.ExternalSystemUtil; import com.intellij.openapi.module.Module; import com.intellij.openapi.roots.*; -import com.intellij.openapi.roots.impl.ModuleOrderEntryImpl; -import com.intellij.openapi.roots.impl.OrderEntryUtil; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.ArrayUtil; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import org.gradle.util.GradleVersion; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NonNls; @@ -43,10 +25,7 @@ import org.junit.Test; import java.io.File; import java.io.IOException; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import static com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.*; @@ -104,7 +83,7 @@ public class GradleDependenciesImportingTest extends GradleImportingTestCase { notificationManager.removeNotificationListener(listener); } - List ideClasspath = ContainerUtil.newArrayList(); + List ideClasspath = new ArrayList<>(); ModuleRootManager.getInstance(module).orderEntries().withoutSdk().withoutModuleSourceEntries().compileOnly().productionOnly().forEach( entry -> { if (entry instanceof ModuleOrderEntry) { @@ -1540,7 +1519,7 @@ public class GradleDependenciesImportingTest extends GradleImportingTestCase { } assertMergedModuleCompileLibDepScope("project", depName); } - + @Test @TargetVersions("4.6+") public void testAnnotationProcessorDependencies() throws Exception { diff --git a/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImplTest.java b/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImplTest.java index 54902cd9ca90..74973604f802 100644 --- a/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImplTest.java +++ b/plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImplTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.tooling.builder; import com.intellij.openapi.util.io.FileUtil; @@ -57,11 +43,11 @@ public class ModuleExtendedModelBuilderImplTest extends AbstractModelBuilderTest assertNotNull(moduleExtendedModel); - List sourceDirectories = ContainerUtil.newArrayList(); - List resourceDirectories = ContainerUtil.newArrayList(); - List testResourceDirectories = ContainerUtil.newArrayList(); - List testDirectories = ContainerUtil.newArrayList(); - List excludeDirectories = ContainerUtil.newArrayList(); + List sourceDirectories = new ArrayList<>(); + List resourceDirectories = new ArrayList<>(); + List testResourceDirectories = new ArrayList<>(); + List testDirectories = new ArrayList<>(); + List excludeDirectories = new ArrayList<>(); fillDirectories(moduleExtendedModel, sourceDirectories, resourceDirectories, diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/checkers/GrAliasAnnotationChecker.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/checkers/GrAliasAnnotationChecker.java index eae8cc7a068d..5bae0222fb9e 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/checkers/GrAliasAnnotationChecker.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/checkers/GrAliasAnnotationChecker.java @@ -1,10 +1,9 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.annotator.checkers; import com.intellij.lang.annotation.AnnotationHolder; import com.intellij.psi.PsiAnnotation; import com.intellij.psi.PsiElement; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.GroovyBundle; @@ -41,7 +40,7 @@ public class GrAliasAnnotationChecker extends CustomAnnotationChecker { final PsiAnnotation annotationCollector = GrAnnotationCollector.findAnnotationCollector(annotation); if (annotationCollector == null) return null; - final ArrayList aliasedAnnotations = ContainerUtil.newArrayList(); + final ArrayList aliasedAnnotations = new ArrayList<>(); GrAnnotationCollector.collectAnnotations(aliasedAnnotations, annotation, annotationCollector); return aliasedAnnotations; } @@ -53,7 +52,7 @@ public class GrAliasAnnotationChecker extends CustomAnnotationChecker { return false; } - final ArrayList annotations = ContainerUtil.newArrayList(); + final ArrayList annotations = new ArrayList<>(); final Set usedAttributes = GrAnnotationCollector.collectAnnotations(annotations, annotation, annotationCollector); AliasedAnnotationHolder aliasedHolder = new AliasedAnnotationHolder(holder, annotation); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspectionBase.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspectionBase.java index c53b046b4763..933fb4ee1ed3 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspectionBase.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspectionBase.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.codeInspection.confusing; import com.intellij.codeInspection.LocalQuickFix; @@ -34,6 +20,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefini import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrTraitMethod; import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -44,13 +31,13 @@ public abstract class ClashingTraitMethodsInspectionBase extends BaseInspection protected static List collectClassingMethods(@NotNull GrTypeDefinition typeDefinition) { Collection visibleSignatures = typeDefinition.getVisibleSignatures(); - List clashingMethods = ContainerUtil.newArrayList(); + List clashingMethods = new ArrayList<>(); for (HierarchicalMethodSignature signature : visibleSignatures) { PsiMethod method = signature.getMethod(); if (method instanceof GrTraitMethod && method.getContainingClass() == typeDefinition) { List superSignatures = signature.getSuperSignatures(); if (superSignatures.size() > 1) { - List traits = ContainerUtil.newArrayList(); + List traits = new ArrayList<>(); for (HierarchicalMethodSignature superSignature : superSignatures) { PsiMethod superMethod = superSignature.getMethod(); PsiClass superClass = superMethod.getContainingClass(); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/control/finalVar/InvalidWriteAccessSearcher.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/control/finalVar/InvalidWriteAccessSearcher.java index c4021e693103..6b18dd598e7e 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/control/finalVar/InvalidWriteAccessSearcher.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/control/finalVar/InvalidWriteAccessSearcher.java @@ -1,7 +1,6 @@ // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.codeInspection.control.finalVar; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable; @@ -13,6 +12,7 @@ import org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAEngine; import org.jetbrains.plugins.groovy.lang.psi.dataFlow.DfaInstance; import org.jetbrains.plugins.groovy.lang.psi.dataFlow.Semilattice; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -31,7 +31,7 @@ public class InvalidWriteAccessSearcher { if (dfaResult == null) return null; - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); Set descriptors = variables.stream() .map(VariableDescriptorFactory::createDescriptor) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyStaticTypeCheckVisitor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyStaticTypeCheckVisitor.java index a1352556b5a4..a4a880253b97 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyStaticTypeCheckVisitor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyStaticTypeCheckVisitor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.codeInspection.type; import com.intellij.codeInsight.intention.IntentionAction; @@ -30,7 +16,6 @@ import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiType; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.GroovyBundle; @@ -43,6 +28,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpres import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrTupleAssignmentExpression; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrCallExpression; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -102,7 +88,7 @@ public class GroovyStaticTypeCheckVisitor extends GroovyTypeCheckVisitor { @Nullable final LocalQuickFix[] fixes, final ProblemHighlightType highlightType) { if (highlightType != ProblemHighlightType.GENERIC_ERROR) return; - final List intentions = ContainerUtil.newArrayList(); + final List intentions = new ArrayList<>(); if (fixes != null) { for (final LocalQuickFix fix : fixes) { intentions.add(new IntentionAction() { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitor.java index 310ed9bad8bd..22ef71ebce10 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitor.java @@ -62,10 +62,7 @@ import org.jetbrains.plugins.groovy.lang.resolve.api.Applicability; import org.jetbrains.plugins.groovy.lang.resolve.api.GroovyCallReference; import org.jetbrains.plugins.groovy.lang.resolve.api.GroovyMethodCallReference; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import static com.intellij.psi.util.PsiUtil.extractIterableTypeParameter; import static org.jetbrains.plugins.groovy.codeInspection.type.GroovyTypeCheckVisitorHelper.*; @@ -515,7 +512,7 @@ public class GroovyTypeCheckVisitor extends BaseInspectionVisitor { final ConversionResult result = TypesUtil.canAssign(expectedType, actualType, context, position); if (result == ConversionResult.OK) return; - final List fixes = ContainerUtil.newArrayList(); + final List fixes = new ArrayList<>(); { fixes.add(new GrCastFix(expectedType, expression)); final String varName = getLValueVarName(toHighlight); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitorHelper.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitorHelper.java index 927d1506c9d5..0254f3b03c59 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitorHelper.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/type/GroovyTypeCheckVisitorHelper.java @@ -39,10 +39,10 @@ import java.util.Collections; import java.util.List; public class GroovyTypeCheckVisitorHelper { - - @SuppressWarnings("unchecked") + + @SuppressWarnings("unchecked") private static final Function id = (Function)Function.ID; - + @Nullable @Contract("null -> null") protected static GrListOrMap getTupleInitializer(@Nullable GrExpression initializer) { @@ -156,7 +156,7 @@ public class GroovyTypeCheckVisitorHelper { @Nullable public static List getExpressionArgumentsOfCall(@NotNull GrArgumentList argumentList) { - final ArrayList args = ContainerUtil.newArrayList(); + final ArrayList args = new ArrayList<>(); for (GroovyPsiElement arg : argumentList.getAllArguments()) { if (arg instanceof GrSpreadArgument) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMMemberContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMMemberContributor.java index e26ca226e15e..a97d54aaf309 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMMemberContributor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMMemberContributor.java @@ -17,6 +17,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentMap; @@ -59,7 +60,7 @@ public class DGMMemberContributor { @NotNull private static List calcGdkMethods(Project project, GlobalSearchScope resolveScope) { - List gdkMethods = ContainerUtil.newArrayList(); + List gdkMethods = new ArrayList<>(); JavaPsiFacade facade = JavaPsiFacade.getInstance(project); Couple> extensions = collectExtensions(project, resolveScope); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java index a12c0e3b2be2..67a66f8dcd2d 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java @@ -176,7 +176,7 @@ public class GroovyDslFileIndex extends ScalarIndexExtension { final String filePath = virtualFile.getPath(); - List> supers = ContainerUtil.newArrayList(); + List> supers = new ArrayList<>(); final Project project = scriptFile.getProject(); for (GroovyDslScript script : getDslScripts(project)) { final MultiMap staticInfo = script.getStaticInfo(); @@ -268,14 +268,14 @@ public class GroovyDslFileIndex extends ScalarIndexExtension { } private static List getGdslFiles(final Project project) { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); result.addAll(bundledGdslFiles.getValue()); result.addAll(getProjectGdslFiles(project)); return result; } private static final NotNullLazyValue> bundledGdslFiles = NotNullLazyValue.createValue(() -> { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); for (File file : getBundledScriptFolders()) { if (file.exists()) { File[] children = file.listFiles(); @@ -295,7 +295,7 @@ public class GroovyDslFileIndex extends ScalarIndexExtension { }); private static List getProjectGdslFiles(Project project) { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); final GlobalSearchScope scope = GlobalSearchScope.allScope(project); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppReferenceContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppReferenceContributor.java index 406cec1093bc..e3301ff74be3 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppReferenceContributor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/gpp/GppReferenceContributor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.gpp; import com.intellij.openapi.util.Pair; @@ -22,7 +8,6 @@ import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.PropertyUtilBase; import com.intellij.util.ArrayUtil; import com.intellij.util.ProcessingContext; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.findUsages.LiteralConstructorReference; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap; @@ -32,6 +17,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpres import org.jetbrains.plugins.groovy.lang.psi.impl.GrClosureType; import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames; +import java.util.ArrayList; import java.util.List; /** @@ -102,10 +88,10 @@ public class GppReferenceContributor extends PsiReferenceContributor { private List addMethodCandidates(PsiClassType classType, GrExpression value) { PsiType valueType = value == null ? null : value.getType(); - final List applicable = ContainerUtil.newArrayList(); + final List applicable = new ArrayList<>(); if (value == null || InheritanceUtil.isInheritor(valueType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE)) { - final List byName = ContainerUtil.newArrayList(); + final List byName = new ArrayList<>(); for (Pair variant : GppClosureParameterTypeProvider.getMethodsToOverrideImplementInInheritor(classType, false)) { final PsiMethod method = variant.first; if (getValue().equals(method.getName())) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ControlFlowBuilder.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ControlFlowBuilder.java index 9d89ae2bf304..62efb0e9c0aa 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ControlFlowBuilder.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/controlFlow/impl/ControlFlowBuilder.java @@ -11,7 +11,6 @@ import com.intellij.psi.*; import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtilCore; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.FList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -833,11 +832,11 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor { private List> collectCorrespondingPendingEdges(@Nullable PsiElement currentScope) { if (currentScope == null) { List> result = myPending; - myPending = ContainerUtil.newArrayList(); + myPending = new ArrayList<>(); return result; } else { - ArrayList> targets = ContainerUtil.newArrayList(); + ArrayList> targets = new ArrayList<>(); for (int i = myPending.size() - 1; i >= 0; i--) { final Pair pair = myPending.get(i); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java index c8cf084c26df..f1c56f03c9dd 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.psi.expectedTypes; import com.intellij.openapi.util.Pair; @@ -65,7 +65,7 @@ public class GroovyExpectedTypesProvider { } final TypeConstraint[] result = calculator.getResult(); - List custom = ContainerUtil.newArrayList(); + List custom = new ArrayList<>(); for (GroovyExpectedTypesContributor contributor : GroovyExpectedTypesContributor.EP_NAME.getExtensions()) { custom.addAll(contributor.calculateTypeConstraints(expression)); } @@ -331,7 +331,7 @@ public class GroovyExpectedTypesProvider { } private void collectExpectedTypeFromPossibleParams(List> expectedParams) { - List constraints = ContainerUtil.newArrayList(); + List constraints = new ArrayList<>(); for (Pair pair : expectedParams) { final PsiType type = pair.second; if (type != null) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java index 1167c1fea21b..b07c855d1039 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java @@ -16,10 +16,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArg import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression; import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public class GrMapTypeFromNamedArgs extends GrMapType { @@ -55,7 +52,7 @@ public class GrMapTypeFromNamedArgs extends GrMapType { super(facade, scope); myStringEntries = new LinkedHashMap<>(); - myOtherEntries = ContainerUtil.newArrayList(); + myOtherEntries = new ArrayList<>(); for (GrNamedArgument namedArg : namedArgs) { final GrArgumentLabel label = namedArg.getLabel(); final GrExpression expression = namedArg.getExpression(); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java index ea1e9b87be18..a609a337ad40 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java @@ -10,7 +10,6 @@ import com.intellij.psi.impl.PsiManagerEx; import com.intellij.psi.impl.light.LightClassReference; import com.intellij.psi.tree.IElementType; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; import org.jetbrains.plugins.groovy.lang.parser.GroovyStubElementTypes; @@ -22,6 +21,7 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.statements.typedef.GrReference import org.jetbrains.plugins.groovy.lang.psi.stubs.GrReferenceListStub; import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil; +import java.util.ArrayList; import java.util.List; /** @@ -60,7 +60,7 @@ public class GrThrowsClauseImpl extends GrReferenceListImpl implements GrThrowsC PsiManagerEx manager = getManager(); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (PsiClassType type : types) { PsiClassType.ClassResolveResult resolveResult = type.resolveGenerics(); PsiClass resolved = resolveResult.getElement(); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrAnnotationCollector.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrAnnotationCollector.java index f022ea0f852c..f33b3e18b42c 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrAnnotationCollector.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrAnnotationCollector.java @@ -35,7 +35,7 @@ public class GrAnnotationCollector { if (!mayHaveAnnotationCollector(rawAnnotations)) return rawAnnotations; - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); for (GrAnnotation annotation : rawAnnotations) { final PsiAnnotation annotationCollector = findAnnotationCollector(annotation); if (annotationCollector != null) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java index db77cf4dacbc..4f10cbbdff32 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionBodyBase.java @@ -8,7 +8,6 @@ import com.intellij.psi.stubs.EmptyStub; import com.intellij.psi.stubs.IStubElementType; import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; @@ -28,6 +27,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.GrTopStatement; import org.jetbrains.plugins.groovy.lang.psi.impl.GrStubElementBase; import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil; +import java.util.ArrayList; import java.util.List; /** @@ -54,7 +54,7 @@ public abstract class GrTypeDefinitionBodyBase extends GrStubElementBase result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (GrVariableDeclaration declaration : declarations) { GrVariable[] variables = declaration.getVariables(); for (GrVariable variable : variables) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightTypeParameterList.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightTypeParameterList.java index 97e5c2a8a02a..cbdc3e738613 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightTypeParameterList.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightTypeParameterList.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.psi.impl.synthetic; import com.intellij.lang.Language; @@ -6,17 +6,17 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiManager; import com.intellij.psi.PsiTypeParameter; import com.intellij.psi.impl.light.LightElement; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor; import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameter; import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameterList; +import java.util.ArrayList; import java.util.List; public class GrLightTypeParameterList extends LightElement implements GrTypeParameterList { - private final List myTypeParameters = ContainerUtil.newArrayList(); + private final List myTypeParameters = new ArrayList<>(); public GrLightTypeParameterList(@NotNull PsiManager manager, @NotNull Language language) { super(manager, language); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java index 275e9cc6c5d2..771fed10862d 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/stubs/GrStubUtils.java @@ -24,10 +24,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatem import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement; import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.intellij.openapi.util.io.DataInputOutputUtilRt.readSeq; import static com.intellij.openapi.util.io.DataInputOutputUtilRt.writeSeq; @@ -98,7 +95,7 @@ public class GrStubUtils { } public static String[] getAnnotationNames(PsiModifierListOwner psi) { - List annoNames = ContainerUtil.newArrayList(); + List annoNames = new ArrayList<>(); final PsiModifierList modifierList = psi.getModifierList(); if (modifierList instanceof GrModifierList) { for (GrAnnotation annotation : ((GrModifierList)modifierList).getRawAnnotations()) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ParamHintProcessor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ParamHintProcessor.java index 00f0fde1c8ad..2be2d8064fb6 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ParamHintProcessor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ParamHintProcessor.java @@ -1,22 +1,7 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.psi.typeEnhancers; import com.intellij.psi.*; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtilRt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -74,7 +59,7 @@ public abstract class ParamHintProcessor extends SignatureHintProcessor { protected static ArrayList produceResult(@Nullable PsiType type) { PsiType notNull = type != null ? type : PsiType.NULL; PsiType[] signature = {notNull}; - ArrayList result = ContainerUtil.newArrayList(); + ArrayList result = new ArrayList<>(); result.add(signature); return result; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/SignatureHintProcessor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/SignatureHintProcessor.java index c6b7d125c373..ebdc2a8fcc09 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/SignatureHintProcessor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/SignatureHintProcessor.java @@ -1,25 +1,10 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.psi.typeEnhancers; import com.intellij.codeInsight.AnnotationUtil; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.psi.*; import com.intellij.util.ArrayUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -31,7 +16,7 @@ public abstract class SignatureHintProcessor { static String[] buildOptions(PsiAnnotation anno) { PsiAnnotationMemberValue options = anno.findAttributeValue("options"); - ArrayList result = ContainerUtil.newArrayList(); + ArrayList result = new ArrayList<>(); for (PsiAnnotationMemberValue initializer : AnnotationUtil.arrayAttributeValues(options)) { if (initializer instanceof PsiLiteral) { Object value = ((PsiLiteral)initializer).getValue(); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GdkMethodUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GdkMethodUtil.java index b7e62d064758..3cbe8f8059b1 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GdkMethodUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GdkMethodUtil.java @@ -36,6 +36,7 @@ import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtilKt; import org.jetbrains.plugins.groovy.lang.resolve.noncode.MixinMemberContributor; import org.jetbrains.plugins.groovy.lang.resolve.processors.MultiProcessor; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -199,7 +200,7 @@ public class GdkMethodUtil { final String name = signatures.second; - final List methods = ContainerUtil.newArrayList(); + final List methods = new ArrayList<>(); final PsiClass closure = JavaPsiFacade.getInstance(statement.getProject()).findClass(GroovyCommonClassNames.GROOVY_LANG_CLOSURE, statement.getResolveScope()); if (closure == null) return CachedValueProvider.Result.create(null, PsiModificationTracker.MODIFICATION_COUNT); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrClassImplUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrClassImplUtil.java index db8f47ff3e75..ab7b1971d646 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrClassImplUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrClassImplUtil.java @@ -127,7 +127,7 @@ public class GrClassImplUtil { @NotNull public static PsiMethod[] getAllMethods(final GrTypeDefinition grType) { return CachedValuesManager.getCachedValue(grType, () -> { - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); getAllMethodsInner(grType, list, new HashSet<>()); return CachedValueProvider.Result .create(list.toArray(PsiMethod.EMPTY_ARRAY), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, grType); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrTraitUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrTraitUtil.java index cf3ea0321d87..122c032c7bcd 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrTraitUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrTraitUtil.java @@ -31,10 +31,7 @@ import org.jetbrains.plugins.groovy.lang.resolve.GroovyTraitFieldsFileIndex; import org.jetbrains.plugins.groovy.lang.resolve.GroovyTraitFieldsFileIndex.TraitFieldDescriptor; import org.jetbrains.plugins.groovy.lang.resolve.GroovyTraitMethodsFileIndex; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.intellij.psi.PsiModifier.ABSTRACT; import static org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierFlags.*; @@ -66,7 +63,7 @@ public class GrTraitUtil { public static List getSelfTypeClasses(@NotNull PsiClass trait) { return CachedValuesManager.getCachedValue(trait, () -> { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); InheritanceUtil.processSupers(trait, true, clazz -> { if (isTrait(clazz)) { PsiAnnotation annotation = AnnotationUtil.findAnnotation(clazz, "groovy.transform.SelfType"); @@ -117,7 +114,7 @@ public class GrTraitUtil { @NotNull public static Collection getCompiledTraitConcreteMethods(@NotNull final ClsClassImpl trait) { return CachedValuesManager.getCachedValue(trait, () -> { - final Collection result = ContainerUtil.newArrayList(); + final Collection result = new ArrayList<>(); doCollectCompiledTraitMethods(trait, result); return CachedValueProvider.Result.create(result, trait); }); @@ -209,7 +206,7 @@ public class GrTraitUtil { @NotNull public static Collection getCompiledTraitFields(@NotNull final ClsClassImpl trait) { return CachedValuesManager.getCachedValue(trait, () -> { - final Collection result = ContainerUtil.newArrayList(); + final Collection result = new ArrayList<>(); doCollectCompiledTraitFields(trait, result); return CachedValueProvider.Result.create(result, trait); }); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/GroovyTraitFieldsFileIndex.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/GroovyTraitFieldsFileIndex.java index bfa969a24693..ec5b4f928fcb 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/GroovyTraitFieldsFileIndex.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/GroovyTraitFieldsFileIndex.java @@ -9,7 +9,6 @@ import com.intellij.psi.impl.compiled.SignatureParsing; import com.intellij.psi.impl.compiled.StubBuildingVisitor; import com.intellij.util.SmartList; import com.intellij.util.cls.ClsFormatException; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.indexing.*; import com.intellij.util.indexing.FileBasedIndex.InputFilter; import com.intellij.util.io.DataExternalizer; @@ -20,6 +19,7 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.text.StringCharacterIterator; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -93,7 +93,7 @@ public class GroovyTraitFieldsFileIndex } private static Collection index(FileContent inputData) { - final Collection values = ContainerUtil.newArrayList(); + final Collection values = new ArrayList<>(); new ClassReader(inputData.getContent()).accept(new ClassVisitor(Opcodes.API_VERSION) { @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java index 904c2cce8e38..2f9d0fa55fb6 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java @@ -900,7 +900,7 @@ public class ResolveUtil { @NotNull GrExpression[] expressionArguments, @NotNull GrClosableBlock[] closureArguments, @NotNull GrExpression arg) { - List> expectedParams = ContainerUtil.newArrayList(); + List> expectedParams = new ArrayList<>(); for (GroovyResolveResult variant : variants) { if (variant instanceof GroovyMethodResult && ((GroovyMethodResult)variant).getCandidate() != null) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/Members.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/Members.java index 95c5abf87ef7..03b6ea65c97f 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/Members.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/Members.java @@ -1,27 +1,13 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.resolve.ast; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiClassType; import com.intellij.psi.PsiMethod; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -77,10 +63,10 @@ public abstract class Members { public static Members create() { return new Members() { - private final Collection methods = ContainerUtil.newArrayList(); - private final Collection fields = ContainerUtil.newArrayList(); - private final Collection classes = ContainerUtil.newArrayList(); - private final Collection implementsTypes = ContainerUtil.newArrayList(); + private final Collection methods = new ArrayList<>(); + private final Collection fields = new ArrayList<>(); + private final Collection classes = new ArrayList<>(); + private final Collection implementsTypes = new ArrayList<>(); @NotNull @Override diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/MethodResolverProcessor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/MethodResolverProcessor.java index 103665e000bb..4f7866fa5bd8 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/MethodResolverProcessor.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/MethodResolverProcessor.java @@ -6,7 +6,6 @@ import com.intellij.openapi.util.NotNullComputable; import com.intellij.psi.*; import com.intellij.psi.scope.JavaScopeProcessorEvent; import com.intellij.psi.util.TypeConversionUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.psi.api.GroovyMethodResult; @@ -149,7 +148,7 @@ public class MethodResolverProcessor extends ResolverProcessor array = getCandidatesInternal(); if (array.size() == 1) return array.toArray(GroovyResolveResult.EMPTY_ARRAY); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); Iterator itr = array.iterator(); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/stubs/GroovyShortNamesCache.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/stubs/GroovyShortNamesCache.java index c418e35194ee..d0ba20ccc0d6 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/stubs/GroovyShortNamesCache.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/stubs/GroovyShortNamesCache.java @@ -74,7 +74,7 @@ public class GroovyShortNamesCache extends PsiShortNamesCache { @NotNull public List getClassesByFQName(String name, GlobalSearchScope scope, boolean inSource) { - final List result = ContainerUtil.newArrayList(); + final List result = new ArrayList<>(); for (PsiElement psiClass : StubIndex.getElements(GrFullClassNameIndex.KEY, name.hashCode(), myProject, inSource ? new GrSourceFilterScope(scope) : scope, PsiClass.class)) { diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/transformations/impl/BindableTransformationSupport.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/transformations/impl/BindableTransformationSupport.java index 479dcd274554..b6ba9d934976 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/transformations/impl/BindableTransformationSupport.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/transformations/impl/BindableTransformationSupport.java @@ -1,25 +1,10 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.transformations.impl; import com.intellij.codeInsight.AnnotationUtil; import com.intellij.psi.*; import com.intellij.psi.impl.light.LightMethodBuilder; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.GroovyLanguage; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField; @@ -27,6 +12,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefini import org.jetbrains.plugins.groovy.transformations.AstTransformationSupport; import org.jetbrains.plugins.groovy.transformations.TransformationContext; +import java.util.ArrayList; import java.util.List; import static org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil.DOCUMENTATION_DELEGATE_FQN; @@ -65,7 +51,7 @@ public class BindableTransformationSupport implements AstTransformationSupport { final PsiType stringType = PsiType.getJavaLangString(manager, scope); final PsiType objectType = PsiType.getJavaLangObject(manager, scope); - final List methods = ContainerUtil.newArrayList(); + final List methods = new ArrayList<>(); methods.add( new LightMethodBuilder(manager, GroovyLanguage.INSTANCE, "addPropertyChangeListener") diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/GroovyOverrideImplementUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/GroovyOverrideImplementUtil.java index 59762cf08063..4ccf4f6c3f63 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/GroovyOverrideImplementUtil.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/GroovyOverrideImplementUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.util; import com.intellij.codeInsight.generation.GenerateMembersUtil; @@ -19,7 +19,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; import com.intellij.psi.infos.CandidateInfo; import com.intellij.psi.util.PsiTypesUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -37,10 +36,7 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrTraitMethod; import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil; import java.io.IOException; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; +import java.util.*; public class GroovyOverrideImplementUtil { private static final Logger LOG = Logger.getInstance("org.jetbrains.plugins.groovy.util.GroovyOverrideImplementUtil"); @@ -219,7 +215,7 @@ public class GroovyOverrideImplementUtil { ApplicationManager.getApplication().assertReadAccessAllowed(); Collection candidates = GroovyOverrideImplementExploreUtil.getMethodsToOverrideImplement(aClass, toImplement); - Collection secondary = toImplement || aClass.isInterface() ? ContainerUtil.newArrayList() + Collection secondary = toImplement || aClass.isInterface() ? new ArrayList<>() : GroovyOverrideImplementExploreUtil .getMethodsToOverrideImplement(aClass, true); diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GreclipseBuilder.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GreclipseBuilder.java index d4112f8cbf16..26bbdd843c90 100644 --- a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GreclipseBuilder.java +++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GreclipseBuilder.java @@ -168,7 +168,7 @@ public class GreclipseBuilder extends ModuleLevelBuilder { boolean success = performCompilation(args, out, err, outputMap, context, chunk); - List items = ContainerUtil.newArrayList(); + List items = new ArrayList<>(); for (String src : outputMap.keySet()) { for (String classFile : outputMap.get(src)) { items.add(new GroovycOutputParser.OutputItem(FileUtil.toSystemIndependentName(mainOutputDir + classFile), diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java index 348d281566fc..197b9e2523b4 100644 --- a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java +++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/InProcessGroovyc.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.incremental.groovy; import com.intellij.execution.process.ProcessOutputTypes; @@ -43,10 +29,7 @@ import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Queue; +import java.util.*; import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; @@ -328,7 +311,7 @@ class InProcessGroovyc implements GroovycFlavor { @NotNull private static List toUrls(Collection paths) throws MalformedURLException { - List urls = ContainerUtil.newArrayList(); + List urls = new ArrayList<>(); for (String s : paths) { urls.add(new File(s).toURI().toURL()); } diff --git a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenation2InjectorAdapter.java b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenation2InjectorAdapter.java index a0e38f91b17f..888b4673bd1e 100644 --- a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenation2InjectorAdapter.java +++ b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenation2InjectorAdapter.java @@ -75,7 +75,7 @@ public class GrConcatenation2InjectorAdapter extends ConcatenationInjectorManage } private static PsiElement[] collectGStringOperands(GrString grString) { - final ArrayList operands = ContainerUtil.newArrayList(); + final ArrayList operands = new ArrayList<>(); processGString(grString, operands); return operands.toArray(PsiElement.EMPTY_ARRAY); } @@ -85,7 +85,7 @@ public class GrConcatenation2InjectorAdapter extends ConcatenationInjectorManage } private static PsiElement[] collectBinaryOperands(GrBinaryExpression expression) { - final ArrayList operands = ContainerUtil.newArrayList(); + final ArrayList operands = new ArrayList<>(); processBinary(expression, operands); return operands.toArray(PsiElement.EMPTY_ARRAY); } diff --git a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenationAwareInjector.java b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenationAwareInjector.java index 79bbeb27ccf2..d1ec2b53ce55 100644 --- a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenationAwareInjector.java +++ b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/GrConcatenationAwareInjector.java @@ -39,6 +39,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement; import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrBindingVariable; +import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; import java.util.List; @@ -316,7 +317,7 @@ public final class GrConcatenationAwareInjector implements ConcatenationAwareInj if (language == null) return; String languageID = language.getID(); - List> list = ContainerUtil.newArrayList(); + List> list = new ArrayList<>(); boolean unparsable = false; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleStateService.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleStateService.java index bd8b060e89f8..1755e064acdb 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleStateService.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleStateService.java @@ -8,14 +8,10 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.*; @State( name = "GroovyConsoleState", @@ -32,7 +28,7 @@ public class GroovyConsoleStateService implements PersistentStateComponent list = ContainerUtil.newArrayList(); + public Collection list = new ArrayList<>(); } private final ModuleManager myModuleManager; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyImportOptimizer.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyImportOptimizer.java index afa2c3682c39..4168dd96c7f0 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyImportOptimizer.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyImportOptimizer.java @@ -8,7 +8,6 @@ import com.intellij.openapi.util.EmptyRunnable; import com.intellij.openapi.util.NotNullComputable; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.TObjectIntHashMap; import gnu.trove.TObjectIntProcedure; import org.jetbrains.annotations.NotNull; @@ -194,7 +193,7 @@ public class GroovyImportOptimizer implements ImportOptimizer { } }); - List explicated = ContainerUtil.newArrayList(); + List explicated = new ArrayList<>(); for (String importedClass : importedClasses) { final String parentName = StringUtil.getPackageName(importedClass); if (!annotations.containsKey(importedClass) && !aliased.containsKey(importedClass)) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyGStringSelectioner.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyGStringSelectioner.java index 4a0c8e23db1d..556ffc01ac90 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyGStringSelectioner.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/selection/GroovyGStringSelectioner.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.editor.selection; import com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase; @@ -22,7 +8,6 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.tree.IElementType; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes; @@ -46,7 +31,7 @@ public class GroovyGStringSelectioner extends ExtendWordSelectionHandlerBase { @Override public List select(@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) { - final List ranges = ContainerUtil.newArrayList(); + final List ranges = new ArrayList<>(); final PsiElement parent = e.getParent(); if (parent instanceof GrStringContent && parent.getParent() instanceof GrString) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/blocks/GroovyBlockGenerator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/blocks/GroovyBlockGenerator.java index fb1c01b38e56..17b71593ebdd 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/blocks/GroovyBlockGenerator.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/formatter/blocks/GroovyBlockGenerator.java @@ -419,7 +419,7 @@ public class GroovyBlockGenerator { } private static List flattenChildren(List children) { - ArrayList result = ContainerUtil.newArrayList(); + ArrayList result = new ArrayList<>(); for (ASTNode child : children) { processNodeFlattening(result, child); } @@ -447,7 +447,7 @@ public class GroovyBlockGenerator { PsiElement psi = child.getPsi(); if (psi instanceof GrLabeledStatement) { alignGroup(currentGroup, spock, classLevel); - currentGroup = ContainerUtil.newArrayList(); + currentGroup = new ArrayList<>(); spock = true; } else if (currentGroup != null && spock && isTablePart(psi)) { @@ -458,7 +458,7 @@ public class GroovyBlockGenerator { if (variables.length > 0) { if (!classLevel || currentGroup == null || fieldGroupEnded(psi) || spock) { alignGroup(currentGroup, spock, classLevel); - currentGroup = ContainerUtil.newArrayList(); + currentGroup = new ArrayList<>(); spock = false; } currentGroup.add((GrStatement)psi); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertSimpleGetterToPropertyIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertSimpleGetterToPropertyIntention.java index 8d7d9645b5c5..540d2573b837 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertSimpleGetterToPropertyIntention.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertSimpleGetterToPropertyIntention.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.intentions.conversions; import com.intellij.openapi.editor.Editor; @@ -24,7 +10,6 @@ import com.intellij.psi.PsiType; import com.intellij.psi.codeStyle.JavaCodeStyleManager; import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.intentions.base.Intention; import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate; @@ -38,6 +23,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMe import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement; import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils; +import java.util.ArrayList; import java.util.List; /** @@ -71,7 +57,7 @@ public class ConvertSimpleGetterToPropertyIntention extends Intention { PsiClass aClass = method.getContainingClass(); if (aClass == null) return; - List modifiers = ContainerUtil.newArrayList(); + List modifiers = new ArrayList<>(); for (String modifier : MODIFIERS_TO_CHECK) { if (method.hasModifierProperty(modifier)) modifiers.add(modifier); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/strings/ConvertStringToMultilineIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/strings/ConvertStringToMultilineIntention.java index fc3070f72531..3b2cb19cf406 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/strings/ConvertStringToMultilineIntention.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/strings/ConvertStringToMultilineIntention.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.intentions.conversions.strings; import com.intellij.openapi.application.ApplicationManager; @@ -29,7 +15,6 @@ import com.intellij.psi.tree.IElementType; import com.intellij.refactoring.IntroduceTargetChooser; import com.intellij.util.Function; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle; @@ -47,6 +32,7 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.literal import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.literals.GrStringImpl; import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -89,7 +75,7 @@ public class ConvertStringToMultilineIntention extends Intention { @NotNull private static List collectExpressions(@NotNull PsiElement element) { assert element instanceof GrExpression; - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); result.add((GrExpression)element); while (element.getParent() instanceof GrBinaryExpression) { final GrBinaryExpression binary = (GrBinaryExpression)element.getParent(); @@ -146,7 +132,7 @@ public class ConvertStringToMultilineIntention extends Intention { } private void invokeImpl(@NotNull final GrExpression element, @NotNull final Project project, @NotNull final Editor editor) { - final List literals = collectOperands(element, ContainerUtil.newArrayList()); + final List literals = collectOperands(element, new ArrayList<>()); if (literals.isEmpty()) return; final StringBuilder buffer = prepareNewLiteralText(literals); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/AnnotationAttributeCompletionResultProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/AnnotationAttributeCompletionResultProcessor.java index 9400263dd17b..9e1960c3966f 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/AnnotationAttributeCompletionResultProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/AnnotationAttributeCompletionResultProcessor.java @@ -8,7 +8,6 @@ import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiMethod; import com.intellij.util.Consumer; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation; import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement; @@ -34,7 +33,7 @@ public class AnnotationAttributeCompletionResultProcessor { final PsiAnnotation annotationCollector = GrAnnotationCollector.findAnnotationCollector((PsiClass)resolved); if (annotationCollector != null) { - final ArrayList annotations = ContainerUtil.newArrayList(); + final ArrayList annotations = new ArrayList<>(); GrAnnotationCollector.collectAnnotations(annotations, myAnnotation, annotationCollector); Set usedNames = new HashSet<>(); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/ClosureCompleter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/ClosureCompleter.java index a9bdd121ce15..0918720cbc9e 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/ClosureCompleter.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/ClosureCompleter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.completion; import com.intellij.codeInsight.CodeInsightUtilCore; @@ -15,7 +15,6 @@ import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.impl.compiled.ClsMethodImpl; import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.completion.closureParameters.ClosureParameterInfo; @@ -28,6 +27,7 @@ import org.jetbrains.plugins.groovy.lang.psi.expectedTypes.TypeConstraint; import org.jetbrains.plugins.groovy.template.expressions.ChooseTypeExpression; import org.jetbrains.plugins.groovy.template.expressions.StringParameterNameExpression; +import java.util.ArrayList; import java.util.List; /** @@ -88,7 +88,7 @@ public abstract class ClosureCompleter { StringBuilder buffer = new StringBuilder(); buffer.append("{"); - List paramTypes = ContainerUtil.newArrayList(); + List paramTypes = new ArrayList<>(); for (ClosureParameterInfo parameter : parameters) { final String type = parameter.getType(); final String name = parameter.getName(); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/CompleteReferenceExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/CompleteReferenceExpression.java index c869c5c8bc8e..ebd1e5f8bc17 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/CompleteReferenceExpression.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/CompleteReferenceExpression.java @@ -14,7 +14,6 @@ import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.Consumer; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.hash.HashSet; import icons.JetgroovyIcons; import org.jetbrains.annotations.NotNull; @@ -447,7 +446,7 @@ public class CompleteReferenceExpression { GroovyResolveResult result = (GroovyResolveResult)o; if (!result.isStaticsOK()) { - if (myInapplicable == null) myInapplicable = ContainerUtil.newArrayList(); + if (myInapplicable == null) myInapplicable = new ArrayList<>(); myInapplicable.add(result); return; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMainCompletionProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMainCompletionProvider.java index 15820bc19afb..7e85798fcf94 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMainCompletionProvider.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMainCompletionProvider.java @@ -17,7 +17,6 @@ import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.Consumer; import com.intellij.util.ProcessingContext; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.GroovyBundle; @@ -192,7 +191,7 @@ public class GrMainCompletionProvider extends CompletionProvider zeroPriority = ContainerUtil.newArrayList(); + final List zeroPriority = new ArrayList<>(); PsiClass qualifierClass = com.intellij.psi.util.PsiUtil.resolveClassInClassTypeOnly(qualifierType); final boolean honorExcludes = qualifierClass == null || !JavaCompletionUtil.isInExcludedPackage(qualifierClass, false); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionUtil.java index 4ceeb5cc8702..11e34c9bc4ba 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionUtil.java @@ -69,6 +69,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil; import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil; import org.jetbrains.plugins.groovy.lang.resolve.api.GroovyProperty; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -228,7 +229,7 @@ public class GroovyCompletionUtil { boolean afterNew, PrefixMatcher matcher, PsiElement position) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (GroovyResolveResult candidate : candidates) { result.addAll(createLookupElements(candidate, afterNew, matcher, position)); ProgressManager.checkCanceled(); @@ -241,7 +242,7 @@ public class GroovyCompletionUtil { boolean afterNew, PrefixMatcher matcher, PsiElement position) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (GroovyResolveResult candidate : candidates) { result.addAll(createLookupElements(candidate, afterNew, matcher, position)); ProgressManager.checkCanceled(); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java index 88ee96abeabf..15070804c7e0 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.mvc; @@ -272,7 +272,7 @@ public abstract class MvcFramework { } public PathsList getApplicationClassPath(Module module) { - final List classPath = ContainerUtil.newArrayList(); + final List classPath = new ArrayList<>(); classPath.addAll(OrderEnumerator.orderEntries(module).recursively().withoutSdk().getPathsList().getVirtualFiles()); retainOnlyJarsAndDirectories(classPath); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java index 10c16d37abde..c3ab6b39a34c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java @@ -83,7 +83,7 @@ public class MvcModuleStructureUtil { root.refresh(false, true); - final List> actions = ContainerUtil.newArrayList(); + final List> actions = new ArrayList<>(); for (Map.Entry, Collection> entry : structure.getSourceFolders().entrySet()) { JpsModuleSourceRootType rootType = entry.getKey(); @@ -252,7 +252,7 @@ public class MvcModuleStructureUtil { appRoot.refresh(false, false); } - Collection> actions = ContainerUtil.newArrayList(); + Collection> actions = new ArrayList<>(); removeInvalidSourceRoots(actions, structure); cleanupDefaultLibrary(structure.myModule, actions, appRoots, structure.getUserLibraryName()); moveupLibrariesFromMavenPlugin(structure.myModule, actions); @@ -265,7 +265,7 @@ public class MvcModuleStructureUtil { } } - Collection> facetActions = ContainerUtil.newArrayList(); + Collection> facetActions = new ArrayList<>(); structure.setupFacets(facetActions, rootsToFacetSetup); return Pair.create(actions, facetActions); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/util/MvcTargetDialogCompletionUtils.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/util/MvcTargetDialogCompletionUtils.java index 7490b92d3bfb..a8fa1a3dbdef 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/util/MvcTargetDialogCompletionUtils.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/util/MvcTargetDialogCompletionUtils.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.mvc.util; import com.intellij.codeInsight.TailType; @@ -31,7 +17,6 @@ import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiModificationTracker; import com.intellij.util.SystemProperties; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyNamesUtil; import org.jetbrains.plugins.groovy.mvc.MvcFramework; @@ -57,21 +42,21 @@ public class MvcTargetDialogCompletionUtils { @NotNull @Override protected List compute() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (String property : SYSTEM_PROPERTIES) { result.add(TailTypeDecorator.withTail(LookupElementBuilder.create("-D" + property), MyTailTypeEQ.INSTANCE)); } return Collections.unmodifiableList(result); } }; - + private MvcTargetDialogCompletionUtils() { } public static List getSystemPropertiesVariants() { return SYSTEM_PROPERTIES_VARIANTS.getValue(); } - + public static Collection collectVariants(@NotNull Module module, @NotNull String text, int offset, @NotNull String prefix) { if (prefix.startsWith("-D")) { return getSystemPropertiesVariants(); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldDialog.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldDialog.java index 015185b63493..8c0ac169923c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldDialog.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldDialog.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.refactoring.introduce.field; import com.intellij.codeInsight.TestFrameworks; @@ -101,7 +87,7 @@ public class GrIntroduceFieldDialog extends DialogWrapper implements GrIntroduce initVisibility(); ButtonGroup initialization = new ButtonGroup(); - ArrayList inits = ContainerUtil.newArrayList(); + ArrayList inits = new ArrayList<>(); inits.add(myCurrentMethodRadioButton); inits.add(myFieldDeclarationRadioButton); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldProcessor.java index f608ef466757..458855c2fd1a 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldProcessor.java @@ -1,18 +1,4 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.refactoring.introduce.field; import com.intellij.codeInsight.TestFrameworks; @@ -132,7 +118,7 @@ public class GrIntroduceFieldProcessor { if (mySettings.replaceAllOccurrences()) { GroovyRefactoringUtil.sortOccurrences(myContext.getOccurrences()); - ArrayList result = ContainerUtil.newArrayList(); + ArrayList result = new ArrayList<>(); for (PsiElement occurrence : myContext.getOccurrences()) { result.add(replaceOccurrence(field, occurrence, targetClass)); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/variable/GrIntroduceLocalVariableProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/variable/GrIntroduceLocalVariableProcessor.java index 0c8c77ac7d20..175e4687e992 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/variable/GrIntroduceLocalVariableProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/variable/GrIntroduceLocalVariableProcessor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.refactoring.introduce.variable; import com.intellij.openapi.diagnostic.Logger; @@ -23,7 +9,6 @@ import com.intellij.psi.util.PsiUtilCore; import com.intellij.refactoring.util.RefactoringUtil; import com.intellij.util.ArrayUtilRt; import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory; @@ -39,6 +24,7 @@ import org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringUtil; import org.jetbrains.plugins.groovy.refactoring.introduce.GrIntroduceContext; import org.jetbrains.plugins.groovy.refactoring.introduce.GrIntroduceHandlerBase; +import java.util.ArrayList; import java.util.List; /** @@ -93,7 +79,7 @@ public abstract class GrIntroduceLocalVariableProcessor { private PsiElement[] processOccurrences() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); GrReferenceExpression templateRef = GroovyPsiElementFactory.getInstance(myContext.getProject()).createReferenceExpressionFromText(mySettings.getName()); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java index 41049f9b5d2c..c1a75a9047fc 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.template.expressions; import com.intellij.codeInsight.completion.InsertHandler; @@ -11,7 +11,6 @@ import com.intellij.codeInsight.template.impl.JavaTemplateUtil; import com.intellij.openapi.editor.Document; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.completion.GroovyCompletionUtil; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifier; @@ -20,6 +19,7 @@ import org.jetbrains.plugins.groovy.lang.psi.expectedTypes.SupertypeConstraint; import org.jetbrains.plugins.groovy.lang.psi.expectedTypes.TypeConstraint; import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil; +import java.util.ArrayList; import java.util.List; /** @@ -65,7 +65,7 @@ public class ChooseTypeExpression extends Expression { @NotNull private static List createItems(@NotNull TypeConstraint[] constraints, @NotNull SmartTypePointerManager typePointerManager) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (TypeConstraint constraint : constraints) { if (constraint instanceof SubtypeConstraint) { @@ -136,7 +136,7 @@ public class ChooseTypeExpression extends Expression { @Override public LookupElement[] calculateLookupItems(ExpressionContext context) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (SmartTypePointer item : myItems) { PsiType type = TypesUtil.unboxPrimitiveTypeWrapper(item.getType()); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/util/AllTestsSuite.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/util/AllTestsSuite.java index cb6e6930ae7b..9173a73a9af2 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/util/AllTestsSuite.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/util/AllTestsSuite.java @@ -1,14 +1,14 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.util; import com.intellij.TestAll; import com.intellij.TestCaseLoader; import com.intellij.util.ArrayUtil; -import com.intellij.util.containers.ContainerUtil; import org.junit.runners.Suite; import org.junit.runners.model.InitializationError; import org.junit.runners.model.RunnerBuilder; +import java.util.ArrayList; import java.util.List; /** @@ -30,7 +30,7 @@ public class AllTestsSuite extends Suite { TestCaseLoader loader = new TestCaseLoader("", true); loader.fillTestCases(testPackage, TestAll.getClassRoots()); - List> result = ContainerUtil.newArrayList(); + List> result = new ArrayList<>(); for (Class aClass : loader.getClasses()) { if (policy == SlowPolicy.ALL) { result.add(aClass); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQNewCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQNewCommand.java index aaef8ef838be..e4ba855b58ab 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQNewCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQNewCommand.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.zmlx.hg4idea.command.mq; import com.intellij.openapi.progress.util.BackgroundTaskUtil; @@ -23,13 +9,13 @@ import org.jetbrains.annotations.NotNull; import org.zmlx.hg4idea.HgVcs; import org.zmlx.hg4idea.action.HgCommandResultNotifier; import org.zmlx.hg4idea.command.HgCommitTypeCommand; -import org.zmlx.hg4idea.execution.HgCommandException; import org.zmlx.hg4idea.execution.HgCommandExecutor; import org.zmlx.hg4idea.execution.HgCommandResult; import org.zmlx.hg4idea.repo.HgRepository; import org.zmlx.hg4idea.util.HgErrorUtil; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -63,7 +49,7 @@ public class HgQNewCommand extends HgCommitTypeCommand { } private void executeQRefreshInCurrentThread(@NotNull List chunkFiles) throws VcsException { - List args = ContainerUtil.newArrayList(); + List args = new ArrayList<>(); args.add("-l"); args.add(saveCommitMessage().getAbsolutePath()); args.add("-s"); @@ -76,7 +62,7 @@ public class HgQNewCommand extends HgCommitTypeCommand { } private void executeQNewInCurrentThread(@NotNull List chunkFiles) throws VcsException { - List args = ContainerUtil.newArrayList(); + List args = new ArrayList<>(); args.add("-l"); args.add(saveCommitMessage().getAbsolutePath()); args.add("-UD"); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgPromptCommandExecutor.java b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgPromptCommandExecutor.java index baea4357c3fc..92e4c4e8e277 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgPromptCommandExecutor.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgPromptCommandExecutor.java @@ -4,7 +4,6 @@ package org.zmlx.hg4idea.execution; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -15,6 +14,7 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.net.Socket; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.List; public class HgPromptCommandExecutor extends HgCommandExecutor { @@ -44,7 +44,7 @@ public class HgPromptCommandExecutor extends HgCommandExecutor { } private List prepareArguments(List arguments, int port) { - List cmdArguments = ContainerUtil.newArrayList(); + List cmdArguments = new ArrayList<>(); cmdArguments.add("--config"); cmdArguments.add("extensions.hg4ideapromptextension=" + myVcs.getPromptHooksExtensionFile().getAbsolutePath()); cmdArguments.add("--config"); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgRemoteCommandExecutor.java b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgRemoteCommandExecutor.java index 62fb4464b9c1..d3e5d188cd52 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgRemoteCommandExecutor.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgRemoteCommandExecutor.java @@ -15,7 +15,6 @@ package org.zmlx.hg4idea.execution; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.action.HgCommandResultNotifier; @@ -26,6 +25,7 @@ import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.List; public class HgRemoteCommandExecutor extends HgCommandExecutor { @@ -91,7 +91,7 @@ public class HgRemoteCommandExecutor extends HgCommandExecutor { } private List prepareArguments(List arguments, int port) { - List cmdArguments = ContainerUtil.newArrayList(); + List cmdArguments = new ArrayList<>(); cmdArguments.add("--config"); cmdArguments.add("extensions.hg4ideapromptextension=" + myVcs.getPromptHooksExtensionFile().getAbsolutePath()); cmdArguments.add("--config"); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgChangesParser.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgChangesParser.java index 50dd9b92dd3f..da77524b5a42 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgChangesParser.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgChangesParser.java @@ -4,7 +4,6 @@ package org.zmlx.hg4idea.log; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.FileStatus; import com.intellij.openapi.vcs.changes.Change; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.VcsShortCommitDetails; import com.intellij.vcs.log.impl.VcsChangesLazilyParsedDetails; import com.intellij.vcs.log.impl.VcsFileStatusInfo; @@ -12,6 +11,7 @@ import org.jetbrains.annotations.NotNull; import org.zmlx.hg4idea.HgRevisionNumber; import org.zmlx.hg4idea.provider.HgChangeProvider; +import java.util.ArrayList; import java.util.List; import static org.zmlx.hg4idea.log.HgHistoryUtil.createChange; @@ -28,7 +28,7 @@ class HgChangesParser implements VcsChangesLazilyParsedDetails.ChangesParser { @NotNull VcsShortCommitDetails commit, @NotNull List changes, int parentIndex) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (VcsFileStatusInfo info : changes) { String filePath = info.getFirstPath(); HgRevisionNumber parentRevision = diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgHistoryUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgHistoryUtil.java index f634fbbc4800..bf1ccd41afde 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgHistoryUtil.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgHistoryUtil.java @@ -100,7 +100,7 @@ public class HgHistoryUtil { HgVersion version = hgvcs.getVersion(); String[] templates = HgBaseLogParser.constructFullTemplateArgument(true, version); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); VcsLogObjectsFactory factory = getObjectsFactoryWithDisposeCheck(project); if (factory == null) { return Collections.emptyList(); @@ -148,7 +148,7 @@ public class HgHistoryUtil { @NotNull VirtualFile root, @NotNull VcsLogObjectsFactory factory, @NotNull HgFileRevision revision) { - List> reportedChanges = ContainerUtil.newArrayList(); + List> reportedChanges = new ArrayList<>(); reportedChanges.add(getStatusInfo(revision)); HgRevisionNumber vcsRevisionNumber = revision.getRevisionNumber(); @@ -207,7 +207,7 @@ public class HgHistoryUtil { } } - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (HgChange change : changes) { Change.Type type = getType(change.getStatus()); LOG.assertTrue(type != null, "Unsupported status for change " + change); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java index 257640493af8..7c212d439104 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java @@ -196,7 +196,7 @@ public final class HgLogProvider implements VcsLogProvider { public List getCommitsMatchingFilter(@NotNull final VirtualFile root, @NotNull VcsLogFilterCollection filterCollection, int maxCount) { - List filterParameters = ContainerUtil.newArrayList(); + List filterParameters = new ArrayList<>(); // branch filter and user filter may be used several times without delimiter VcsLogBranchFilter branchFilter = filterCollection.get(VcsLogFilterCollection.BRANCH_FILTER); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java index 8ae89ea0d237..93b310fb2b65 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgRefManager.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.zmlx.hg4idea.log; import com.intellij.dvcs.repo.RepositoryManager; @@ -126,9 +112,9 @@ public class HgRefManager implements VcsLogRefManager { List sortedRefs = sort(refs); MultiMap groupedRefs = ContainerUtil.groupBy(sortedRefs, VcsRef::getType); - List result = ContainerUtil.newArrayList(); - List branches = ContainerUtil.newArrayList(); - List bookmarks = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); + List branches = new ArrayList<>(); + List bookmarks = new ArrayList<>(); for (Map.Entry> entry : groupedRefs.entrySet()) { if (entry.getKey().equals(TIP) || entry.getKey().equals(HEAD)) { for (VcsRef ref : entry.getValue()) { @@ -154,7 +140,7 @@ public class HgRefManager implements VcsLogRefManager { public List groupForTable(@NotNull Collection references, boolean compact, boolean showTagNames) { List sortedReferences = sort(references); - List headAndTip = ContainerUtil.newArrayList(); + List headAndTip = new ArrayList<>(); MultiMap groupedRefs = MultiMap.createLinked(); for (VcsRef ref : sortedReferences) { if (ref.getType().equals(HEAD) || ref.getType().equals(TIP)) { @@ -165,7 +151,7 @@ public class HgRefManager implements VcsLogRefManager { } } - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); SimpleRefGroup.buildGroups(groupedRefs, compact, showTagNames, result); RefGroup firstGroup = getFirstItem(result); if (firstGroup != null) { diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/mq/HgMqAdditionalPatchReader.java b/plugins/hg4idea/src/org/zmlx/hg4idea/mq/HgMqAdditionalPatchReader.java index ede0986a816c..7e5b8cc60ea0 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/mq/HgMqAdditionalPatchReader.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/mq/HgMqAdditionalPatchReader.java @@ -1,25 +1,10 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.zmlx.hg4idea.mq; import com.intellij.dvcs.DvcsUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.util.HgUtil; @@ -27,6 +12,7 @@ import org.zmlx.hg4idea.util.HgUtil; import java.io.File; import java.text.NumberFormat; import java.text.ParseException; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -52,7 +38,7 @@ public class HgMqAdditionalPatchReader { String user = null; Date date = null; String branch = null; - List messageLines = ContainerUtil.newArrayList(); + List messageLines = new ArrayList<>(); String nodeId = null; String parent = null; diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java index 85c42fcc19d1..fc190518e22b 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java @@ -24,7 +24,6 @@ import com.intellij.openapi.vcs.annotate.ShowAllAffectedGenericAction; import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.history.*; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.ColumnInfo; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; @@ -177,7 +176,7 @@ public class HgHistoryProvider implements VcsHistoryProvider { final HgVersion version = logCommand.getVersion(); String[] templates = HgBaseLogParser.constructFullTemplateArgument(false, version); String template = HgChangesetUtil.makeTemplate(templates); - List argsForCmd = ContainerUtil.newArrayList(); + List argsForCmd = new ArrayList<>(); String relativePath = originalHgFile.getRelativePath(); argsForCmd.add("--rev"); argsForCmd diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryReader.java b/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryReader.java index abe1175ed6dd..39a59e179d70 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryReader.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryReader.java @@ -274,7 +274,7 @@ public class HgRepositoryReader { @NotNull public List readMQAppliedPatches() { - ArrayList mqPatchRefs = ContainerUtil.newArrayList(); + ArrayList mqPatchRefs = new ArrayList<>(); readReferences(new File(myMqInternalDir, "status"), mqPatchRefs); return mqPatchRefs; } diff --git a/plugins/hg4idea/testSrc/hg4idea/test/log/HgReadDetailsTest.java b/plugins/hg4idea/testSrc/hg4idea/test/log/HgReadDetailsTest.java index e7b46800b4f6..2363fa534457 100644 --- a/plugins/hg4idea/testSrc/hg4idea/test/log/HgReadDetailsTest.java +++ b/plugins/hg4idea/testSrc/hg4idea/test/log/HgReadDetailsTest.java @@ -15,6 +15,7 @@ import org.zmlx.hg4idea.log.HgLogProvider; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -43,7 +44,7 @@ public class HgReadDetailsTest extends HgPlatformTest { public void testReadFullDetailsByHash() throws IOException, VcsException { Map commits = generateCommits(); - List details = ContainerUtil.newArrayList(); + List details = new ArrayList<>(); myProvider.readFullDetails(projectRoot, ContainerUtil.newArrayList(commits.keySet()), details::add); assertSameElements(ContainerUtil.map(details, d -> d.getFullMessage() + "\n" + getChanges(d)), commits.values()); } diff --git a/plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java b/plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java index 0fb9ea12e55b..78e8d6d62ca3 100644 --- a/plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java +++ b/plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.refactoring.inline; import com.intellij.lang.properties.IProperty; @@ -35,10 +21,7 @@ import com.intellij.refactoring.util.RefactoringMessageDialog; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.FilteringIterator; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; +import java.util.*; /** * @author gregsh @@ -64,7 +47,7 @@ public class InlinePropertyHandler extends JavaInlineActionHandler { final String propertyValue = property.getValue(); if (propertyValue == null) return; - final List occurrences = Collections.synchronizedList(ContainerUtil.newArrayList()); + final List occurrences = Collections.synchronizedList(new ArrayList<>()); final Collection containingFiles = Collections.synchronizedSet(new HashSet<>()); containingFiles.add(psiElement.getContainingFile()); boolean result = ReferencesSearch.search(psiElement).forEach( diff --git a/plugins/maven/jps-plugin/src/org/jetbrains/jps/maven/compiler/MavenManifestGenerationBuildTaskProvider.java b/plugins/maven/jps-plugin/src/org/jetbrains/jps/maven/compiler/MavenManifestGenerationBuildTaskProvider.java index f5b78aeb08d5..26d4ee6800e7 100644 --- a/plugins/maven/jps-plugin/src/org/jetbrains/jps/maven/compiler/MavenManifestGenerationBuildTaskProvider.java +++ b/plugins/maven/jps-plugin/src/org/jetbrains/jps/maven/compiler/MavenManifestGenerationBuildTaskProvider.java @@ -109,7 +109,7 @@ public class MavenManifestGenerationBuildTaskProvider extends ArtifactBuildTaskP final byte[] warManifestData = Base64.getDecoder().decode(warConfiguration.manifest); Manifest warManifest = new Manifest(new ByteArrayInputStream(warManifestData)); - List skinnyWarClasspath = ContainerUtil.newArrayList(); + List skinnyWarClasspath = new ArrayList<>(); for (String entry : StringUtil.split(warConfiguration.classpath, " ")) { final int idx = entry.lastIndexOf("/"); final String entryName = entry.substring(idx == -1 ? 0 : idx + 1); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/inspections/MavenPropertyInParentInspection.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/inspections/MavenPropertyInParentInspection.java index be54260054ec..5adf52953890 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/inspections/MavenPropertyInParentInspection.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/inspections/MavenPropertyInParentInspection.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.dom.inspections; import com.intellij.codeHighlighting.HighlightDisplayLevel; @@ -26,7 +12,6 @@ import com.intellij.psi.xml.XmlElement; import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; import com.intellij.psi.xml.XmlText; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xml.DomFileElement; import com.intellij.util.xml.DomManager; import com.intellij.util.xml.GenericDomValue; @@ -39,6 +24,7 @@ import org.jetbrains.idea.maven.dom.references.MavenPropertyPsiReference; import org.jetbrains.idea.maven.dom.references.MavenPsiElementWrapper; import org.jetbrains.idea.maven.server.MavenServerManager; +import java.util.ArrayList; import java.util.List; import static com.intellij.openapi.util.text.StringUtil.isEmpty; @@ -82,7 +68,7 @@ public class MavenPropertyInParentInspection extends XmlSuppressableInspectionTo if (model != null) { boolean maven35 = StringUtil.compareVersionNumbers(MavenServerManager.getInstance().getCurrentMavenVersion(), "3.5") >= 0; - List problems = ContainerUtil.newArrayListWithCapacity(3); + List problems = new ArrayList<>(3); MavenDomParent mavenParent = model.getRootElement().getMavenParent(); validate(manager, isOnTheFly, maven35, problems, mavenParent.getGroupId()); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsStructure.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsStructure.java index f3a855b01d90..a042e9e0aa95 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsStructure.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/navigator/MavenProjectsStructure.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.navigator; import com.intellij.execution.ProgramRunnerUtil; @@ -666,7 +666,7 @@ public class MavenProjectsStructure extends SimpleTreeStructure { @Override public Navigatable getNavigatable() { if (myProject == null) return null; - final List profiles = ContainerUtil.newArrayList(); + final List profiles = new ArrayList<>(); // search in "Per User Maven Settings" - %USER_HOME%/.m2/settings.xml // and in "Global Maven Settings" - %M2_HOME%/conf/settings.xml diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/onlinecompletion/central/MavenCentralModel.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/onlinecompletion/central/MavenCentralModel.java index d36f0b04e818..e8e76af0f742 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/onlinecompletion/central/MavenCentralModel.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/onlinecompletion/central/MavenCentralModel.java @@ -8,6 +8,7 @@ import org.jetbrains.idea.maven.onlinecompletion.model.MavenDependencyCompletion import org.jetbrains.idea.maven.onlinecompletion.model.MavenDependencyCompletionItemWithClass; import java.lang.reflect.Type; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -55,7 +56,7 @@ public class MavenCentralModel { } JsonObject object = json.getAsJsonObject(); Highlighting result = new Highlighting(); - result.results = ContainerUtil.newArrayListWithCapacity(object.size()); + result.results = new ArrayList<>(object.size()); for (Map.Entry entry : object.entrySet()) { JsonArray fch = entry.getValue().getAsJsonObject().get("fch").getAsJsonArray(); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPolyglotPomMemberContributor.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPolyglotPomMemberContributor.java index e0c8b33e7c51..0f227be2cd82 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPolyglotPomMemberContributor.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPolyglotPomMemberContributor.java @@ -19,6 +19,7 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GroovyScriptClass; import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor; import org.jetbrains.plugins.groovy.util.dynamicMembers.DynamicMemberUtils; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -30,7 +31,7 @@ public class MavenGroovyPolyglotPomMemberContributor extends NonCodeMembersContr @NotNull @Override protected Collection compute() { - List list = ContainerUtil.newArrayList(); + List list = new ArrayList<>(); list.add(new Contributor("/maven/dsl/groovy/pom.groovy", "")); list.add(new Contributor("/maven/dsl/groovy/model.groovy", "project")); list.add(new Contributor("/maven/dsl/groovy/modelBase.groovy", diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPomCompletionContributor.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPomCompletionContributor.java index daabe8bfe136..49c8cd181459 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPomCompletionContributor.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyPomCompletionContributor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.plugins.groovy; import com.intellij.codeInsight.actions.ReformatCodeProcessor; @@ -36,6 +36,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlo import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrMethodCallExpression; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; @@ -71,7 +72,7 @@ public class MavenGroovyPomCompletionContributor extends CompletionContributor { PsiFile psiFile = PsiFileFactory.getInstance(project).createFileFromText(MavenConstants.POM_XML, XMLLanguage.INSTANCE, buf); psiFile.putUserData(ORIGINAL_POM_FILE, virtualFile); - List variants = ContainerUtil.newArrayList(); + List variants = new ArrayList<>(); String lastMethodCall = ContainerUtil.getLastItem(methodCallInfo); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java index 3c31a5377d87..1cd2b8997efd 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectReader.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.project; import com.intellij.openapi.project.Project; @@ -495,7 +481,7 @@ public class MavenProjectReader { Map filesMap = ContainerUtil.newTroveMap(FileUtil.PATH_HASHING_STRATEGY); filesMap.putAll(files.stream().collect(toMap(VirtualFile::getPath, Function.identity()))); - Collection readerResults = ContainerUtil.newArrayList(); + Collection readerResults = new ArrayList<>(); for (MavenServerExecutionResult result : executionResults) { MavenServerExecutionResult.ProjectData projectData = result.projectData; if (projectData == null) { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleBuilderHelper.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleBuilderHelper.java index acf2e50e5416..7f1acd261cd7 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleBuilderHelper.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleBuilderHelper.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.wizards; import com.intellij.ide.util.EditorHelper; @@ -30,7 +16,6 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.xml.XmlElement; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.maven.dom.MavenDomUtil; import org.jetbrains.idea.maven.dom.model.MavenDomModule; @@ -49,6 +34,7 @@ import org.jetbrains.idea.maven.utils.MavenUtil; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @@ -162,7 +148,7 @@ public class MavenModuleBuilderHelper { CodeStyleManager.getInstance(project).reformat(getPsiFile(project, pom)); - List pomFiles = ContainerUtil.newArrayListWithCapacity(2); + List pomFiles = new ArrayList<>(2); pomFiles.add(pom); if (!FileUtil.namesEqual(MavenConstants.POM_XML, myParentProject.getFile().getName())) { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/externalSystemIntegration/output/MavenBuildToolLogTestUtils.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/externalSystemIntegration/output/MavenBuildToolLogTestUtils.java index 22ae2d145499..20893512009d 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/externalSystemIntegration/output/MavenBuildToolLogTestUtils.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/externalSystemIntegration/output/MavenBuildToolLogTestUtils.java @@ -35,8 +35,8 @@ public abstract class MavenBuildToolLogTestUtils extends UsefulTestCase { } protected class TestCaseBuider { - private List myLines = ContainerUtil.newArrayList(); - private List myParsers = ContainerUtil.newArrayList(); + private List myLines = new ArrayList<>(); + private List myParsers = new ArrayList<>(); private List>> myExpectedEvents = new ArrayList<>(); public TestCaseBuider withLines(String... lines) { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/tests/MavenSurefireReportInConsoleTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/tests/MavenSurefireReportInConsoleTest.java index 19eefda5a1fb..2757b1dd4f62 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/tests/MavenSurefireReportInConsoleTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/tests/MavenSurefireReportInConsoleTest.java @@ -1,26 +1,12 @@ -/* - * Copyright 2000-2015 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.tests; import com.intellij.execution.filters.Filter; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.idea.maven.project.MavenTestConsoleFilter; import org.jetbrains.idea.maven.server.MavenServerManager; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -58,7 +44,7 @@ public class MavenSurefireReportInConsoleTest extends LightCodeInsightFixtureTes Filter.Result result = myFilter.applyFilter(line, line.length()); if (result == null) return Collections.emptyList(); - List res = ContainerUtil.newArrayList(); + List res = new ArrayList<>(); for (Filter.ResultItem item : result.getResultItems()) { res.add(line.substring(item.getHighlightStartOffset(), item.getHighlightEndOffset())); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java index b0ca5419373d..8250ba6886b5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java @@ -26,6 +26,7 @@ import org.jetbrains.idea.svn.status.Status; import org.jetbrains.idea.svn.status.StatusType; import java.io.File; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -39,14 +40,14 @@ class SvnChangeProviderContext implements StatusReceiver { private static final Logger LOG = Logger.getInstance("org.jetbrains.idea.svn.SvnChangeProviderContext"); @NotNull private final ChangelistBuilder myChangelistBuilder; - @NotNull private final List myCopiedFiles = ContainerUtil.newArrayList(); - @NotNull private final List myDeletedFiles = ContainerUtil.newArrayList(); + @NotNull private final List myCopiedFiles = new ArrayList<>(); + @NotNull private final List myDeletedFiles = new ArrayList<>(); // for files moved in a subtree, which were the targets of merge (for instance). @NotNull private final Map myTreeConflicted = new HashMap<>(); @NotNull private final Map myCopyFromURLs = new HashMap<>(); @NotNull private final SvnVcs myVcs; private final SvnBranchConfigurationManager myBranchConfigurationManager; - @NotNull private final List filesToRefresh = ContainerUtil.newArrayList(); + @NotNull private final List filesToRefresh = new ArrayList<>(); @Nullable private final ProgressIndicator myProgress; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java index ce1fa20871ce..2918911f0c83 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java @@ -13,7 +13,6 @@ import com.intellij.openapi.vcs.history.VcsRevisionDescription; import com.intellij.openapi.vcs.history.VcsRevisionDescriptionImpl; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,6 +27,7 @@ import org.jetbrains.idea.svn.status.Status; import org.jetbrains.idea.svn.status.StatusType; import java.io.File; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -75,7 +75,7 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif public Map getCurrentRevisions(@NotNull Iterable files) { Map result = new HashMap<>(); Map items = new HashMap<>(); - List ioFiles = ContainerUtil.newArrayList(); + List ioFiles = new ArrayList<>(); for (VirtualFile file : files) { File ioFile = virtualToIoFile(file); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java index 5b598163d736..e8f63e526b25 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn; import com.intellij.openapi.application.ReadAction; @@ -21,6 +21,7 @@ import org.jetbrains.idea.svn.commandLine.SvnBindException; import org.jetbrains.idea.svn.info.Info; import java.io.File; +import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -42,7 +43,7 @@ public class SvnFileUrlMappingImpl implements SvnFileUrlMapping, PersistentState @NotNull private final SvnMapping myMapping = new SvnMapping(); // grouped; if there are several mappings one under another, will return the upmost @NotNull private final SvnMapping myMoreRealMapping = new SvnMapping(); - @NotNull private final List myErrorRoots = newArrayList(); + @NotNull private final List myErrorRoots = new ArrayList<>(); @NotNull private final MyRootsHelper myRootsHelper; @NotNull private final Project myProject; @NotNull private final NestedCopiesHolder myNestedCopiesHolder = new NestedCopiesHolder(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMapping.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMapping.java index 31e64e1463c3..0aa45dcd7f45 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMapping.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMapping.java @@ -17,7 +17,7 @@ import static com.intellij.util.containers.ContainerUtil.*; public class SvnMapping { private static final Comparator FILE_PATHS_COMPARATOR = (path1, path2) -> comparePaths(path1, path2); - @NotNull private final List myLonelyRoots = newArrayList(); + @NotNull private final List myLonelyRoots = new ArrayList<>(); @NotNull private final TreeMap myFile2UrlMap = new TreeMap<>(FILE_PATHS_COMPARATOR); @NotNull private final Map myUrl2FileMap = new HashMap(); // no additional info. for caching only (convert roots) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMappingSavedPart.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMappingSavedPart.java index 7758cdbe95c7..537b7e1fb262 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMappingSavedPart.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMappingSavedPart.java @@ -1,29 +1,14 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; -import static com.intellij.util.containers.ContainerUtil.newArrayList; - public class SvnMappingSavedPart { - public List myMappingRoots = newArrayList(); - public List myMoreRealMappingRoots = newArrayList(); + public List myMappingRoots = new ArrayList<>(); + public List myMoreRealMappingRoots = new ArrayList<>(); public void add(@NotNull RootUrlInfo info) { myMappingRoots.add(new SvnCopyRootSimple(info)); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java index 2f0b0a313831..2b8af1e5e0f1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java @@ -736,8 +736,8 @@ public class SvnVcs extends AbstractVcs { @NotNull private List filterUniqueByUrl(@NotNull List in, @NotNull Function convertor) { - List> infos = newArrayList(); - List notMatched = newArrayList(); + List> infos = new ArrayList<>(); + List notMatched = new ArrayList<>(); for (S s : in) { VirtualFile vf = convertor.apply(s); if (vf == null) continue; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/UniqueRootsFilter.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/UniqueRootsFilter.java index f852ffa6a6f3..504419f7062f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/UniqueRootsFilter.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/UniqueRootsFilter.java @@ -1,27 +1,13 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; import static com.intellij.openapi.vfs.VfsUtilCore.getRelativePath; import static com.intellij.util.containers.ContainerUtil.exists; -import static com.intellij.util.containers.ContainerUtil.newArrayList; import static java.util.Collections.sort; import static java.util.Comparator.comparing; import static org.jetbrains.idea.svn.SvnUtil.getRelativeUrl; @@ -30,7 +16,7 @@ public class UniqueRootsFilter { @NotNull public List filter(@NotNull List list) { - List result = newArrayList(); + List result = new ArrayList<>(); sort(list, comparing(item -> item.getVirtualFile().getPath())); for (T child : list) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java index ee1e862e34b9..50333c919601 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java @@ -15,6 +15,7 @@ import org.jetbrains.idea.svn.SvnProgressCanceller; import org.jetbrains.idea.svn.SvnVcs; import java.io.File; +import java.util.ArrayList; import java.util.List; import static com.intellij.openapi.application.ApplicationManager.getApplication; @@ -30,7 +31,7 @@ public class CleanupWorker extends Task.Backgroundable { @NotNull protected final List myRoots; @NotNull private final SvnVcs myVcs; - @NotNull private final List> myExceptions = newArrayList(); + @NotNull private final List> myExceptions = new ArrayList<>(); public CleanupWorker(@NotNull SvnVcs vcs, @NotNull List roots) { this(vcs, roots, null); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ResolveAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ResolveAction.java index f5892ad0afd9..a23b6e3001a3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ResolveAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ResolveAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.actions; @@ -12,11 +12,13 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnBundle; import org.jetbrains.idea.svn.SvnVcs; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import static com.intellij.util.containers.ContainerUtil.*; +import static com.intellij.util.containers.ContainerUtil.ar; +import static com.intellij.util.containers.ContainerUtil.exists; public class ResolveAction extends BasicAction { @NotNull @@ -40,7 +42,7 @@ public class ResolveAction extends BasicAction { @Override protected void batchPerform(@NotNull SvnVcs vcs, @NotNull VirtualFile[] files, @NotNull DataContext context) { boolean hasDirs = exists(files, VirtualFile::isDirectory); - List fileList = newArrayList(); + List fileList = new ArrayList<>(); if (!hasDirs) { Collections.addAll(fileList, files); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java index 9f8db9a89579..9e6d920ce828 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java @@ -10,7 +10,6 @@ import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ArrayUtil; import com.intellij.util.WaitForProgressToShow; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.net.HttpConfigurable; import com.intellij.util.net.IdeHttpClientHelpers; import com.intellij.util.net.ssl.CertificateManager; @@ -38,6 +37,7 @@ import java.io.IOException; import java.net.*; import java.nio.file.Path; import java.security.KeyManagementException; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -225,7 +225,7 @@ public class AuthenticationService { @NotNull private List getSupportedSslProtocols() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); switch (myConfiguration.getSslProtocols()) { case sslv3: diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java index c15c2e2b8bc6..27b1391dacc5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java @@ -1,9 +1,8 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.browse; import com.intellij.openapi.vcs.VcsException; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.api.*; @@ -54,7 +53,7 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient { public long createDirectory(@NotNull Target target, @NotNull String message, boolean makeParents) throws VcsException { assertUrl(target); - List parameters = ContainerUtil.newArrayList(); + List parameters = new ArrayList<>(); CommandUtil.put(parameters, target); CommandUtil.put(parameters, makeParents, "--parents"); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java index efee5d2992d9..8f3f754ff8b6 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java @@ -22,10 +22,7 @@ import org.jetbrains.idea.svn.status.StatusClient; import org.jetbrains.idea.svn.status.StatusType; import java.io.File; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -98,7 +95,7 @@ public class CmdCheckinClient extends BaseSvnClient implements CheckinClient { } }.doFilter(ContainerUtil.newArrayList(committables)); if (!childrenOfSomebody.isEmpty()) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); StatusClient statusClient = myFactory.createStatusClient(); for (File file : committables) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java index ee02b331e50b..e779c3cb4a9e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.checkin; import com.intellij.openapi.application.ReadAction; @@ -7,7 +7,6 @@ import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -17,6 +16,7 @@ import org.jetbrains.idea.svn.api.ProgressEvent; import org.jetbrains.idea.svn.api.ProgressTracker; import java.io.File; +import java.util.ArrayList; import java.util.List; public class IdeaCommitHandler implements CommitEventHandler, ProgressTracker { @@ -24,7 +24,7 @@ public class IdeaCommitHandler implements CommitEventHandler, ProgressTracker { private static final Logger LOG = Logger.getInstance(IdeaCommitHandler.class); @Nullable private final ProgressIndicator myProgress; - @NotNull private final List myDeletedFiles = ContainerUtil.newArrayList(); + @NotNull private final List myDeletedFiles = new ArrayList<>(); private final boolean myCheckCancel; private final boolean myTrackDeletedFiles; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java index b26005b7ecf3..5393d37a1e63 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.checkin; import com.intellij.openapi.application.ApplicationManager; @@ -33,8 +33,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import static com.intellij.util.containers.ContainerUtil.newArrayList; - public class SvnCheckinHandlerFactory extends VcsCheckinHandlerFactory { public SvnCheckinHandlerFactory() { super(SvnVcs.getKey()); @@ -55,7 +53,7 @@ public class SvnCheckinHandlerFactory extends VcsCheckinHandlerFactory { if (executor instanceof LocalCommitExecutor) return ReturnResult.COMMIT; final SvnVcs vcs = SvnVcs.getInstance(project); MultiMap copiesInfo = splitIntoCopies(vcs, panel.getSelectedChanges()); - List repoUrls = newArrayList(); + List repoUrls = new ArrayList<>(); for (Map.Entry> entry : copiesInfo.entrySet()) { if (entry.getValue().size() > 1) { repoUrls.add(entry.getKey()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java index 64a03ed19cef..67ef2d251e35 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.checkout; import com.intellij.openapi.application.ModalityState; @@ -19,7 +19,6 @@ import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.StatusBar; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,6 +34,7 @@ import org.jetbrains.idea.svn.dialogs.CheckoutDialog; import org.jetbrains.idea.svn.dialogs.UpgradeFormatDialog; import java.io.File; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Predicate; @@ -327,7 +327,7 @@ public class SvnCheckoutProvider implements CheckoutProvider { @NotNull private List loadSupportedFormats() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); try { result.addAll(myVcs.getFactoryFromSettings().createCheckoutClient().getSupportedFormats()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java index ecabbc84c911..3189a47a0418 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.util.text.StringUtil; @@ -18,8 +18,8 @@ import java.util.List; // TODO: Probably make command immutable and use CommandBuilder for updates. public class Command { - @NotNull private final List myParameters = ContainerUtil.newArrayList(); - @NotNull private final List myOriginalParameters = ContainerUtil.newArrayList(); + @NotNull private final List myParameters = new ArrayList<>(); + @NotNull private final List myOriginalParameters = new ArrayList<>(); @NotNull private final SvnCommandName myName; private File workingDirectory; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java index 44208dd55587..95661fe8308d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java @@ -26,6 +26,7 @@ import java.io.File; import java.io.IOException; import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; @@ -64,7 +65,7 @@ public class CommandExecutor { myListeners.addListener(new CommandCancelTracker()); } myLock = new Object(); - myTempFiles = ContainerUtil.newArrayList(); + myTempFiles = new ArrayList<>(); myCommandLine = createCommandLine(); myCommandLine.setExePath(exePath); myCommandLine.setWorkDirectory(command.getWorkingDirectory()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java index 60d4c1c37a8f..b15b204c8da7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.diagnostic.Logger; @@ -15,6 +15,7 @@ import org.jetbrains.idea.svn.api.Url; import org.jetbrains.idea.svn.auth.AuthenticationService; import java.io.File; +import java.util.ArrayList; import java.util.List; /** @@ -36,7 +37,7 @@ public class CommandRuntime { SvnApplicationSettings settings = SvnApplicationSettings.getInstance(); exePath = settings.getCommandLinePath(); - myModules = ContainerUtil.newArrayList(); + myModules = new ArrayList<>(); myModules.add(new CommandParametersResolutionModule(this)); myModules.add(new ProxyModule(this)); myModules.add(new SshTunnelRuntimeModule(this)); @@ -166,7 +167,7 @@ public class CommandRuntime { @Nullable private AuthCallbackCase createCallback(@NotNull final String errText, @Nullable final Url url, boolean isUnderTerminal) { - List authCases = ContainerUtil.newArrayList(); + List authCases = new ArrayList<>(); if (isUnderTerminal) { // Subversion client does not prompt for proxy credentials (just fails with error) even in terminal mode. So we handle this case the diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java index f3a53c0a4e15..15bce0863412 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/delete/CmdDeleteClient.java @@ -1,8 +1,7 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.delete; import com.intellij.openapi.vcs.VcsException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.api.BaseSvnClient; @@ -42,7 +41,7 @@ public class CmdDeleteClient extends BaseSvnClient implements DeleteClient { @Override public long delete(@NotNull Url url, @NotNull String message) throws VcsException { Target target = Target.on(url); - List parameters = ContainerUtil.newArrayList(); + List parameters = new ArrayList<>(); CommandUtil.put(parameters, target); parameters.add("--message"); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java index a2933a3dcba1..b0866cda6290 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java @@ -25,7 +25,6 @@ import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.components.labels.LinkLabel; import com.intellij.ui.components.labels.LinkListener; import com.intellij.util.Consumer; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.hash.EqualityPolicy; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.ui.UIUtil; @@ -292,7 +291,7 @@ public class CopiesPanel { @NotNull private List getSupportedFormats() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); ClientFactory factory = myVcs.getFactory(); try { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java index 8dde3feea02e..960ed27992e4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.dialogs; import com.intellij.CommonBundle; @@ -41,7 +41,7 @@ public class RepositoryTreeNode implements TreeNode, Disposable { myUserObject = userObject; myLoadState = state; - myChildren = ContainerUtil.newArrayList(); + myChildren = new ArrayList<>(); myChildrenLoadState = NodeLoadState.EMPTY; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetKeywordsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetKeywordsDialog.java index 8d888eae62c1..680c0aacd193 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetKeywordsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetKeywordsDialog.java @@ -12,10 +12,8 @@ import org.jetbrains.idea.svn.properties.PropertyValue; import javax.swing.*; import java.awt.*; -import java.util.HashSet; import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public class SetKeywordsDialog extends DialogWrapper { @@ -35,7 +33,7 @@ public class SetKeywordsDialog extends DialogWrapper { protected SetKeywordsDialog(Project project, @Nullable PropertyValue keywordsValue) { super(project, false); - myKeywordOptions = ContainerUtil.newArrayList(); + myKeywordOptions = new ArrayList<>(); myKeywordsValue = keywordsValue; setTitle("SVN Keywords"); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java index 09aae1e776f8..6690666a4bf9 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java @@ -17,11 +17,11 @@ import org.jetbrains.idea.svn.api.Target; import org.jetbrains.idea.svn.browse.DirectoryEntry; import org.jetbrains.idea.svn.dialogs.RepositoryTreeNode; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; -import static com.intellij.util.containers.ContainerUtil.newArrayList; import static com.intellij.util.containers.ContainerUtil.sorted; class RepositoryLoader extends Loader { @@ -87,7 +87,7 @@ class RepositoryLoader extends Loader { private class LoadTask extends Task.Backgroundable { @NotNull private final Pair myData; - @NotNull private final List entries = newArrayList(); + @NotNull private final List entries = new ArrayList<>(); @Nullable private String error; private LoadTask(@NotNull Pair data) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java index 9fe44bf9df7a..2da12454e8f7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.diff; import com.intellij.openapi.diagnostic.Logger; @@ -9,7 +9,6 @@ import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vcs.changes.CurrentContentRevision; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -68,7 +67,7 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient { assertUrl(target1); assertUrl(target2); - List parameters = ContainerUtil.newArrayList(); + List parameters = new ArrayList<>(); CommandUtil.put(parameters, target1); CommandUtil.put(parameters, target2); @@ -87,7 +86,7 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient { throws SvnBindException { try { DiffInfo diffInfo = CommandUtil.parse(executor.getOutput(), DiffInfo.class); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); if (diffInfo != null) { for (DiffPath path : diffInfo.diffPaths) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java index 6663d8004603..0f30c909c86d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CmdHistoryClient.java @@ -1,22 +1,7 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.VcsException; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.api.BaseSvnClient; @@ -108,6 +93,6 @@ public class CmdHistoryClient extends BaseSvnClient implements HistoryClient { public static class LogInfo { @XmlElement(name = "logentry") - public List entries = ContainerUtil.newArrayList(); + public List entries = new ArrayList<>(); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntry.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntry.java index 480cc05a16c7..af5c5c00398e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntry.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntry.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.history; import com.intellij.util.containers.ContainerUtil; @@ -20,6 +6,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.xml.bind.annotation.*; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -100,10 +87,10 @@ public class LogEntry { @XmlElementWrapper(name = "paths") @XmlElement(name = "path") - private final List changedPaths = ContainerUtil.newArrayList(); + private final List changedPaths = new ArrayList<>(); @XmlElement(name = "logentry") - private final List childEntries = ContainerUtil.newArrayList(); + private final List childEntries = new ArrayList<>(); @NotNull public List getChildEntries() { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java index 17e090330554..e116be46ce68 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java @@ -435,7 +435,7 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar private List collectDetails(@NotNull List changes, @NotNull Set> duplicates) throws VcsException { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (Change change : changes) { // directory statuses are already uploaded diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java index 7b9b7e3112ed..cce341b0d298 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java @@ -45,7 +45,6 @@ import java.util.*; import static com.intellij.openapi.application.ApplicationManager.getApplication; import static com.intellij.openapi.progress.ProgressManager.progress; import static com.intellij.openapi.progress.ProgressManager.progress2; -import static com.intellij.util.containers.ContainerUtil.newArrayList; import static java.util.Collections.singletonList; import static org.jetbrains.idea.svn.SvnBundle.message; @@ -124,7 +123,7 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi @NotNull RepositoryLocation location, int maxCount) throws VcsException { SvnRepositoryLocation svnLocation = (SvnRepositoryLocation)location; - List result = newArrayList(); + List result = new ArrayList<>(); Url repositoryRoot = getRepositoryRoot(svnLocation); ThrowableConsumer resultConsumer = logEntry -> result.add(new SvnChangeList(myVcs, svnLocation, logEntry, repositoryRoot)); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java index 450cf3f44020..04e861a10ff8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.history; import com.intellij.openapi.application.ApplicationManager; @@ -17,11 +17,11 @@ import org.jetbrains.idea.svn.api.Url; import org.jetbrains.idea.svn.checkin.CommitInfo; import java.io.IOException; +import java.util.ArrayList; import java.util.Date; import java.util.List; import static com.intellij.openapi.progress.ProgressManager.progress; -import static com.intellij.util.containers.ContainerUtil.newArrayList; import static com.intellij.vcsUtil.VcsUtil.getFilePathOnNonLocal; import static org.jetbrains.idea.svn.SvnBundle.message; import static org.jetbrains.idea.svn.SvnUtil.getFileContents; @@ -38,7 +38,7 @@ public class SvnFileRevision implements VcsFileRevision { @NotNull private final Url myURL; private final Revision myPegRevision; private final String myCopyFromPath; - @NotNull private final List myMergeSources = newArrayList(); + @NotNull private final List myMergeSources = new ArrayList<>(); @Deprecated // Required for compatibility with external plugins. public SvnFileRevision(@NotNull SvnVcs vcs, diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/WcInfoLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/WcInfoLoader.java index 0742dfcade74..446d0a69f4b1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/WcInfoLoader.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/WcInfoLoader.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.history; import com.intellij.openapi.util.Ref; @@ -17,6 +17,7 @@ import org.jetbrains.idea.svn.dialogs.WCInfo; import org.jetbrains.idea.svn.dialogs.WCInfoWithBranches; import java.io.File; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -38,7 +39,7 @@ public class WcInfoLoader { @NotNull public List loadRoots() { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (WCInfo info : myVcs.getAllWcInfos()) { ContainerUtil.addIfNotNull(result, createInfo(info)); @@ -79,7 +80,7 @@ public class WcInfoLoader { SvnBranchConfigurationNew configuration = SvnBranchConfigurationManager.getInstance(myVcs.getProject()).get(rootUrlInfo.getVirtualFile()); Ref workingCopyBranch = Ref.create(); - List branches = ContainerUtil.newArrayList(); + List branches = new ArrayList<>(); Url trunk = configuration.getTrunk(); if (trunk != null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java index 26b23bb6504d..84b71efe73db 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java @@ -12,7 +12,6 @@ import com.intellij.openapi.vcs.changes.ChangesUtil; import com.intellij.openapi.vcs.changes.EmptyChangelistBuilder; import com.intellij.openapi.vcs.update.UpdatedFilesReverseSide; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnPropertyKeys; @@ -22,10 +21,7 @@ import org.jetbrains.idea.svn.api.Target; import org.jetbrains.idea.svn.properties.PropertyValue; import java.io.File; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; +import java.util.*; public class GatheringChangelistBuilder extends EmptyChangelistBuilder { @@ -39,7 +35,7 @@ public class GatheringChangelistBuilder extends EmptyChangelistBuilder { public GatheringChangelistBuilder(@NotNull SvnVcs vcs, @NotNull UpdatedFilesReverseSide files) { myVcs = vcs; myFiles = files; - myChanges = ContainerUtil.newArrayList(); + myChanges = new ArrayList<>(); myCheckSet = new HashSet<>(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Intersection.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Intersection.java index 889419363ecd..8dc57aead122 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Intersection.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Intersection.java @@ -6,13 +6,13 @@ import com.intellij.openapi.vcs.changes.LocalChangeList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static com.intellij.util.ObjectUtils.notNull; import static com.intellij.util.containers.ContainerUtil.concat; -import static com.intellij.util.containers.ContainerUtil.newArrayList; public class Intersection { @@ -20,7 +20,7 @@ public class Intersection { @NotNull private final Map> myChangesByLists = new HashMap<>(); public void add(@NotNull LocalChangeList list, @NotNull Change change) { - myChangesByLists.computeIfAbsent(list.getName(), key -> newArrayList()).add(change); + myChangesByLists.computeIfAbsent(list.getName(), key -> new ArrayList<>()).add(change); myListComments.put(list.getName(), notNull(list.getComment(), list.getName())); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java index 41d6bb7ba897..be2e0bab9326 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java @@ -17,11 +17,11 @@ import org.jetbrains.idea.svn.mergeinfo.MergeCheckResult; import org.jetbrains.idea.svn.mergeinfo.MergeChecker; import org.jetbrains.idea.svn.mergeinfo.OneShotMergeInfoHelper; +import java.util.ArrayList; import java.util.List; import static com.intellij.openapi.progress.ProgressManager.progress; import static com.intellij.openapi.progress.ProgressManager.progress2; -import static com.intellij.util.containers.ContainerUtil.newArrayList; import static org.jetbrains.idea.svn.SvnBundle.message; public class MergeCalculatorTask extends BaseMergeTask { @@ -41,7 +41,7 @@ public class MergeCalculatorTask extends BaseMergeTask { super(mergeProcess); myCopyPoint = copyPoint; myCallback = callback; - myChangeLists = newArrayList(); + myChangeLists = new ArrayList<>(); // TODO: Previously it was configurable - either to use OneShotMergeInfoHelper or BranchInfo as merge checker, but later that logic // TODO: was commented (in 80ebdbfea5210f6c998e67ddf28ca9c670fa4efe on 5/28/2010). // TODO: Still check if we need to preserve such configuration or it is sufficient to always use OneShotMergeInfoHelper. @@ -97,7 +97,7 @@ public class MergeCalculatorTask extends BaseMergeTask { @NotNull private List getNotMergedChangeLists(@NotNull List> changeLists) { - List result = newArrayList(); + List result = new ArrayList<>(); progress("Collecting not merged revisions"); for (Pair pair : changeLists) { @@ -139,7 +139,7 @@ public class MergeCalculatorTask extends BaseMergeTask { long revisionToExclude, int size, @NotNull PairFunction resultProvider) throws VcsException { - List result = newArrayList(); + List result = new ArrayList<>(); ((SvnCommittedChangesProvider)mergeContext.getVcs().getCommittedChangesProvider()) .getCommittedChangesWithMergedRevisons(settings, new SvnRepositoryLocation(mergeContext.getSourceUrl()), diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/Reverter.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/Reverter.java index adce088a2721..9e3b8aeda8c3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/Reverter.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/Reverter.java @@ -5,7 +5,6 @@ import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.rollback.RollbackProgressListener; -import com.intellij.util.containers.ContainerUtil; import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.SvnFileSystemListener; @@ -32,7 +31,7 @@ public class Reverter { myVcs = vcs; myHandler = createRevertHandler(exceptions, listener); myExceptions = exceptions; - myFromToModified = ContainerUtil.newArrayList(); + myFromToModified = new ArrayList<>(); myProperties = new HashMap<>(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java index 38597f8f3c27..b269cf2ff62a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java @@ -27,6 +27,7 @@ import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -37,7 +38,6 @@ import static com.intellij.openapi.util.io.FileUtil.toSystemIndependentName; import static com.intellij.openapi.util.text.StringUtil.isEmptyOrSpaces; import static com.intellij.openapi.vcs.VcsBundle.message; import static com.intellij.util.ObjectUtils.notNull; -import static com.intellij.util.containers.ContainerUtil.newArrayList; public class ApplyPatchSaveToFileExecutor implements ApplyPatchExecutor { private static final Logger LOG = Logger.getInstance(ApplyPatchSaveToFileExecutor.class); @@ -86,7 +86,7 @@ public class ApplyPatchSaveToFileExecutor implements ApplyPatchExecutor toOnePatchGroup(@NotNull MultiMap patchGroups, @NotNull VirtualFile newPatchBase) throws IOException { - List result = newArrayList(); + List result = new ArrayList<>(); for (Map.Entry> entry : patchGroups.entrySet()) { VirtualFile oldPatchBase = entry.getKey(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java index ee5adc278884..3ae3ed4706c5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java @@ -8,7 +8,6 @@ import com.intellij.openapi.vcs.VcsBundle; import com.intellij.openapi.vcs.update.FileGroup; import com.intellij.openapi.vcs.update.UpdatedFiles; import com.intellij.openapi.wm.StatusBar; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.Stack; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnBundle; @@ -20,6 +19,7 @@ import org.jetbrains.idea.svn.checkin.CommitInfo; import org.jetbrains.idea.svn.status.StatusType; import java.io.File; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -69,7 +69,7 @@ public class UpdateEventHandler implements ProgressTracker { * TODO: UPDATE_STARTED event in some code paths. */ public void startUpdate() { - myFilesWaitingForRevision.push(ContainerUtil.newArrayList()); + myFilesWaitingForRevision.push(new ArrayList<>()); } public void finishUpdate() { @@ -170,7 +170,7 @@ public class UpdateEventHandler implements ProgressTracker { if (mySequentialUpdatesContext != null) { mySequentialUpdatesContext.registerExternalRootBeingUpdated(event.getFile()); } - myFilesWaitingForRevision.push(ContainerUtil.newArrayList()); + myFilesWaitingForRevision.push(new ArrayList<>()); myExternalsCount++; myText = SvnBundle.message("progress.text.updating.external.location", event.getFile().getAbsolutePath()); } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/QuickMergeTestInteraction.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/QuickMergeTestInteraction.java index 1d93b47a7edf..79fd6b53d73c 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/QuickMergeTestInteraction.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/QuickMergeTestInteraction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn; import com.intellij.openapi.vcs.FilePath; @@ -14,10 +14,10 @@ import org.jetbrains.idea.svn.integrate.QuickMergeInteraction; import org.jetbrains.idea.svn.integrate.SelectMergeItemsResult; import org.jetbrains.idea.svn.mergeinfo.MergeChecker; +import java.util.ArrayList; import java.util.List; import static com.intellij.util.containers.ContainerUtil.isEmpty; -import static com.intellij.util.containers.ContainerUtil.newArrayList; import static com.intellij.util.containers.ContainerUtilRt.emptyList; public class QuickMergeTestInteraction implements QuickMergeInteraction { @@ -30,7 +30,7 @@ public class QuickMergeTestInteraction implements QuickMergeInteraction { public QuickMergeTestInteraction(boolean reintegrate, @Nullable Function.Mono> selectedListsProvider) { myReintegrateAnswer = reintegrate; mySelectedListsProvider = selectedListsProvider; - myExceptions = newArrayList(); + myExceptions = new ArrayList<>(); } @NotNull diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java index 18cc7debf127..b5c0a33f5947 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnProtocolsTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn; import com.intellij.openapi.progress.EmptyProgressIndicator; @@ -41,7 +41,6 @@ import java.util.Collections; import java.util.List; import static com.intellij.testFramework.UsefulTestCase.assertExists; -import static com.intellij.util.containers.ContainerUtil.newArrayList; import static org.jetbrains.idea.svn.SvnUtil.parseUrl; import static org.junit.Assert.*; @@ -94,7 +93,7 @@ public class SvnProtocolsTest extends SvnTestCase { } private void testBrowseRepositoryImpl(Url url) throws VcsException { - List list = newArrayList(); + List list = new ArrayList<>(); vcs.getFactoryFromSettings().createBrowseClient().list(Target.on(url), null, null, list::add); assertTrue(!list.isEmpty()); diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalSettingsPanel.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalSettingsPanel.java index 03ce8505bd1f..9c728d933117 100644 --- a/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalSettingsPanel.java +++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalSettingsPanel.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.terminal; import com.google.common.collect.Lists; @@ -16,12 +16,12 @@ import com.intellij.ui.components.JBCheckBox; import com.intellij.ui.components.JBTextField; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.event.DocumentEvent; import java.awt.*; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Supplier; @@ -64,7 +64,7 @@ public class TerminalSettingsPanel { configureShellPathField(); configureStartDirectoryField(); - List customComponents = ContainerUtil.newArrayList(); + List customComponents = new ArrayList<>(); for (LocalTerminalCustomizer c : LocalTerminalCustomizer.EP_NAME.getExtensions()) { UnnamedConfigurable configurable = c.getConfigurable(projectOptionsProvider.getProject()); if (configurable != null) { diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalSignalUtil.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalSignalUtil.java index 480dd42be991..f7c02d9c8436 100644 --- a/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalSignalUtil.java +++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalSignalUtil.java @@ -6,13 +6,13 @@ import com.intellij.jna.JnaLoader; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.ThrowableComputable; -import com.intellij.util.containers.ContainerUtil; import com.sun.jna.Library; import com.sun.jna.Memory; import com.sun.jna.Native; import com.sun.jna.Pointer; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; public class TerminalSignalUtil { @@ -40,7 +40,7 @@ public class TerminalSignalUtil { if (!SystemInfo.isUnix || !JnaLoader.isLoaded()) { return callback.compute(); } - List ignored = ContainerUtil.newArrayList(); + List ignored = new ArrayList<>(); LibC lib = null; try { lib = Native.load("c", LibC.class); diff --git a/plugins/yaml/src/org/jetbrains/yaml/schema/YamlArrayAdapter.java b/plugins/yaml/src/org/jetbrains/yaml/schema/YamlArrayAdapter.java index 139dffa0d05a..7b5eefcfdd0f 100644 --- a/plugins/yaml/src/org/jetbrains/yaml/schema/YamlArrayAdapter.java +++ b/plugins/yaml/src/org/jetbrains/yaml/schema/YamlArrayAdapter.java @@ -1,9 +1,8 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.yaml.schema; import com.intellij.openapi.util.NotNullLazyValue; import com.intellij.psi.PsiElement; -import com.intellij.util.containers.ContainerUtil; import com.jetbrains.jsonSchema.extension.adapters.JsonArrayValueAdapter; import com.jetbrains.jsonSchema.extension.adapters.JsonObjectValueAdapter; import com.jetbrains.jsonSchema.extension.adapters.JsonValueAdapter; @@ -13,6 +12,7 @@ import org.jetbrains.yaml.psi.YAMLSequence; import org.jetbrains.yaml.psi.YAMLSequenceItem; import org.jetbrains.yaml.psi.YAMLValue; +import java.util.ArrayList; import java.util.List; public class YamlArrayAdapter implements JsonArrayValueAdapter { @@ -86,7 +86,7 @@ public class YamlArrayAdapter implements JsonArrayValueAdapter { @NotNull private List computeChildAdapters() { List items = myArray.getItems(); - List adapters = ContainerUtil.newArrayListWithCapacity(items.size()); + List adapters = new ArrayList<>(items.size()); for (YAMLSequenceItem item: items) { YAMLValue value = item.getValue(); if (value == null) { diff --git a/plugins/yaml/src/org/jetbrains/yaml/schema/YamlObjectAdapter.java b/plugins/yaml/src/org/jetbrains/yaml/schema/YamlObjectAdapter.java index 31dc831d8f05..66caa4288f17 100644 --- a/plugins/yaml/src/org/jetbrains/yaml/schema/YamlObjectAdapter.java +++ b/plugins/yaml/src/org/jetbrains/yaml/schema/YamlObjectAdapter.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.yaml.schema; import com.intellij.openapi.util.NotNullLazyValue; @@ -7,7 +7,6 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiReference; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import com.jetbrains.jsonSchema.extension.adapters.JsonArrayValueAdapter; import com.jetbrains.jsonSchema.extension.adapters.JsonObjectValueAdapter; import com.jetbrains.jsonSchema.extension.adapters.JsonPropertyAdapter; @@ -15,6 +14,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.yaml.psi.*; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -89,7 +89,7 @@ public class YamlObjectAdapter implements JsonObjectValueAdapter { @NotNull private List computeChildAdapters() { Collection keyValues = myObject.getKeyValues(); - List adapters = ContainerUtil.newArrayListWithCapacity(keyValues.size()); + List adapters = new ArrayList<>(keyValues.size()); for (YAMLKeyValue value : keyValues) { if (addPropertiesFromReferencedObject(adapters, value)) continue; adapters.add(new YamlPropertyAdapter(value)); diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java b/python/psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java index df8041a99847..f9ad95bd6484 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java +++ b/python/psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.python.psi.impl; import com.google.common.base.Preconditions; @@ -456,7 +456,7 @@ public class PyPsiUtils { } public static List getAttributeValuesFromFile(@NotNull PyFile file, @NotNull String name) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); final PyTargetExpression attr = file.findTopLevelAttribute(name); if (attr != null) { sequenceToList(result, attr.findAssignedValue()); @@ -475,7 +475,7 @@ public class PyPsiUtils { } public static List getStringValues(PyExpression[] elements) { - List results = ContainerUtil.newArrayList(); + List results = new ArrayList<>(); for (PyExpression element : elements) { if (element instanceof PyStringLiteralExpression) { results.add(((PyStringLiteralExpression)element).getStringValue()); diff --git a/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java b/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java index 320d0d78f30a..0b43b2b34987 100644 --- a/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java +++ b/python/src/com/jetbrains/python/console/PydevConsoleRunnerImpl.java @@ -90,10 +90,8 @@ import java.awt.*; import java.io.IOException; import java.net.ServerSocket; import java.nio.charset.StandardCharsets; -import java.util.Collections; import java.util.List; -import java.util.Map; -import java.util.Scanner; +import java.util.*; import java.util.stream.Collectors; import static com.intellij.execution.runners.AbstractConsoleRunnerWithHistory.registerActionShortcuts; @@ -165,7 +163,7 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner { } private List fillRunActionsToolbar(final DefaultActionGroup toolbarActions) { - List actions = ContainerUtil.newArrayList(); + List actions = new ArrayList<>(); // Rerun actions.add(createRerunAction()); // Stop @@ -195,7 +193,7 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner { } private List fillOutputActionsToolbar(final DefaultActionGroup toolbarActions) { - List actions = ContainerUtil.newArrayList(); + List actions = new ArrayList<>(); // Use soft wraps actions.add(new SoftWrapAction()); // Scroll to the end diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomManagerImpl.java index 3f48c363998e..eca0b282d46a 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomManagerImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomManagerImpl.java @@ -159,7 +159,7 @@ public final class DomManagerImpl extends DomManager { return Collections.emptyList(); } - final List events = ContainerUtil.newArrayList(); + final List events = new ArrayList<>(); VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor() { @Override public boolean visitFile(@NotNull VirtualFile file) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java b/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java index 415d16caddd2..7b65a015b6ad 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java @@ -27,10 +27,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; /** * Base class for "Go To Symbol" contributors. @@ -74,7 +71,7 @@ public abstract class GoToSymbolProvider implements ChooseByNameContributor { @Override @NotNull public NavigationItem[] getItemsByName(final String name, final String pattern, final Project project, boolean includeNonProjectItems) { - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); for (Module module : getAcceptableModules(project)) { addItems(module, name, result); } diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java index 9ac95b37e97e..f0577f84ebf2 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java @@ -16,11 +16,11 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.*; -import com.intellij.util.containers.ContainerUtil; import com.intellij.xml.util.HtmlUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -50,7 +50,7 @@ public class HtmlSelectioner extends AbstractWordSelectioner { result = super.select(e, editorText, cursorOffset, editor); } else { - result = ContainerUtil.newArrayList(); + result = new ArrayList<>(); } final PsiElement parent = e.getParent(); diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java index 1d7c4388b440..7c1ad61e240e 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java @@ -13,10 +13,7 @@ import com.intellij.xml.util.HtmlUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.regex.Pattern; /** @@ -82,7 +79,7 @@ public class BemEmmetFilter extends ZenCodingFilter { BemState nodeBemState = BEM_STATE.get(node); BemState bemState = extractBemStateFromClassName(className, elementSeparator, modifierSeparator); - List result = ContainerUtil.newArrayList(); + List result = new ArrayList<>(); if (!bemState.isEmpty()) { String nodeBlockValue = nodeBemState != null ? nodeBemState.getBlock() : null; diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java index 28cc0a8c1533..0033d47d3e38 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/ClimbUpOperationNode.java @@ -1,28 +1,13 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.template.emmet.nodes; import com.intellij.codeInsight.template.CustomTemplateCallback; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.List; -import static com.intellij.util.containers.ContainerUtil.newArrayList; - /** * @author zolotov */ @@ -49,7 +34,7 @@ public class ClimbUpOperationNode extends ZenCodingNode { int totalIterations, String surroundedText, CustomTemplateCallback callback, boolean insertSurroundedTextAtTheEnd, GenerationNode parent) { - List result = newArrayList(); + List result = new ArrayList<>(); result.addAll(myLeftOperand.expand(numberInIteration, totalIterations, surroundedText, callback, insertSurroundedTextAtTheEnd, parent)); GenerationNode grandParent = parent != null ? parent.getParent() : null; if (grandParent != null) {