remove deprecated/insert more insistent warnings about deprecation

GitOrigin-RevId: b19815cfd126dce856b70feb421776526b656819
This commit is contained in:
Alexey Kudravtsev
2019-09-10 12:50:55 +00:00
committed by intellij-monorepo-bot
parent 3ac4f19905
commit 36b5a0cfd4
14 changed files with 29 additions and 90 deletions
@@ -170,6 +170,7 @@ public class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass, Clas
@Deprecated //todo to be removed in IDEA 17
@ApiStatus.ScheduledForRemoval(inVersion = "2017")
public static Query<PsiClass> search(@NotNull final PsiClass aClass, @NotNull SearchScope scope, final boolean checkDeep, final boolean checkInheritance) {
DeprecatedMethodException.report("Use ClassInheritorsSearch.search(PsiClass, SearchScope, boolean, boolean, boolean) instead");
return search(aClass, scope, checkDeep, checkInheritance, true);
}
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.editor;
import com.intellij.util.DeprecatedMethodException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -47,6 +48,7 @@ public interface FoldingModel {
@ApiStatus.ScheduledForRemoval(inVersion = "2018")
@Deprecated
default boolean addFoldRegion(@NotNull FoldRegion region) {
DeprecatedMethodException.report("Use addFoldRegion(int,int,String) instead");
return true;
}
@@ -759,7 +759,7 @@ public class InjectedLanguageUtil {
*/
@Deprecated
public static <T> void putInjectedFileUserData(MultiHostRegistrar registrar, Key<T> key, T value) {
DeprecatedMethodException.report("use #putInjectedFileUserData(com.intellij.psi.PsiElement, com.intellij.lang.Language, com.intellij.openapi.util.Key, java.lang.Object)} instead");
DeprecatedMethodException.report("use putInjectedFileUserData(PsiElement, Language, Key, Object)} instead");
InjectionResult result = ((InjectionRegistrarImpl)registrar).getInjectedResult();
if (result != null && result.files != null) {
List<? extends PsiFile> files = result.files;
@@ -18,7 +18,6 @@ package com.intellij.execution.process;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -31,14 +30,6 @@ public class CapturingAnsiEscapesAwareProcessHandler extends CapturingProcessHan
super(commandLine);
}
/** @deprecated Use {@link #CapturingAnsiEscapesAwareProcessHandler(Process, String)} instead (to be removed in IDEA 17) */
@SuppressWarnings({"unused"})
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2017")
public CapturingAnsiEscapesAwareProcessHandler(Process process) {
super(process);
}
public CapturingAnsiEscapesAwareProcessHandler(@NotNull Process process, @NotNull String commandLine) {
super(process, null, commandLine);
}
@@ -4,6 +4,7 @@ package com.intellij.execution.process;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.util.DeprecatedMethodException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -28,6 +29,7 @@ public class CapturingProcessHandler extends OSProcessHandler {
@ApiStatus.ScheduledForRemoval(inVersion = "2017")
public CapturingProcessHandler(@NotNull Process process) {
this(process, null, "");
DeprecatedMethodException.report("Use CapturingProcessHandler(Process, Charset, String) instead");
}
/**
@@ -1206,8 +1206,8 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent
}
@Override
@Deprecated
public void registerFileType(@NotNull FileType fileType) {
//noinspection deprecation
registerFileType(fileType, ArrayUtilRt.EMPTY_STRING_ARRAY);
}
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.Navigatable;
import com.intellij.usages.Usage;
import com.intellij.usages.UsageView;
import com.intellij.util.DeprecatedMethodException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
@@ -34,6 +35,7 @@ public class UsageNode extends Node implements Comparable<UsageNode>, Navigatabl
// todo remove in 2018.1
public UsageNode(@NotNull Usage usage, UsageViewTreeModelBuilder model) {
this(null, usage);
DeprecatedMethodException.report("Use UsageNode(Node, Usage) instead");
}
public UsageNode(Node parent, @NotNull Usage usage) {
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.Consumer;
import com.intellij.util.DeprecatedMethodException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
@@ -37,6 +38,7 @@ public class ProcessWaitFor {
@Deprecated
public ProcessWaitFor(@NotNull final Process process, @NotNull TaskExecutor executor) {
this(process, executor, "");
DeprecatedMethodException.report("Use ProcessWaitFor(Process, TaskExecutor, String) instead");
}
public ProcessWaitFor(@NotNull final Process process, @NotNull TaskExecutor executor, @NotNull final String presentableName) {
@@ -31,7 +31,7 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
DeprecatedMethodException.report("Use ConcurrentFactoryMap.create() instead");
}
private ConcurrentFactoryMap(@SuppressWarnings("unused") boolean internalConstructor) {
private ConcurrentFactoryMap(@SuppressWarnings("unused") boolean goodConstructorHereHaveABiscuit) {
}
@@ -187,29 +187,6 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
};
}
/**
* @deprecated use {@link #create(Function, Supplier)} instead
*/
@Deprecated
@NotNull
public static <K, V> ConcurrentMap<K, V> createMap(@NotNull Function<? super K, ? extends V> computeValue,
@NotNull Producer<? extends ConcurrentMap<K, V>> mapCreator) {
DeprecatedMethodException.report("Use ConcurrentFactoryMap.create() instead");
return new ConcurrentFactoryMap<K, V>(true) {
@Nullable
@Override
protected V create(K key) {
return computeValue.fun(key);
}
@NotNull
@Override
protected ConcurrentMap<K, V> createMap() {
return mapCreator.produce();
}
};
}
@NotNull
public static <K, V> ConcurrentMap<K, V> create(@NotNull Function<? super K, ? extends V> computeValue,
@NotNull Supplier<? extends ConcurrentMap<K, V>> mapCreator) {
@@ -16,8 +16,6 @@
package com.intellij.util.containers;
import com.intellij.util.DeprecatedMethodException;
import com.intellij.util.Function;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NotNull;
@@ -28,10 +26,8 @@ import java.lang.ref.WeakReference;
* Concurrent weak key:K -> strong value:V map.
* Null keys are allowed
* Null values are NOT allowed
* @deprecated Use {@link ContainerUtil#createConcurrentWeakMap()} instead
*/
@Deprecated
public final class ConcurrentWeakHashMap<K, V> extends ConcurrentRefHashMap<K, V> {
final class ConcurrentWeakHashMap<K, V> extends ConcurrentRefHashMap<K, V> {
private static class WeakKey<K> extends WeakReference<K> implements KeyReference<K> {
private final int myHash; /* Hashcode of key, stored here since the key may be tossed by the GC */
@NotNull private final TObjectHashingStrategy<? super K> myStrategy;
@@ -69,23 +65,6 @@ public final class ConcurrentWeakHashMap<K, V> extends ConcurrentRefHashMap<K, V
return new WeakKey<>(key, hashingStrategy.computeHashCode(key), hashingStrategy, myReferenceQueue);
}
/**
* @deprecated use {@link ConcurrentFactoryMap#createWeakMap(Function)}
*/
@Deprecated
public ConcurrentWeakHashMap(int initialCapacity) {
super(initialCapacity);
DeprecatedMethodException.report("Use com.intellij.util.containers.ConcurrentFactoryMap.createWeakMap instead");
}
/**
* @deprecated use {@link ConcurrentFactoryMap#createWeakMap(Function)}
*/
@Deprecated
public ConcurrentWeakHashMap() {
DeprecatedMethodException.report("Use com.intellij.util.containers.ConcurrentFactoryMap.createWeakMap instead");
}
ConcurrentWeakHashMap(float loadFactor) {
this(DEFAULT_CAPACITY, loadFactor, DEFAULT_CONCURRENCY_LEVEL, ContainerUtil.canonicalStrategy());
}
@@ -2698,7 +2698,6 @@ public class ContainerUtil extends ContainerUtilRt {
@NotNull
@Contract(value = " -> new", pure = true)
public static <K,V> ConcurrentMap<K,V> createConcurrentWeakMap() {
//noinspection deprecation
return new ConcurrentWeakHashMap<>(0.75f);
}
@@ -2717,14 +2716,12 @@ public class ContainerUtil extends ContainerUtilRt {
float loadFactor,
int concurrencyLevel,
@NotNull TObjectHashingStrategy<? super K> hashingStrategy) {
//noinspection deprecation
return new ConcurrentWeakHashMap<>(initialCapacity, loadFactor, concurrencyLevel, hashingStrategy);
}
@NotNull
@Contract(value = "_ -> new", pure = true)
public static <K,V> ConcurrentMap<K,V> createConcurrentWeakMap(@NotNull TObjectHashingStrategy<? super K> hashingStrategy) {
//noinspection deprecation
return new ConcurrentWeakHashMap<>(hashingStrategy);
}
@@ -2994,15 +2991,13 @@ public class ContainerUtil extends ContainerUtilRt {
@Contract(value = " -> new", pure = true)
@NotNull
public static <K,V> Map<K,V> createWeakKeyWeakValueMap() {
//noinspection deprecation
return new WeakKeyWeakValueHashMap<>(true);
return new WeakKeyWeakValueHashMap<>();
}
@Contract(value = " -> new", pure = true)
@NotNull
public static <K,V> Map<K,V> createSoftKeySoftValueMap() {
//noinspection deprecation
return new SoftKeySoftValueHashMap<>(true);
return new SoftKeySoftValueHashMap<>();
}
/**
@@ -17,10 +17,10 @@ package com.intellij.util.containers;
import com.intellij.openapi.util.RecursionGuard;
import com.intellij.openapi.util.RecursionManager;
import com.intellij.util.DeprecatedMethodException;
import com.intellij.util.Function;
import com.intellij.util.ObjectUtils;
import gnu.trove.THashMap;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -41,8 +41,13 @@ public abstract class FactoryMap<K,V> implements Map<K, V> {
*/
@Deprecated
public FactoryMap() {
DeprecatedMethodException.report("Use FactoryMap.create*() instead");
}
private FactoryMap(boolean safe) {
}
@NotNull
protected Map<K, V> createMap() {
return new THashMap<>();
@@ -58,6 +63,7 @@ public abstract class FactoryMap<K,V> implements Map<K, V> {
V value = map.get(k);
if (value == null) {
RecursionGuard.StackStamp stamp = RecursionManager.markStack();
//noinspection unchecked
value = create((K)key);
if (stamp.mayCacheNow()) {
V v = notNull(value);
@@ -82,7 +88,7 @@ public abstract class FactoryMap<K,V> implements Map<K, V> {
private static <T> T notNull(final Object key) {
//noinspection unchecked
return key == null ? FactoryMap.FAKE_NULL() : (T)key;
return key == null ? FAKE_NULL() : (T)key;
}
@Nullable
private static <T> T nullize(T value) {
@@ -169,19 +175,9 @@ public abstract class FactoryMap<K,V> implements Map<K, V> {
entry -> new AbstractMap.SimpleEntry<>(nullize(entry.getKey()), nullize(entry.getValue())));
}
/**
* @deprecated Use {@link #create(Function)} instead. TODO to be removed in IDEA 2018
*/
@ApiStatus.ScheduledForRemoval(inVersion = "2018")
@Deprecated
@NotNull
public static <K, V> FactoryMap<K, V> createMap(@NotNull final Function<? super K, ? extends V> computeValue) {
return (FactoryMap<K, V>)create(computeValue);
}
@NotNull
public static <K, V> Map<K, V> create(@NotNull final Function<? super K, ? extends V> computeValue) {
return new FactoryMap<K, V>() {
return new FactoryMap<K, V>(true) {
@Nullable
@Override
protected V create(K key) {
@@ -192,7 +188,7 @@ public abstract class FactoryMap<K,V> implements Map<K, V> {
@NotNull
public static <K, V> Map<K, V> createMap(@NotNull final Function<? super K, ? extends V> computeValue, @NotNull final Supplier<? extends Map<K, V>> mapCreator) {
return new FactoryMap<K, V>() {
return new FactoryMap<K, V>(true) {
@Nullable
@Override
protected V create(K key) {
@@ -15,24 +15,14 @@
*/
package com.intellij.util.containers;
import com.intellij.util.DeprecatedMethodException;
import org.jetbrains.annotations.NotNull;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.Map;
/**
* @deprecated use {@link ContainerUtil#createWeakKeyWeakValueMap()} instead
*/
@Deprecated
public final class WeakKeyWeakValueHashMap<K,V> extends RefKeyRefValueHashMap<K,V> implements Map<K,V>{
public WeakKeyWeakValueHashMap() {
this(false);
DeprecatedMethodException.report("Use ContainerUtil#createWeakKeyWeakValueMap() instead");
}
WeakKeyWeakValueHashMap(boolean good) {
final class WeakKeyWeakValueHashMap<K,V> extends RefKeyRefValueHashMap<K,V> implements Map<K,V>{
WeakKeyWeakValueHashMap() {
super((RefHashMap<K, ValueReference<K, V>>)ContainerUtil.<K, ValueReference<K, V>>createWeakMap());
}
@@ -18,6 +18,7 @@ package com.intellij.util.io;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.DeprecatedMethodException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
@@ -47,6 +48,7 @@ public abstract class BaseDataReader {
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2017")
protected void start() {
DeprecatedMethodException.report("Use start(String) instead");
start("");
}