deprecate guava Lists.*

GitOrigin-RevId: c8a746f6620e525ba8f32e4d79dd6a40949e4bc6
This commit is contained in:
Vladimir Krivosheev
2020-04-22 13:27:59 +02:00
committed by intellij-monorepo-bot
parent 081ac7f71f
commit acb302b622
8 changed files with 23 additions and 54 deletions

View File

@@ -9,6 +9,9 @@
<dependency maven-id="org.codehaus.mojo:animal-sniffer-annotations" />
</exclude>
</properties>
<ANNOTATIONS>
<root url="file://$PROJECT_DIR$/lib/annotations/guava" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/29.0-jre/guava-29.0-jre.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar!/" />

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2019 JetBrains 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-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
@file:Suppress("DEPRECATION") // declared for import com.intellij.codeInsight.completion.CompletionProgressIndicator
package com.intellij.internal
import com.google.common.collect.Lists
import com.google.gson.Gson
import com.intellij.codeInsight.completion.CodeCompletionHandlerBase
import com.intellij.codeInsight.completion.CompletionProgressIndicator
@@ -210,7 +209,7 @@ internal class CompletionQualityStatsAction : AnAction() {
// Find offsets to words and words on which we want to try completion
private fun getCompletionAttempts(file: PsiFile, wordSet: HashMap<String, Int>): List<Pair<Int, String>> {
val maxWordFrequency = 2
val res = Lists.newArrayList<Pair<Int, String>>()
val res = ArrayList<Pair<Int, String>>()
val text = file.text
for (range in StringUtil.getWordIndicesIn(text)) {

View File

@@ -2,7 +2,6 @@
package com.intellij.remote;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.intellij.util.AbstractPathMapper;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.PathMapper;
@@ -15,7 +14,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class RemoteProcessUtil {
public final class RemoteProcessUtil {
@Contract("null -> null")
public static String toRemoteFileSystemStyle(@Nullable String path) {
if (path == null) {
@@ -31,10 +30,8 @@ public class RemoteProcessUtil {
@NotNull
public static String remapPathsList(@NotNull String pathsValue, @NotNull PathMapper pathMapper, @NotNull String interpreterPath) {
boolean isWin = RemoteFile.isWindowsPath(interpreterPath);
List<String> paths = Lists.newArrayList(pathsValue.split(File.pathSeparator));
List<String> mappedPaths = new ArrayList<>();
for (String path : paths) {
for (String path : pathsValue.split(File.pathSeparator)) {
mappedPaths.add(new RemoteFile(pathMapper.convertToRemote(path), isWin).getPath());
}
return Joiner.on(isWin ? ';' : ':').join(mappedPaths);

View File

@@ -1,29 +1,14 @@
// Copyright 2000-2019 JetBrains 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-2020 JetBrains s.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.diagnostic
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.progress.ProcessCanceledException
import java.lang.reflect.Member
import java.util.concurrent.CancellationException
import kotlin.reflect.KProperty
import kotlin.reflect.jvm.javaField
import kotlin.reflect.jvm.javaGetter
inline fun <reified T : Any> logger() = Logger.getInstance(T::class.java)
fun logger(category: String) = Logger.getInstance(category)
/**
* Get logger instance to be used in Kotlin package methods. Usage:
* ```
* private val LOG: Logger = logger(::LOG) // define at top level of the file containing the function
* ```
* Notice explicit type declaration which can't be skipped in this case.
*/
@Deprecated("Use Logger.getInstance() instead", replaceWith = ReplaceWith("Logger.getInstance(class)", "com.intellij.openapi.diagnostic.Logger"))
fun logger(field: KProperty<Logger>) = Logger.getInstance((field.javaField ?: field.javaGetter as? Member)?.declaringClass!!)
inline fun Logger.debug(e: Exception? = null, lazyMessage: () -> String) {
if (isDebugEnabled) {
debug(lazyMessage(), e)

View File

@@ -2,7 +2,6 @@
package org.jetbrains.plugins.terminal;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.intellij.execution.TaskExecutor;
import com.intellij.execution.configuration.EnvironmentVariablesData;
import com.intellij.execution.process.ProcessAdapter;
@@ -35,6 +34,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -243,8 +243,7 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
public static String @NotNull [] getCommand(String shellPath, Map<String, String> envs, boolean shellIntegration) {
if (SystemInfo.isUnix) {
List<String> command = Lists.newArrayList(shellPath.split(" "));
List<String> command = ContainerUtil.newArrayList(shellPath.split(" "));
String shellCommand = command.size() > 0 ? command.get(0) : null;
String shellName = getShellName(shellCommand);
@@ -260,7 +259,8 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
}
}
List<String> result = Lists.newArrayList(shellCommand);
List<String> result = new ArrayList<>();
result.add(shellCommand);
String rcFilePath = findRCFile(shellName);
@@ -350,7 +350,7 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
}
private static boolean isLogin(@NotNull List<String> command) {
return command.stream().anyMatch(s -> LOGIN_CLI_OPTIONS.contains(s));
return command.stream().anyMatch(LOGIN_CLI_OPTIONS::contains);
}
private static class PtyProcessHandler extends ProcessHandler implements TaskExecutor {

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 JetBrains s.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.vfs;
import com.google.common.collect.Lists;
import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileEditor.FileEditor;
@@ -22,10 +21,10 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeListener;
import java.util.Collections;
import java.util.List;
public class TerminalSessionEditor extends UserDataHolderBase implements FileEditor {
public final class TerminalSessionEditor extends UserDataHolderBase implements FileEditor {
private final Project myProject;
private final TerminalSessionVirtualFileImpl myFile;
private final TtyConnectorWaitFor myWaitFor;
@@ -39,7 +38,7 @@ public class TerminalSessionEditor extends UserDataHolderBase implements FileEdi
myFile.getTerminalWidget().setNextProvider(new TerminalActionProviderBase() {
@Override
public List<TerminalAction> getActions() {
return Lists.newArrayList(
return Collections.singletonList(
new TerminalAction(settings.getCloseSessionActionPresentation(), input -> {
handleCloseSession();
return true;

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 JetBrains s.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;
import com.google.common.collect.Lists;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.OrderRootType;
@@ -15,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -44,7 +44,7 @@ public class PyDirectoryIndexExcludePolicy implements DirectoryIndexExcludePolic
@Override
public Function<Sdk, List<VirtualFile>> getExcludeSdkRootsStrategy() {
return sdk -> {
List<VirtualFile> result = Lists.newLinkedList();
List<VirtualFile> result = new LinkedList<>();
if (sdk != null) {
Set<VirtualFile> roots = ContainerUtil.set(sdk.getRootProvider().getFiles(OrderRootType.CLASSES));

View File

@@ -1,32 +1,18 @@
/*
* 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-2020 JetBrains s.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.packaging;
import com.google.common.collect.Lists;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.webcore.packaging.InstalledPackage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
/**
* @author vlan
*/
public class PyPackage extends InstalledPackage {
public final class PyPackage extends InstalledPackage {
private final String myLocation;
private final List<PyRequirement> myRequirements;
@@ -48,8 +34,8 @@ public class PyPackage extends InstalledPackage {
* @param requirement to check if package matches
* @return true if matches.
*/
public boolean matches(@NotNull final PyRequirement requirement) {
return requirement.match(Lists.newArrayList(this)) != null;
public boolean matches(@NotNull PyRequirement requirement) {
return requirement.match(Collections.singletonList(this)) != null;
}
@Nullable