From 19b12745bdfb1a1348886efa8edf51f1ae5b00a7 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Sun, 20 Dec 2020 17:34:55 +0100 Subject: [PATCH] remove deprecated members, more deprecation warnings GitOrigin-RevId: fcdfbb8e2daa5369cbe39613bc92f725a4f8559d --- .../openapi/application/WriteAction.java | 13 +- .../openapi/command/WriteCommandAction.java | 21 +-- .../src/com/intellij/openapi/vcs/Foo.java | 15 ++ .../application/impl/ApplicationImpl.java | 4 + .../application/impl/ApplicationImplTest.java | 160 +++++++---------- .../com/intellij/util/ReflectionCache.java | 10 +- .../util/StringBuilderSpinAllocator.java | 10 ++ .../util/containers/EmptyIterable.java | 40 ----- .../util/containers/LinkedMultiMap.java | 3 + .../util/containers/LongArrayList.java | 169 ------------------ .../util/containers/WeakStringInterner.java | 5 + .../util/containers/hash/HashMap.java | 2 + .../util/containers/hash/HashSet.java | 2 + 13 files changed, 108 insertions(+), 346 deletions(-) create mode 100644 platform/platform-api/src/com/intellij/openapi/vcs/Foo.java delete mode 100644 platform/util/src/com/intellij/util/containers/EmptyIterable.java delete mode 100644 platform/util/src/com/intellij/util/containers/LongArrayList.java diff --git a/platform/core-api/src/com/intellij/openapi/application/WriteAction.java b/platform/core-api/src/com/intellij/openapi/application/WriteAction.java index 428518713e65..57c318d749c8 100644 --- a/platform/core-api/src/com/intellij/openapi/application/WriteAction.java +++ b/platform/core-api/src/com/intellij/openapi/application/WriteAction.java @@ -97,13 +97,10 @@ public abstract class WriteAction extends BaseActionRunnable { * Must be called from the EDT. */ public static void run(@NotNull ThrowableRunnable action) throws E { - @SuppressWarnings("deprecation") AccessToken token = start(action.getClass()); - try { + ApplicationManager.getApplication().runWriteAction((ThrowableComputable)() -> { action.run(); - } - finally { - token.finish(); - } + return null; + }); } /** @@ -171,8 +168,8 @@ public abstract class WriteAction extends BaseActionRunnable { if (t != null) { t.addSuppressed(new RuntimeException()); // preserve the calling thread stacktrace ExceptionUtil.rethrowUnchecked(t); - @SuppressWarnings("unchecked") E e = (E)t; - throw e; + //noinspection unchecked + throw (E)t; } return result.get(); diff --git a/platform/core-api/src/com/intellij/openapi/command/WriteCommandAction.java b/platform/core-api/src/com/intellij/openapi/command/WriteCommandAction.java index 83242fb91047..569418231ba5 100644 --- a/platform/core-api/src/com/intellij/openapi/command/WriteCommandAction.java +++ b/platform/core-api/src/com/intellij/openapi/command/WriteCommandAction.java @@ -285,26 +285,7 @@ public abstract class WriteCommandAction extends BaseActionRunnable { return true; } - /** - * @deprecated Use {@link CommandProcessor#executeCommand(Project, Runnable, String, Object)} instead - */ - @Deprecated - public void performCommand() throws Throwable { - //this is needed to prevent memory leak, since command - // is put into undo queue - final RunResult[] results = {new RunResult<>(this)}; - final Ref exception = new Ref<>(); - - doExecuteCommand(() -> { - exception.set(results[0].run().getThrowable()); - results[0] = null; - }); - - Throwable throwable = exception.get(); - if (throwable != null) throw throwable; - } - - private void doExecuteCommand(final Runnable runnable) { + private void doExecuteCommand(@NotNull Runnable runnable) { Runnable wrappedRunnable = () -> { if (isGlobalUndoAction()) CommandProcessor.getInstance().markCurrentCommandAsGlobal(getProject()); runnable.run(); diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/Foo.java b/platform/platform-api/src/com/intellij/openapi/vcs/Foo.java new file mode 100644 index 000000000000..f37f95c86ed9 --- /dev/null +++ b/platform/platform-api/src/com/intellij/openapi/vcs/Foo.java @@ -0,0 +1,15 @@ +// 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.vcs; + +public class Foo { + void f() { + //java.util.function.Function f = s -> new IntArrayList(); + } + IntList crea() { + return new IntArrayList(); + } + public static void main(String[] args) { } +} +class IntList { } +abstract class AbsList extends IntList {} +class IntArrayList extends AbsList { } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index 70233b1a1aac..4dabb10fa7d3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -1140,6 +1140,8 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application @Override public @NotNull AccessToken acquireReadActionLock() { + DeprecatedMethodException.report("Use runReadAction() instead"); + // if we are inside read action, do not try to acquire read lock again since it will deadlock if there is a pending writeAction return checkReadAccessAllowedAndNoPendingWrites() ? AccessToken.EMPTY_ACCESS_TOKEN : new ReadAccessToken(); } @@ -1218,6 +1220,8 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application @Override public @NotNull AccessToken acquireWriteActionLock(@NotNull Class clazz) { + DeprecatedMethodException.report("Use runWriteAction() instead"); + return new WriteAccessToken(clazz); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java index 82f5e2439f66..03d911f24f2f 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/application/impl/ApplicationImplTest.java @@ -16,9 +16,7 @@ import com.intellij.openapi.progress.impl.ProgressManagerImpl; import com.intellij.openapi.progress.util.ProgressIndicatorBase; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.EmptyRunnable; -import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.ThrowableComputable; -import com.intellij.testFramework.CpuUsageData; import com.intellij.testFramework.LightPlatformTestCase; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.RunFirst; @@ -33,9 +31,13 @@ import org.junit.Assert; import javax.swing.*; import java.lang.reflect.Field; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; import static com.intellij.util.TestTimeOut.setTimeout; import static org.hamcrest.CoreMatchers.containsString; @@ -60,60 +62,6 @@ public class ApplicationImplTest extends LightPlatformTestCase { } private volatile Throwable exception; - public void testAcquireReadActionLockVsRunReadActionPerformance() throws Throwable { - final int N = 100_000_000; - final Application application = ApplicationManager.getApplication(); - String err = null; - - for (int i=0; i<4; i++) { - Callable runnable = () -> { - try { - assertFalse(application.isReadAccessAllowed()); - CpuUsageData dataAcq = CpuUsageData.measureCpuUsage(() -> { - for (int i1 = 0; i1 < N; i1++) { - AccessToken token = application.acquireReadActionLock(); - //noinspection EmptyTryBlock - try { - // do it - } - finally { - token.finish(); - } - } - }); - CpuUsageData dataRun = CpuUsageData.measureCpuUsage(() -> { - for (int i1 = 0; i1 < N; i1++) { - application.runReadAction(() -> { - }); - } - }); - long l1 = dataRun.durationMs; - long l2 = dataAcq.durationMs; - - assertFalse(application.isReadAccessAllowed()); - int ratioPercent = (int)((l1 - l2) * 100.0 / l1); - String msg = "acquireReadActionLock(" + l2 + "ms) vs runReadAction(" + l1 + "ms). Ratio: " + ratioPercent + "% (in "+(ratioPercent<0 ? "my" : "Maxim's") +" favor)"; - LOG.debug(msg + "\nAcquire:\n" + dataAcq.getSummary(" ") + "\nRun:\n" + dataRun.getSummary(" ")); - if (Math.abs(ratioPercent) > 40) { - return "Suspiciously different times for " + msg; - } - } - catch (Throwable e) { - exception = e; - } - return null; - }; - - err = application.executeOnPooledThread(runnable).get(); - if (err == null) break; - System.err.println("Still trying, attempt "+i+": "+err); - System.gc(); - } - - assertNull(err); - if (exception != null) throw exception; - } - public void testRead50Write50LockPerformance() { runReadWrites(600_000, 600_000, 2000); @@ -199,9 +147,9 @@ public class ApplicationImplTest extends LightPlatformTestCase { assertFalse(application.isWriteAccessAllowed()); assertFalse(application.isWriteActionPending()); - // take read lock1. + // take read lock1 in separate thread. // try to take write lock - must wait (because of taken read lock) - // try to take read lock2 - must wait (because of write preference - write lock is pending) + // try to take read lock2 in separate thread - must wait (because of write preference - write lock is pending) // release read lock1 - write lock must be taken first // release write - read lock2 must be taken LOG.debug("-----"); @@ -216,15 +164,22 @@ public class ApplicationImplTest extends LightPlatformTestCase { Future readAction1 = ApplicationManager.getApplication().executeOnPooledThread(() -> { try { assertFalse(application.isDispatchThread()); - AccessToken stamp = application.acquireReadActionLock(); try { - LOG.debug("read lock1 acquired"); - read1Acquired.set(true); - while (holdRead1.get()) checkTimeout(); + application.runReadAction(() -> { + read1Acquired.set(true); + LOG.debug("read lock1 acquired"); + while (holdRead1.get()) { + try { + checkTimeout(); + } + catch (Throwable throwable) { + throw new RuntimeException(throwable); + } + } + }); } finally { read1Released.set(true); - stamp.finish(); LOG.debug("read lock1 released"); } } @@ -236,8 +191,8 @@ public class ApplicationImplTest extends LightPlatformTestCase { while (!read1Acquired.get()) checkTimeout(); AtomicBoolean aboutToAcquireWrite = new AtomicBoolean(); - // readActions2 should try to acquire read action when write action is pending - Future readActions2 = ApplicationManager.getApplication().executeOnPooledThread(() -> { + // readAction2 should try to acquire read action when write action is pending + Future readAction2 = ApplicationManager.getApplication().executeOnPooledThread(() -> { try { assertFalse(application.isDispatchThread()); while (!aboutToAcquireWrite.get()) checkTimeout(); @@ -245,17 +200,17 @@ public class ApplicationImplTest extends LightPlatformTestCase { while (!application.myLock.writeRequested) checkTimeout(); assertTrue(application.isWriteActionPending()); //assertFalse(application.tryRunReadAction(EmptyRunnable.getInstance())); - AccessToken stamp = application.acquireReadActionLock(); - assertFalse(application.isWriteActionPending()); try { - LOG.debug("read lock2 acquired"); - read2Acquired.set(true); + application.runReadAction(() -> { + read2Acquired.set(true); + assertFalse(application.isWriteActionPending()); + LOG.debug("read lock2 acquired"); + }); } finally { read2Released.set(true); - stamp.finish(); - LOG.debug("read lock2 released"); } + LOG.debug("read lock2 released"); } catch (Throwable e) { exception = e; @@ -335,25 +290,30 @@ public class ApplicationImplTest extends LightPlatformTestCase { }); aboutToAcquireWrite.set(true); - AccessToken stamp = application.acquireWriteActionLock(getClass()); try { - LOG.debug("write lock acquired"); - writeAcquired.set(true); + application.runWriteAction(() -> { + writeAcquired.set(true); + LOG.debug("write lock acquired"); - while (holdWrite.get()) { - checkTimeout(); - assertTrue(application.isWriteActionInProgress()); - assertTrue(application.isWriteAccessAllowed()); - assertFalse(application.isWriteActionPending()); - } + while (holdWrite.get()) { + try { + checkTimeout(); + } + catch (Throwable throwable) { + throw new RuntimeException(throwable); + } + assertTrue(application.isWriteActionInProgress()); + assertTrue(application.isWriteAccessAllowed()); + assertFalse(application.isWriteActionPending()); + } + }); } finally { writeReleased.set(true); - stamp.finish(); LOG.debug("write lock released"); } - joinWithTimeout(readAction1, readActions2, checkThread); + joinWithTimeout(readAction1, readAction2, checkThread); if (exception != null) throw exception; } @@ -572,20 +532,6 @@ public class ApplicationImplTest extends LightPlatformTestCase { }); } - private static void safeWrite(ThrowableRunnable r) throws Throwable { - Ref e = new Ref<>(); - ApplicationManager.getApplication().invokeLater(() -> { - try { - WriteAction.run(r); - } - catch (Throwable e1) { - e.set(e1); - } - }); - UIUtil.dispatchAllInvocationEvents(); - if (e.get() != null) throw e.get(); - } - private static void waitForFuture(Future future) { try { future.get(10_000, TimeUnit.MILLISECONDS); @@ -597,21 +543,35 @@ public class ApplicationImplTest extends LightPlatformTestCase { public void testHasWriteActionWorksInOtherThreads() throws Throwable { ApplicationImpl app = (ApplicationImpl)ApplicationManager.getApplication(); - ThrowableRunnable runnable = new ThrowableRunnable<>() { + ThrowableComputable runnable = new ThrowableComputable<>() { @Override - public void run() throws RuntimeException { - Class> actionClass = getClass(); + public Void compute() throws RuntimeException { + Class actionClass = getClass(); assertTrue(app.hasWriteAction(actionClass)); app.executeSuspendingWriteAction(getProject(), "", () -> ReadAction.run(() -> { assertTrue(app.hasWriteAction(actionClass)); waitForFuture(app.executeOnPooledThread(() -> ReadAction.run(() -> assertTrue(app.hasWriteAction(actionClass))))); })); + return null; } }; assertFalse(app.hasWriteAction(runnable.getClass())); safeWrite(runnable); } + private static void safeWrite(ThrowableComputable r) throws Throwable { + AtomicReference e = new AtomicReference<>(); + ApplicationManager.getApplication().invokeLater(() -> { + try { + WriteAction.compute(r); + } + catch (Throwable e1) { + e.set(e1); + } + }); + UIUtil.dispatchAllInvocationEvents(); + if (e.get() != null) throw e.get(); + } public void testReadActionInImpatientModeShouldThrowWhenThereIsAPendingWrite() throws Throwable { AtomicBoolean stopRead = new AtomicBoolean(); diff --git a/platform/util/src/com/intellij/util/ReflectionCache.java b/platform/util/src/com/intellij/util/ReflectionCache.java index 7b0243374417..884d48cce38c 100644 --- a/platform/util/src/com/intellij/util/ReflectionCache.java +++ b/platform/util/src/com/intellij/util/ReflectionCache.java @@ -11,20 +11,12 @@ import org.jetbrains.annotations.NotNull; */ @Deprecated public final class ReflectionCache { - /** * @deprecated doesn't cache */ @Deprecated public static boolean isAssignable(@NotNull Class ancestor, Class descendant) { + DeprecatedMethodException.report("Use 'ancestor.isAssignableFrom(descendant)' instead"); return ancestor == descendant || ancestor.isAssignableFrom(descendant); } - - /** - * @deprecated doesn't cache - */ - @Deprecated - public static boolean isInstance(Object instance, @NotNull Class clazz) { - return clazz.isInstance(instance); - } } diff --git a/platform/util/src/com/intellij/util/StringBuilderSpinAllocator.java b/platform/util/src/com/intellij/util/StringBuilderSpinAllocator.java index 5ca00fd3210d..d99219c78c0f 100644 --- a/platform/util/src/com/intellij/util/StringBuilderSpinAllocator.java +++ b/platform/util/src/com/intellij/util/StringBuilderSpinAllocator.java @@ -11,10 +11,20 @@ public final class StringBuilderSpinAllocator { private StringBuilderSpinAllocator() { } + /** + * @deprecated Use {@link StringBuilder} + */ + @Deprecated public static StringBuilder alloc() { + DeprecatedMethodException.report("Use 'new StringBuilder()' instead"); return new StringBuilder(); } + /** + * @deprecated Use nothing instead, stop worrying, let GC do its job and start living + */ + @Deprecated public static void dispose(StringBuilder instance) { + DeprecatedMethodException.report("Do not use"); } } diff --git a/platform/util/src/com/intellij/util/containers/EmptyIterable.java b/platform/util/src/com/intellij/util/containers/EmptyIterable.java deleted file mode 100644 index 43818de2df19..000000000000 --- a/platform/util/src/com/intellij/util/containers/EmptyIterable.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - */ -package com.intellij.util.containers; - -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.Iterator; - -/** - * @deprecated Use {@link Collections#emptyList()} instead - */ -@Deprecated -public class EmptyIterable implements Iterable { - private static final EmptyIterable INSTANCE = new EmptyIterable(); - - public static EmptyIterable getInstance() { - //noinspection unchecked - return INSTANCE; - } - - @NotNull - @Override - public Iterator iterator() { - return Collections.emptyIterator(); - } -} \ No newline at end of file diff --git a/platform/util/src/com/intellij/util/containers/LinkedMultiMap.java b/platform/util/src/com/intellij/util/containers/LinkedMultiMap.java index 89c4841a2541..593b495e4b7c 100644 --- a/platform/util/src/com/intellij/util/containers/LinkedMultiMap.java +++ b/platform/util/src/com/intellij/util/containers/LinkedMultiMap.java @@ -1,6 +1,8 @@ // 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.util.containers; +import com.intellij.util.DeprecatedMethodException; + /** * @deprecated Use {@link MultiMap#createLinked()} */ @@ -8,5 +10,6 @@ package com.intellij.util.containers; public class LinkedMultiMap extends MultiMap { public LinkedMultiMap() { super(CollectionFactory.createSmallMemoryFootprintLinkedMap()); + DeprecatedMethodException.report("Use MultiMap.createLinked() instead"); } } diff --git a/platform/util/src/com/intellij/util/containers/LongArrayList.java b/platform/util/src/com/intellij/util/containers/LongArrayList.java deleted file mode 100644 index 256edca6645a..000000000000 --- a/platform/util/src/com/intellij/util/containers/LongArrayList.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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. - */ -package com.intellij.util.containers; - -import com.intellij.util.DeprecatedMethodException; - -import java.util.Arrays; - -/** - * @deprecated use TLongArrayList instead - */ -@Deprecated -public class LongArrayList implements Cloneable { - private long[] myData; - private int mySize; - - /** - * @deprecated use TLongArrayList instead - */ - @Deprecated - public LongArrayList() { - myData = new long[10]; - DeprecatedMethodException.report("Use gnu.trove.TLongArrayList instead"); - } - - public void trimToSize() { - int oldCapacity = myData.length; - if (mySize < oldCapacity){ - myData = Arrays.copyOf(myData, mySize); - } - } - - public void ensureCapacity(int minCapacity) { - int oldCapacity = myData.length; - if (minCapacity > oldCapacity){ - long[] oldData = myData; - int newCapacity = (oldCapacity * 3) / 2 + 1; - if (newCapacity < minCapacity){ - newCapacity = minCapacity; - } - myData = Arrays.copyOf(myData, newCapacity); - } - } - - public int size() { - return mySize; - } - - public boolean isEmpty() { - return mySize == 0; - } - - public boolean contains(long elem) { - return indexOf(elem) >= 0; - } - - public int indexOf(long elem) { - for(int i = 0; i < mySize; i++){ - if (elem == myData[i]) return i; - } - return -1; - } - - public int lastIndexOf(long elem) { - for(int i = mySize - 1; i >= 0; i--){ - if (elem == myData[i]) return i; - } - return -1; - } - - @Override - public Object clone() { - try{ - LongArrayList v = (LongArrayList)super.clone(); - v.myData = myData.clone(); - return v; - } - catch(CloneNotSupportedException e){ - // this shouldn't happen, since we are Cloneable - throw new InternalError(); - } - } - - public long[] toArray() { - return Arrays.copyOf(myData, mySize); - } - - public long[] toArray(long[] a) { - if (a.length < mySize){ - a = new long[mySize]; - } - - System.arraycopy(myData, 0, a, 0, mySize); - - return a; - } - - public long get(int index) { - checkRange(index); - return myData[index]; - } - - public long set(int index, long element) { - checkRange(index); - - long oldValue = myData[index]; - myData[index] = element; - return oldValue; - } - - public void add(long o) { - ensureCapacity(mySize + 1); - myData[mySize++] = o; - } - - public void add(int index, long element) { - if (index > mySize || index < 0){ - throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + mySize); - } - - ensureCapacity(mySize + 1); - System.arraycopy(myData, index, myData, index + 1, mySize - index); - myData[index] = element; - mySize++; - } - - public long remove(int index) { - checkRange(index); - - long oldValue = myData[index]; - - int numMoved = mySize - index - 1; - if (numMoved > 0){ - System.arraycopy(myData, index + 1, myData, index,numMoved); - } - mySize--; - - return oldValue; - } - - public void clear() { - mySize = 0; - } - - protected void removeRange(int fromIndex, int toIndex) { - int numMoved = mySize - toIndex; - System.arraycopy(myData, toIndex, myData, fromIndex, numMoved); - mySize -= (toIndex - fromIndex); - } - - private void checkRange(int index) { - if (index >= mySize || index < 0){ - throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + mySize); - } - } -} diff --git a/platform/util/src/com/intellij/util/containers/WeakStringInterner.java b/platform/util/src/com/intellij/util/containers/WeakStringInterner.java index 08ddf99eb99b..f5885147bc74 100644 --- a/platform/util/src/com/intellij/util/containers/WeakStringInterner.java +++ b/platform/util/src/com/intellij/util/containers/WeakStringInterner.java @@ -1,6 +1,8 @@ // 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.util.containers; +import com.intellij.util.DeprecatedMethodException; + /** * Allow to reuse equal strings to avoid memory being wasted on them. Strings are cached on weak references * and garbage-collected when not needed anymore. @@ -11,4 +13,7 @@ package com.intellij.util.containers; */ @Deprecated public class WeakStringInterner extends WeakInterner { + public WeakStringInterner() { + DeprecatedMethodException.report("Use Interner#createWeakInterner() instead"); + } } diff --git a/platform/util/src/com/intellij/util/containers/hash/HashMap.java b/platform/util/src/com/intellij/util/containers/hash/HashMap.java index 99e6c297f0f4..71cc62bcb90c 100644 --- a/platform/util/src/com/intellij/util/containers/hash/HashMap.java +++ b/platform/util/src/com/intellij/util/containers/hash/HashMap.java @@ -15,6 +15,7 @@ */ package com.intellij.util.containers.hash; +import com.intellij.util.DeprecatedMethodException; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -42,6 +43,7 @@ public class HashMap extends AbstractMap implements Map { public HashMap(int capacity, float loadFactor) { this.loadFactor = loadFactor; clear(capacity); + DeprecatedMethodException.report("Use java.util.HashMap instead"); } @Override diff --git a/platform/util/src/com/intellij/util/containers/hash/HashSet.java b/platform/util/src/com/intellij/util/containers/hash/HashSet.java index 60cbffa48ea0..82fb0b0ad09e 100644 --- a/platform/util/src/com/intellij/util/containers/hash/HashSet.java +++ b/platform/util/src/com/intellij/util/containers/hash/HashSet.java @@ -15,6 +15,7 @@ */ package com.intellij.util.containers.hash; +import com.intellij.util.DeprecatedMethodException; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -44,6 +45,7 @@ public class HashSet extends AbstractSet implements Set { public HashSet(int capacity, float loadFactor) { this.loadFactor = loadFactor; clear(capacity); + DeprecatedMethodException.report("Use java.util.HashSet instead"); } @Override