diff --git a/java/java-psi-api/src/com/intellij/psi/PsiClass.java b/java/java-psi-api/src/com/intellij/psi/PsiClass.java index 64dd27190706..a60d56a725cd 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiClass.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiClass.java @@ -195,7 +195,7 @@ public interface PsiClass @NotNull PsiMethod[] getAllMethods(); /** - * Returns the list of inner classes for the class and all its superclasses.. + * Returns the list of inner classes for the class and all its superclasses. * * @return the list of inner classes. */ diff --git a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java index 76567ea0195c..e0394457bd88 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java @@ -114,7 +114,7 @@ public class PsiTestUtil { return vDir; } - public static void removeAllRoots(Module module, Sdk jdk) { + public static void removeAllRoots(@NotNull Module module, Sdk jdk) { ModuleRootModificationUtil.updateModel(module, model -> { model.clear(); model.setSdk(jdk); diff --git a/platform/util/src/com/intellij/util/SmartFMap.java b/platform/util/src/com/intellij/util/SmartFMap.java index a4b95a189bb5..cba92de577d0 100644 --- a/platform/util/src/com/intellij/util/SmartFMap.java +++ b/platform/util/src/com/intellij/util/SmartFMap.java @@ -30,7 +30,7 @@ import java.util.*; public class SmartFMap implements Map { private static final SmartFMap EMPTY = new SmartFMap(ArrayUtil.EMPTY_OBJECT_ARRAY); private static final int ARRAY_THRESHOLD = 8; - private final Object myMap; + private final Object myMap; // Object[] for map sizes up to ARRAY_THRESHOLD or Map private SmartFMap(Object map) { myMap = map; @@ -41,12 +41,12 @@ public class SmartFMap implements Map { } public SmartFMap plus(@NotNull K key, V value) { - return new SmartFMap(doPlus(myMap, key, value, false)); + return new SmartFMap(doPlus(myMap, key, value)); } - private static Object doPlus(Object oldMap, Object key, Object value, boolean inPlace) { + private static Object doPlus(Object oldMap, Object key, Object value) { if (oldMap instanceof Map) { - Map newMap = inPlace ? (Map)oldMap : new THashMap((Map)oldMap); + Map newMap = new THashMap((Map)oldMap); newMap.put(key, value); return newMap; } @@ -54,10 +54,8 @@ public class SmartFMap implements Map { Object[] array = (Object[])oldMap; for (int i = 0; i < array.length; i += 2) { if (key.equals(array[i])) { - Object[] newArray = inPlace ? array : new Object[array.length]; - if (!inPlace) { - System.arraycopy(array, 0, newArray, 0, array.length); - } + Object[] newArray = new Object[array.length]; + System.arraycopy(array, 0, newArray, 0, array.length); newArray[i + 1] = value; return newArray; } diff --git a/platform/util/src/com/intellij/util/messages/impl/MessageBusConnectionImpl.java b/platform/util/src/com/intellij/util/messages/impl/MessageBusConnectionImpl.java index fb80bb7a4124..ec6049868863 100644 --- a/platform/util/src/com/intellij/util/messages/impl/MessageBusConnectionImpl.java +++ b/platform/util/src/com/intellij/util/messages/impl/MessageBusConnectionImpl.java @@ -58,7 +58,6 @@ public class MessageBusConnectionImpl implements MessageBusConnection { } @Override - @SuppressWarnings("unchecked") public void subscribe(@NotNull Topic topic) throws IllegalStateException { if (myDefaultHandler == null) { throw new IllegalStateException("Connection must have default handler installed prior to any anonymous subscriptions. " @@ -69,6 +68,7 @@ public class MessageBusConnectionImpl implements MessageBusConnection { topic.getListenerClass() + "', actual: '" + myDefaultHandler.getClass() + "'"); } + //noinspection unchecked subscribe(topic, (L)myDefaultHandler); } @@ -134,7 +134,7 @@ public class MessageBusConnectionImpl implements MessageBusConnection { } } - void scheduleMessageDelivery(Message message) { + void scheduleMessageDelivery(@NotNull Message message) { myPendingMessages.get().offer(message); } @@ -142,6 +142,7 @@ public class MessageBusConnectionImpl implements MessageBusConnection { return mySubscriptions.toString(); } + @NotNull MessageBusImpl getBus() { return myBus; } diff --git a/platform/util/src/com/intellij/util/messages/impl/MessageBusImpl.java b/platform/util/src/com/intellij/util/messages/impl/MessageBusImpl.java index 17f3465a6542..131a8cbea7f7 100644 --- a/platform/util/src/com/intellij/util/messages/impl/MessageBusImpl.java +++ b/platform/util/src/com/intellij/util/messages/impl/MessageBusImpl.java @@ -383,7 +383,7 @@ public class MessageBusImpl implements MessageBus { while (true); } - void notifyOnSubscription(@NotNull MessageBusConnectionImpl connection, @NotNull Topic topic) { + void notifyOnSubscription(@NotNull MessageBusConnectionImpl connection, @NotNull Topic topic) { checkNotDisposed(); List topicSubscribers = mySubscribers.get(topic); if (topicSubscribers == null) {