From abd1aa789488829916366c95f77e3420cc2d3197 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 25 Mar 2015 19:41:24 +0300 Subject: [PATCH] removed redundant suppressions --- .../intellij/openapi/extensions/Extensions.java | 14 +++++++++----- .../extensions/impl/ExtensionsAreaImpl.java | 6 +----- .../com/intellij/find/impl/FindInProjectTask.java | 1 - .../openapi/actionSystem/DataConstants.java | 4 ++-- .../openapi/actionSystem/ex/DataConstantsEx.java | 4 ++-- .../intellij/openapi/options/ConfigurableEP.java | 3 +-- .../src/com/intellij/openapi/ui/DialogWrapper.java | 2 +- .../openapi/editor/ex/util/EditorUtil.java | 3 +-- .../fixtures/impl/ModuleFixtureImpl.java | 4 +--- .../src/com/intellij/openapi/util/Disposer.java | 3 +-- .../util/src/com/intellij/util/ExceptionUtil.java | 6 ++---- .../containers/LockFreeCopyOnWriteArrayList.java | 3 +-- 12 files changed, 22 insertions(+), 31 deletions(-) diff --git a/platform/extensions/src/com/intellij/openapi/extensions/Extensions.java b/platform/extensions/src/com/intellij/openapi/extensions/Extensions.java index e2de093f8006..b994ffd2e824 100644 --- a/platform/extensions/src/com/intellij/openapi/extensions/Extensions.java +++ b/platform/extensions/src/com/intellij/openapi/extensions/Extensions.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -82,13 +82,12 @@ public class Extensions { } @NotNull - @SuppressWarnings({"unchecked"}) + @SuppressWarnings("unchecked") public static T[] getExtensions(@NotNull ExtensionPointName extensionPointName) { return (T[])getExtensions(extensionPointName.getName(), null); } @NotNull - @SuppressWarnings({"unchecked"}) public static T[] getExtensions(@NotNull ExtensionPointName extensionPointName, AreaInstance areaInstance) { // keep it until 1.7 JDK return Extensions.getExtensions(extensionPointName.getName(), areaInstance); @@ -151,7 +150,7 @@ public class Extensions { // allow duplicate area class registrations if they are the same - fixing duplicate registration in tests is much more trouble AreaClassConfiguration configuration = ourAreaClass2Configuration.get(areaClass); if (!equals(configuration.getParentClassName(), parentAreaClass)) { - throw new RuntimeException("Area class already registered: " + areaClass + ", "+ ourAreaClass2Configuration.get(areaClass)); + throw new RuntimeException("Area class already registered: " + areaClass + ", "+ configuration); } else { return; @@ -190,7 +189,7 @@ public class Extensions { private final String myClassName; private final String myParentClassName; - AreaClassConfiguration(@NotNull String className, String parentClassName) { + private AreaClassConfiguration(@NotNull String className, String parentClassName) { myClassName = className; myParentClassName = parentClassName; } @@ -203,6 +202,11 @@ public class Extensions { public String getParentClassName() { return myParentClassName; } + + @Override + public String toString() { + return "AreaClassConfiguration{myClassName='" + myClassName + '\'' + ", myParentClassName='" + myParentClassName + "'}"; + } } @SuppressWarnings("CallToPrintStackTrace") diff --git a/platform/extensions/src/com/intellij/openapi/extensions/impl/ExtensionsAreaImpl.java b/platform/extensions/src/com/intellij/openapi/extensions/impl/ExtensionsAreaImpl.java index 555ecec10744..5105462d2c13 100644 --- a/platform/extensions/src/com/intellij/openapi/extensions/impl/ExtensionsAreaImpl.java +++ b/platform/extensions/src/com/intellij/openapi/extensions/impl/ExtensionsAreaImpl.java @@ -204,7 +204,6 @@ public class ExtensionsAreaImpl implements ExtensionsArea { getExtensionPoint(EPAvailabilityListenerExtension.EXTENSION_POINT_NAME).addExtensionPointListener(new ExtensionPointListener() { @Override - @SuppressWarnings({"unchecked"}) public void extensionRemoved(@NotNull Object extension, final PluginDescriptor pluginDescriptor) { EPAvailabilityListenerExtension epListenerExtension = (EPAvailabilityListenerExtension) extension; Collection listeners = myAvailabilityListeners.get(epListenerExtension.getExtensionPointName()); @@ -296,7 +295,6 @@ public class ExtensionsAreaImpl implements ExtensionsArea { } } - @SuppressWarnings({"unchecked"}) private void notifyEPRegistered(final ExtensionPoint extensionPoint) { Collection listeners = myAvailabilityListeners.get(extensionPoint.getName()); for (final ExtensionPointAvailabilityListener listener : listeners) { @@ -335,7 +333,6 @@ public class ExtensionsAreaImpl implements ExtensionsArea { @NotNull @Override - @SuppressWarnings({"unchecked"}) public ExtensionPoint getExtensionPoint(@NotNull ExtensionPointName extensionPointName) { return getExtensionPoint(extensionPointName.getName()); } @@ -356,8 +353,7 @@ public class ExtensionsAreaImpl implements ExtensionsArea { } } - @SuppressWarnings({"unchecked"}) - private void notifyEPRemoved(final ExtensionPoint extensionPoint) { + private void notifyEPRemoved(@NotNull ExtensionPoint extensionPoint) { Collection listeners = myAvailabilityListeners.get(extensionPoint.getName()); for (final ExtensionPointAvailabilityListener listener : listeners) { notifyUnavailableListener(extensionPoint, listener); diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java index 50a7862ea454..aa2ef16c769d 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java @@ -106,7 +106,6 @@ class FindInProjectTask { final String filter = findModel.getFileFilter(); final Pattern pattern = FindInProjectUtil.createFileMaskRegExp(filter); - //noinspection unchecked myFileMask = pattern == null ? Conditions.alwaysTrue() : new Condition() { @Override public boolean value(VirtualFile file) { diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java index 2c81a6603c0c..7c8b01316138 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NonNls; * * @deprecated {@link DataKeys} and {@link DataKey#getData} should be used instead */ -@SuppressWarnings({"HardCodedStringLiteral", "JavadocReference", "UnusedDeclaration"}) +@SuppressWarnings({"HardCodedStringLiteral", "JavadocReference"}) public interface DataConstants { /** * Returns {@link com.intellij.openapi.project.Project} diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/DataConstantsEx.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/DataConstantsEx.java index 1719770e674f..3611ec0e4df1 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/DataConstantsEx.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/DataConstantsEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NonNls; * {@link com.intellij.openapi.actionSystem.DataProvider#getData(String)}. * @deprecated {@link DataKeys} and {@link com.intellij.openapi.actionSystem.DataKey#getData} should be used instead */ -@SuppressWarnings({"HardCodedStringLiteral", "JavadocReference", "UnusedDeclaration"}) +@SuppressWarnings({"HardCodedStringLiteral", "JavadocReference"}) public interface DataConstantsEx { /** * Returns {@link com.intellij.psi.PsiElement} diff --git a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java index 5ffddcb95835..2bd1c13f2134 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java +++ b/platform/platform-api/src/com/intellij/openapi/options/ConfigurableEP.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -116,7 +116,6 @@ public class ConfigurableEP extends AbstractExten private PicoContainer myPicoContainer; private Project myProject; - @SuppressWarnings("UnusedDeclaration") public ConfigurableEP() { this(ApplicationManager.getApplication().getPicoContainer(), null); } diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java index 7cbf66c86f9e..43154c47d0c2 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java @@ -75,7 +75,7 @@ import java.util.Set; *

* See also http://confluence.jetbrains.net/display/IDEADEV/IntelliJ+IDEA+DialogWrapper. */ -@SuppressWarnings({"SSBasedInspection", "MethodMayBeStatic", "UnusedDeclaration"}) +@SuppressWarnings({"SSBasedInspection", "MethodMayBeStatic"}) public abstract class DialogWrapper { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.ui.DialogWrapper"); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java index e4da9a4caa54..ebb74fe618fb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -228,7 +228,6 @@ public final class EditorUtil { * long document lines - {@link Editor#logicalPositionToOffset(LogicalPosition)} * should be faster when soft wraps are enabled. To be removed in IDEA 16. */ - @SuppressWarnings("UnusedDeclaration") public static int calcOffset(@NotNull EditorEx editor, @NotNull CharSequence text, int start, diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/ModuleFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/ModuleFixtureImpl.java index 38472829e03a..2bba6b208517 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/ModuleFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/ModuleFixtureImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -42,8 +42,6 @@ public class ModuleFixtureImpl extends BaseFixture implements ModuleFixture { } }.execute().throwException(); - - //disposeOnTearDown(myModule); return myModule; } diff --git a/platform/util/src/com/intellij/openapi/util/Disposer.java b/platform/util/src/com/intellij/openapi/util/Disposer.java index 61d1c28d36b1..0f68d90cb1b3 100644 --- a/platform/util/src/com/intellij/openapi/util/Disposer.java +++ b/platform/util/src/com/intellij/openapi/util/Disposer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -28,7 +28,6 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Map; -@SuppressWarnings({"SSBasedInspection"}) public class Disposer { private static final ObjectTree ourTree; diff --git a/platform/util/src/com/intellij/util/ExceptionUtil.java b/platform/util/src/com/intellij/util/ExceptionUtil.java index cc7b67ea805f..ff0ab77eb30b 100644 --- a/platform/util/src/com/intellij/util/ExceptionUtil.java +++ b/platform/util/src/com/intellij/util/ExceptionUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -62,7 +62,6 @@ public class ExceptionUtil { @NotNull public static String getThrowableText(@NotNull Throwable aThrowable) { StringWriter stringWriter = new StringWriter(); - @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") PrintWriter writer = new PrintWriter(stringWriter); aThrowable.printStackTrace(writer); return stringWriter.getBuffer().toString(); @@ -76,9 +75,8 @@ public class ExceptionUtil { final String skipPattern = prefix + stackFrameSkipPattern; final StringWriter stringWriter = new StringWriter(); - @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") final PrintWriter writer = new PrintWriter(stringWriter) { - boolean skipping = false; + private boolean skipping; @Override public void println(final String x) { boolean curSkipping = skipping; diff --git a/platform/util/src/com/intellij/util/containers/LockFreeCopyOnWriteArrayList.java b/platform/util/src/com/intellij/util/containers/LockFreeCopyOnWriteArrayList.java index cda5872686e8..f82eb495df9e 100644 --- a/platform/util/src/com/intellij/util/containers/LockFreeCopyOnWriteArrayList.java +++ b/platform/util/src/com/intellij/util/containers/LockFreeCopyOnWriteArrayList.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -35,7 +35,6 @@ import java.util.*; * (Note that it is not advisable to use COWAL in high write-contention code anyway, consider using {@link java.util.concurrent.ConcurrentHashMap}) instead) */ class LockFreeCopyOnWriteArrayList implements List, RandomAccess, ConcurrentList { - @SuppressWarnings("FieldMayBeFinal") @NotNull private volatile Object[] array; LockFreeCopyOnWriteArrayList() {