From 9edcbfe944df4e61388020dec69c6a1b7101469f Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 13 Feb 2014 13:07:43 +0400 Subject: [PATCH] reverted SafeVarargs because of Oracle license restrictions --- .../chainsSearch/MethodChainsSearchUtil.java | 1 - .../chainsSearch/MethodsChain.java | 1 - .../context/ChainCompletionContext.java | 1 - .../compiler/util/InspectionValidator.java | 1 - .../impl/quickfix/CreateFromUsageUtils.java | 1 - .../searches/AnnotatedElementsSearch.java | 10 ++----- .../intellij/patterns/PsiJavaPatterns.java | 3 +- .../patterns/PsiMethodCallPattern.java | 3 +- .../AbstractLayoutCodeProcessorTest.java | 9 ++---- .../testSrc/com/intellij/index/IndexTest.java | 1 - .../com/intellij/patterns/ObjectPattern.java | 1 - .../intellij/patterns/TreeElementPattern.java | 6 ++-- .../com/intellij/psi/util/PsiTreeUtil.java | 14 +-------- .../src/com/intellij/util/ArrayQuery.java | 1 - .../com/intellij/util/InstanceofQuery.java | 1 - .../impl/id/PlatformIdTableBuilding.java | 1 - .../frameworks/actions/AbstractAction.java | 3 +- .../parameterInfo/ParameterInfoUtils.java | 1 - .../src/com/intellij/semantic/SemKey.java | 5 +--- .../impl/CompletionServiceImpl.java | 2 -- .../highlighting/ChooseOneOrAllRunnable.java | 1 - .../com/intellij/execution/RunManagerEx.java | 2 -- .../lang/SmartEnterProcessorWithFixers.java | 3 +- .../com/intellij/ui/CollectionListModel.java | 1 - .../diff/impl/util/SyncScrollSupport.java | 3 +- .../history/core/LocalHistoryTestCase.java | 2 -- .../intellij/util/graph/ChunkGraphTest.java | 1 - .../testFramework/UsefulTestCase.java | 19 ++---------- .../fixtures/CodeInsightTestFixture.java | 1 - .../impl/CodeInsightTestFixtureImpl.java | 3 +- .../com/intellij/openapi/util/Conditions.java | 4 +-- .../util/containers/ContainerUtilRt.java | 6 ---- .../com/intellij/util/containers/Stack.java | 4 +-- .../util-rt/src/java/lang/SafeVarargs.java | 30 ------------------- .../intellij/openapi/util/MultiValuesMap.java | 4 +-- .../src/com/intellij/util/ArrayConsumer.java | 1 - .../util/containers/ContainerUtil.java | 30 ++----------------- .../util/containers/OpenTHashSet.java | 4 +-- .../util/containers/SequenceIterator.java | 1 - .../intellij/openapi/vcs/ConcurrentTasks.java | 8 ++--- .../src/com/siyeh/ig/BaseInspection.java | 2 -- .../ig/migration/IfCanBeSwitchInspection.java | 1 - .../ReplaceIfWithSwitchIntention.java | 1 - .../psi/patterns/GroovyMethodCallPattern.java | 3 +- .../groovy/lang/resolve/ResolveUtil.java | 1 - .../jetbrains/idea/maven/MavenTestCase.java | 5 ---- .../tasks/generic/GenericRepositoryUtil.java | 1 - .../python/editor/PythonEnterHandler.java | 3 -- .../packaging/PyPackageManagerImpl.java | 1 - .../src/com/jetbrains/python/psi/PyUtil.java | 1 - .../jetbrains/python/PyRequirementTest.java | 1 - .../refactoring/PyCodeFragmentTest.java | 3 +- .../NavigationGutterIconBuilder.java | 3 +- .../intellij/util/xml/ModelMergerImpl.java | 6 ++-- .../com/intellij/util/xml/ModelMerger.java | 1 - .../intellij/util/xml/ModelMergerUtil.java | 1 - .../BasicDomElementsInspection.java | 1 - .../highlighting/DomElementsInspection.java | 1 - 58 files changed, 33 insertions(+), 197 deletions(-) delete mode 100644 platform/util-rt/src/java/lang/SafeVarargs.java diff --git a/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/MethodChainsSearchUtil.java b/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/MethodChainsSearchUtil.java index 0ff5ab710ef5..08dbe04040ef 100644 --- a/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/MethodChainsSearchUtil.java +++ b/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/MethodChainsSearchUtil.java @@ -83,7 +83,6 @@ public final class MethodChainsSearchUtil { return false; } - @SafeVarargs public static HashSet unionToHashSet(final Collection collection, final T... items) { final HashSet result = new HashSet(); result.addAll(collection); diff --git a/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/MethodsChain.java b/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/MethodsChain.java index ab0ea0e452cf..7d46c07759ef 100644 --- a/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/MethodsChain.java +++ b/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/MethodsChain.java @@ -156,7 +156,6 @@ public class MethodsChain { return false; } - @SafeVarargs private static Set joinSets(final Set... sets) { final Set result = new HashSet(); for (final Set set : sets) { diff --git a/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/context/ChainCompletionContext.java b/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/context/ChainCompletionContext.java index b74e2044712b..ea49f3c2cee8 100644 --- a/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/context/ChainCompletionContext.java +++ b/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/context/ChainCompletionContext.java @@ -178,7 +178,6 @@ public class ChainCompletionContext { return myNotDeprecatedMethodsResolver.get(methodIncompleteSignature); } - @SafeVarargs private static HashSet unionToHashSet(final Collection... collections) { final HashSet res = new HashSet(); for (final Collection set : collections) { diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/util/InspectionValidator.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/util/InspectionValidator.java index d91f5ceb96ae..6fefedb893a8 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/util/InspectionValidator.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/util/InspectionValidator.java @@ -43,7 +43,6 @@ public abstract class InspectionValidator { private final String myProgressIndicatorText; private final Class[] myInspectionToolClasses; - @SafeVarargs protected InspectionValidator(@NotNull final String description, @NotNull final String progressIndicatorText, final Class... inspectionToolClasses) { myDescription = description; myProgressIndicatorText = progressIndicatorText; diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java index 26337635fe5f..1df89f72520b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java @@ -482,7 +482,6 @@ public class CreateFromUsageUtils { }); } - @SafeVarargs public static PsiReferenceExpression[] collectExpressions(final PsiExpression expression, Class... scopes) { PsiElement parent = PsiTreeUtil.getParentOfType(expression, scopes); diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedElementsSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedElementsSearch.java index 92f3a104f92c..79445e685284 100644 --- a/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedElementsSearch.java +++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedElementsSearch.java @@ -32,8 +32,7 @@ public class AnnotatedElementsSearch extends ExtensibleQueryFactory[] myTypes; - @SafeVarargs - public Parameters(final PsiClass annotationClass, final SearchScope scope, @NotNull Class... types) { + public Parameters(final PsiClass annotationClass, final SearchScope scope, Class... types) { myAnnotationClass = annotationClass; myScope = scope; myTypes = types; @@ -47,19 +46,16 @@ public class AnnotatedElementsSearch extends ExtensibleQueryFactory[] getTypes() { return myTypes; } } - @SafeVarargs - private static Query createDelegateQuery(PsiClass annotationClass, SearchScope scope, @NotNull Class... types) { + private static Query createDelegateQuery(PsiClass annotationClass, SearchScope scope, Class... types) { return INSTANCE.createQuery(new Parameters(annotationClass, scope, types)); } - @SafeVarargs - public static Query searchElements(@NotNull PsiClass annotationClass, @NotNull SearchScope scope, @NotNull Class... types) { + public static Query searchElements(@NotNull PsiClass annotationClass, @NotNull SearchScope scope, Class... types) { return new InstanceofQuery(createDelegateQuery(annotationClass, scope, types), types); } diff --git a/java/java-psi-api/src/com/intellij/patterns/PsiJavaPatterns.java b/java/java-psi-api/src/com/intellij/patterns/PsiJavaPatterns.java index 7d0bde2a997f..93676f373d31 100644 --- a/java/java-psi-api/src/com/intellij/patterns/PsiJavaPatterns.java +++ b/java/java-psi-api/src/com/intellij/patterns/PsiJavaPatterns.java @@ -49,8 +49,7 @@ public class PsiJavaPatterns extends StandardPatterns{ return new PsiJavaElementPattern.Capture(aClass); } - @SafeVarargs - public static PsiJavaElementPattern.Capture psiElement(@NotNull final Class... classAlternatives) { + public static PsiJavaElementPattern.Capture psiElement(final Class... classAlternatives) { return new PsiJavaElementPattern.Capture(new InitialPatternCondition(PsiElement.class) { @Override public boolean accepts(@Nullable Object o, ProcessingContext context) { diff --git a/java/java-psi-api/src/com/intellij/patterns/PsiMethodCallPattern.java b/java/java-psi-api/src/com/intellij/patterns/PsiMethodCallPattern.java index 09d0f3d544bb..09bb9c7f1587 100644 --- a/java/java-psi-api/src/com/intellij/patterns/PsiMethodCallPattern.java +++ b/java/java-psi-api/src/com/intellij/patterns/PsiMethodCallPattern.java @@ -28,8 +28,7 @@ public class PsiMethodCallPattern extends PsiExpressionPattern... arguments) { + public PsiMethodCallPattern withArguments(final ElementPattern... arguments) { return with(new PatternCondition("withArguments") { @Override public boolean accepts(@NotNull PsiMethodCallExpression callExpression, ProcessingContext context) { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java index 2e0198eb3b58..f6327b780569 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java @@ -159,8 +159,7 @@ public abstract class AbstractLayoutCodeProcessorTest extends PsiTestCase { EditorFactory.getInstance().releaseEditor(editor); } - @SafeVarargs - protected final void checkFormationAndImportsOptimizationFor(@NotNull List... fileCollection) { + protected void checkFormationAndImportsOptimizationFor(@NotNull List... fileCollection) { for (List files : fileCollection) { for (PsiFile file : files) { String className = getClassNameFromJavaFile(file); @@ -169,8 +168,7 @@ public abstract class AbstractLayoutCodeProcessorTest extends PsiTestCase { } } - @SafeVarargs - protected final void checkNoProcessingWasPerformedOn(@NotNull List... fileCollections) { + protected void checkNoProcessingWasPerformedOn(@NotNull List... fileCollections) { for (List files : fileCollections) { for (PsiFile file : files) { String className = getClassNameFromJavaFile(file); @@ -179,8 +177,7 @@ public abstract class AbstractLayoutCodeProcessorTest extends PsiTestCase { } } - @SafeVarargs - protected final void checkRearrangeReformatAndOptimizeImportsHappend(@NotNull List... fileCollections) { + protected void checkRearrangeReformatAndOptimizeImportsHappend(@NotNull List... fileCollections) { for (List files : fileCollections) { for (PsiFile file : files) { String className = getClassNameFromJavaFile(file); diff --git a/java/java-tests/testSrc/com/intellij/index/IndexTest.java b/java/java-tests/testSrc/com/intellij/index/IndexTest.java index 18009df82413..562ff74df869 100644 --- a/java/java-tests/testSrc/com/intellij/index/IndexTest.java +++ b/java/java-tests/testSrc/com/intellij/index/IndexTest.java @@ -191,7 +191,6 @@ public class IndexTest extends IdeaTestCase { } */ - @SafeVarargs private static void assertDataEquals(List actual, T... expected) { assertTrue(new HashSet(Arrays.asList(expected)).equals(new HashSet(actual))); } diff --git a/platform/core-api/src/com/intellij/patterns/ObjectPattern.java b/platform/core-api/src/com/intellij/patterns/ObjectPattern.java index becf78571baf..cf9f751c9852 100644 --- a/platform/core-api/src/com/intellij/patterns/ObjectPattern.java +++ b/platform/core-api/src/com/intellij/patterns/ObjectPattern.java @@ -89,7 +89,6 @@ public abstract class ObjectPattern> impl }); } - @SuppressWarnings("unchecked") @NotNull public Self oneOf(final T... values) { final Collection list; diff --git a/platform/core-api/src/com/intellij/patterns/TreeElementPattern.java b/platform/core-api/src/com/intellij/patterns/TreeElementPattern.java index 48b2d396a05e..e80dadf40384 100644 --- a/platform/core-api/src/com/intellij/patterns/TreeElementPattern.java +++ b/platform/core-api/src/com/intellij/patterns/TreeElementPattern.java @@ -42,8 +42,7 @@ public abstract class TreeElementPattern... types) { + public Self withParents(@NotNull final Class... types) { return with(new PatternCondition("withParents") { @Override public boolean accepts(@NotNull T t, ProcessingContext context) { @@ -171,8 +170,7 @@ public abstract class TreeElementPattern... patterns) { + public Self insideSequence(final boolean strict, @NotNull final ElementPattern... patterns) { return with(new PatternCondition("insideSequence") { public boolean accepts(@NotNull final T t, final ProcessingContext context) { int i = 0; diff --git a/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java b/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java index c008f3cd1c43..d33ee461f1cb 100644 --- a/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java +++ b/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java @@ -222,9 +222,8 @@ public class PsiTreeUtil { * @param type to cast found element to. * @return first found element, or null if nothing found. */ - @SafeVarargs @Nullable - @Contract("null, _ -> null") + @Contract("null, _, _ -> null") public static T findChildOfAnyType(@Nullable final PsiElement element, @NotNull final Class... classes) { return findChildOfAnyType(element, true, classes); } @@ -238,7 +237,6 @@ public class PsiTreeUtil { * @param type to cast found element to. * @return first found element, or null if nothing found. */ - @SafeVarargs @Nullable @Contract("null, _, _ -> null") public static T findChildOfAnyType(@Nullable final PsiElement element, @@ -265,7 +263,6 @@ public class PsiTreeUtil { return findChildrenOfAnyType(element, aClass); } - @SafeVarargs @NotNull public static Collection findChildrenOfAnyType(@Nullable final PsiElement element, @NotNull final Class... classes) { @@ -380,7 +377,6 @@ public class PsiTreeUtil { * @return the element, or null if none was found. * @since 5.1 */ - @SafeVarargs @Nullable @Contract("null, _ -> null") public static T getChildOfAnyType(@Nullable PsiElement element, @NotNull Class... classes) { @@ -470,7 +466,6 @@ public class PsiTreeUtil { return getParentOfType(element, parentClass); } - @SafeVarargs @Nullable @Contract("null, _, _, _ -> null") public static T getContextOfType(@Nullable PsiElement element, @@ -499,13 +494,11 @@ public class PsiTreeUtil { return getContextOfType(element, strict, aClass); } - @SafeVarargs @Nullable public static T getContextOfType(@Nullable PsiElement element, @NotNull Class... classes) { return getContextOfType(element, true, classes); } - @SafeVarargs @Nullable @Contract("null, _, _ -> null") public static T getContextOfType(@Nullable PsiElement element, @@ -544,7 +537,6 @@ public class PsiTreeUtil { return null; } - @SafeVarargs @Nullable @Contract("null, _, _, _ -> null") public static T getParentOfType(@Nullable PsiElement element, @@ -602,7 +594,6 @@ public class PsiTreeUtil { return null; } - @SafeVarargs @Nullable @Contract("null, _ -> null") public static T getParentOfType(@Nullable final PsiElement element, @@ -613,7 +604,6 @@ public class PsiTreeUtil { return getNonStrictParentOfType(parent, classes); } - @SafeVarargs @Nullable @Contract("null, _ -> null") public static T getNonStrictParentOfType(@Nullable final PsiElement element, @@ -638,7 +628,6 @@ public class PsiTreeUtil { return processor.toArray(); } - @SafeVarargs @NotNull public static Collection collectElementsOfType(@Nullable final PsiElement element, @NotNull final Class... classes) { @@ -790,7 +779,6 @@ public class PsiTreeUtil { return result; } - @SafeVarargs @Nullable public static T findElementOfClassAtOffsetWithStopSet(@NotNull PsiFile file, int offset, diff --git a/platform/core-api/src/com/intellij/util/ArrayQuery.java b/platform/core-api/src/com/intellij/util/ArrayQuery.java index 16d40bcc691f..abe2f1001fe0 100644 --- a/platform/core-api/src/com/intellij/util/ArrayQuery.java +++ b/platform/core-api/src/com/intellij/util/ArrayQuery.java @@ -32,7 +32,6 @@ import java.util.Iterator; public class ArrayQuery implements Query { private final T[] myArray; - @SafeVarargs public ArrayQuery(@NotNull T... array) { myArray = array; } diff --git a/platform/core-api/src/com/intellij/util/InstanceofQuery.java b/platform/core-api/src/com/intellij/util/InstanceofQuery.java index 9d8cd3dfe213..bf18d265a5f2 100644 --- a/platform/core-api/src/com/intellij/util/InstanceofQuery.java +++ b/platform/core-api/src/com/intellij/util/InstanceofQuery.java @@ -26,7 +26,6 @@ public class InstanceofQuery implements Query { private final Class[] myClasses; private final Query myDelegate; - @SafeVarargs public InstanceofQuery(Query delegate, Class... aClasses) { myClasses = aClasses; myDelegate = delegate; diff --git a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java index 1817ccc76315..febee0d328f1 100644 --- a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java +++ b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/id/PlatformIdTableBuilding.java @@ -119,7 +119,6 @@ public abstract class PlatformIdTableBuilding { private static class CompositeTodoIndexer implements DataIndexer { private final DataIndexer[] indexers; - @SafeVarargs public CompositeTodoIndexer(@NotNull DataIndexer... indexers) { this.indexers = indexers; } diff --git a/platform/lang-api/src/com/intellij/facet/frameworks/actions/AbstractAction.java b/platform/lang-api/src/com/intellij/facet/frameworks/actions/AbstractAction.java index a00fa840158e..b4ceea6eeb1f 100644 --- a/platform/lang-api/src/com/intellij/facet/frameworks/actions/AbstractAction.java +++ b/platform/lang-api/src/com/intellij/facet/frameworks/actions/AbstractAction.java @@ -27,10 +27,9 @@ import java.net.URL; public abstract class AbstractAction { private static final Logger LOG = Logger.getInstance(AbstractAction.class.getName()); - private static final String SERVER_URL = Registry.get("frameworks.download.libraries.server.url").asString(); + private static String SERVER_URL = Registry.get("frameworks.download.libraries.server.url").asString(); private Pair[] myParams; - @SafeVarargs protected AbstractAction(Pair... params) { myParams = params; } diff --git a/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoUtils.java b/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoUtils.java index 3e6cd63f26b5..92b6e2f55c1e 100644 --- a/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoUtils.java +++ b/platform/lang-api/src/com/intellij/lang/parameterInfo/ParameterInfoUtils.java @@ -40,7 +40,6 @@ public class ParameterInfoUtils { return findParentOfTypeWithStopElements(file, offset, parentClass); } - @SafeVarargs @Nullable public static T findParentOfTypeWithStopElements (PsiFile file, int offset, Class parentClass, @NotNull Class... stopAt) { PsiElement element = file.findElementAt(offset); diff --git a/platform/lang-api/src/com/intellij/semantic/SemKey.java b/platform/lang-api/src/com/intellij/semantic/SemKey.java index 55b1c7014401..9eadf0bb0f3c 100644 --- a/platform/lang-api/src/com/intellij/semantic/SemKey.java +++ b/platform/lang-api/src/com/intellij/semantic/SemKey.java @@ -34,7 +34,6 @@ public class SemKey { private final SemKey[] mySupers; private final int myUniqueId; - @SafeVarargs private SemKey(String debugName, SemKey... supers) { myDebugName = debugName; mySupers = supers; @@ -60,7 +59,6 @@ public class SemKey { return myDebugName; } - @SafeVarargs public static SemKey createKey(String debugName, SemKey... supers) { return new SemKey(debugName, supers); } @@ -69,8 +67,7 @@ public class SemKey { return myUniqueId; } - @SafeVarargs - public final SemKey subKey(@NonNls String debugName, SemKey... otherSupers) { + public SemKey subKey(@NonNls String debugName, SemKey... otherSupers) { if (otherSupers.length == 0) { return new SemKey(debugName, this); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/CompletionServiceImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/CompletionServiceImpl.java index b0eb76f7c810..7f3384b2bad0 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/CompletionServiceImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/CompletionServiceImpl.java @@ -196,7 +196,6 @@ public class CompletionServiceImpl extends CompletionService{ } } - @SafeVarargs public static boolean assertPhase(Class... possibilities) { if (!isPhase(possibilities)) { LOG.error(ourPhase + "; set at " + ourPhaseTrace); @@ -205,7 +204,6 @@ public class CompletionServiceImpl extends CompletionService{ return true; } - @SafeVarargs public static boolean isPhase(Class... possibilities) { CompletionPhase phase = getCompletionPhase(); for (Class possibility : possibilities) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/ChooseOneOrAllRunnable.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/ChooseOneOrAllRunnable.java index 4c0cf2981b9e..304d147677ee 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/ChooseOneOrAllRunnable.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/ChooseOneOrAllRunnable.java @@ -41,7 +41,6 @@ public abstract class ChooseOneOrAllRunnable implements Ru myTitle = title; } - @SuppressWarnings("unchecked") protected abstract void selected(T... classes); @Override diff --git a/platform/lang-impl/src/com/intellij/execution/RunManagerEx.java b/platform/lang-impl/src/com/intellij/execution/RunManagerEx.java index 2357ccecdb3a..fa530ccbea47 100644 --- a/platform/lang-impl/src/com/intellij/execution/RunManagerEx.java +++ b/platform/lang-impl/src/com/intellij/execution/RunManagerEx.java @@ -86,7 +86,6 @@ public abstract class RunManagerEx extends RunManager { @NotNull public abstract Map> getStructure(@NotNull ConfigurationType type); - @SafeVarargs public static void disableTasks(Project project, RunConfiguration settings, Key... keys) { for (Key key : keys) { List tasks = getInstanceEx(project).getBeforeRunTasks(settings, key); @@ -96,7 +95,6 @@ public abstract class RunManagerEx extends RunManager { } } - @SafeVarargs public static int getTasksCount(Project project, RunConfiguration settings, Key... keys) { int result = 0; for (Key key : keys) { diff --git a/platform/lang-impl/src/com/intellij/lang/SmartEnterProcessorWithFixers.java b/platform/lang-impl/src/com/intellij/lang/SmartEnterProcessorWithFixers.java index 5ac8a402e522..a09f39376850 100644 --- a/platform/lang-impl/src/com/intellij/lang/SmartEnterProcessorWithFixers.java +++ b/platform/lang-impl/src/com/intellij/lang/SmartEnterProcessorWithFixers.java @@ -176,8 +176,7 @@ public abstract class SmartEnterProcessorWithFixers extends SmartEnterProcessor ContainerUtil.addAllNotNull(myEnterProcessors, processors); } - @SafeVarargs - protected final void addFixers(Fixer... fixers) { + protected void addFixers(Fixer... fixers) { ContainerUtil.addAllNotNull(myFixers, fixers); } diff --git a/platform/platform-api/src/com/intellij/ui/CollectionListModel.java b/platform/platform-api/src/com/intellij/ui/CollectionListModel.java index 544b62b629c4..c301aa3be252 100644 --- a/platform/platform-api/src/com/intellij/ui/CollectionListModel.java +++ b/platform/platform-api/src/com/intellij/ui/CollectionListModel.java @@ -38,7 +38,6 @@ public class CollectionListModel extends AbstractListModel implements Editabl this((Collection)items); } - @SafeVarargs public CollectionListModel(final T... items) { myItems = ContainerUtilRt.newArrayList(items); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/SyncScrollSupport.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/SyncScrollSupport.java index 31f5a46a0e9f..e169a9c20e81 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/SyncScrollSupport.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/SyncScrollSupport.java @@ -84,8 +84,7 @@ public class SyncScrollSupport implements Disposable { new Pair(FragmentSide.SIDE2, sideContainers[0])); } - @SafeVarargs - private final void addSlavesScroller(Editor editor, Pair... contexts) { + private void addSlavesScroller(Editor editor, Pair... contexts) { ScrollListener scroller = new ScrollListener(contexts, editor); scroller.install(); myScrollers.add(scroller); diff --git a/platform/platform-tests/testSrc/com/intellij/history/core/LocalHistoryTestCase.java b/platform/platform-tests/testSrc/com/intellij/history/core/LocalHistoryTestCase.java index 8cfa8ebade1b..2fe04ea31a36 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/core/LocalHistoryTestCase.java +++ b/platform/platform-tests/testSrc/com/intellij/history/core/LocalHistoryTestCase.java @@ -138,12 +138,10 @@ public abstract class LocalHistoryTestCase extends Assert { return v.getChanges(); } - @SafeVarargs public static T[] array(T... objects) { return objects; } - @SafeVarargs public static List list(T... objects) { return Arrays.asList(objects); } diff --git a/platform/platform-tests/testSrc/com/intellij/util/graph/ChunkGraphTest.java b/platform/platform-tests/testSrc/com/intellij/util/graph/ChunkGraphTest.java index cfa3e019d6d5..9d70e3662561 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/graph/ChunkGraphTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/graph/ChunkGraphTest.java @@ -91,7 +91,6 @@ public class ChunkGraphTest extends GraphTestCase { } } - @SafeVarargs private static Set toSet(T... strings) { return new HashSet(Arrays.asList(strings)); } diff --git a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java index c3d3b8872583..d7e6e5a42ec4 100644 --- a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java @@ -384,12 +384,10 @@ public abstract class UsefulTestCase extends TestCase { return builder.toString(); } - @SafeVarargs public static void assertOrderedEquals(T[] actual, T... expected) { assertOrderedEquals(Arrays.asList(actual), expected); } - @SafeVarargs public static void assertOrderedEquals(Iterable actual, T... expected) { assertOrderedEquals(null, actual, expected); } @@ -403,7 +401,6 @@ public abstract class UsefulTestCase extends TestCase { } } - @SafeVarargs public static void assertOrderedEquals(final String errorMsg, @NotNull Iterable actual, @NotNull T... expected) { Assert.assertNotNull(actual); Assert.assertNotNull(expected); @@ -429,18 +426,15 @@ public abstract class UsefulTestCase extends TestCase { } } - @SafeVarargs public static void assertOrderedCollection(T[] collection, @NotNull Consumer... checkers) { Assert.assertNotNull(collection); assertOrderedCollection(Arrays.asList(collection), checkers); } - @SafeVarargs public static void assertSameElements(T[] collection, T... expected) { assertSameElements(Arrays.asList(collection), expected); } - @SafeVarargs public static void assertSameElements(Collection collection, T... expected) { assertSameElements(collection, Arrays.asList(expected)); } @@ -458,8 +452,7 @@ public abstract class UsefulTestCase extends TestCase { } } - @SafeVarargs - public final void assertContainsOrdered(Collection collection, T... expected) { + public void assertContainsOrdered(Collection collection, T... expected) { assertContainsOrdered(collection, Arrays.asList(expected)); } @@ -469,8 +462,7 @@ public abstract class UsefulTestCase extends TestCase { assertOrderedEquals(toString(collection), copy, expected); } - @SafeVarargs - public final void assertContainsElements(Collection collection, T... expected) { + public void assertContainsElements(Collection collection, T... expected) { assertContainsElements(collection, Arrays.asList(expected)); } @@ -484,8 +476,7 @@ public abstract class UsefulTestCase extends TestCase { return toString(Arrays.asList(collection), separator); } - @SafeVarargs - public final void assertDoesntContain(Collection collection, T... notExpected) { + public void assertDoesntContain(Collection collection, T... notExpected) { assertDoesntContain(collection, Arrays.asList(notExpected)); } @@ -515,7 +506,6 @@ public abstract class UsefulTestCase extends TestCase { return builder.toString(); } - @SafeVarargs public static void assertOrderedCollection(Collection collection, Consumer... checkers) { Assert.assertNotNull(collection); if (collection.size() != checkers.length) { @@ -534,12 +524,10 @@ public abstract class UsefulTestCase extends TestCase { } } - @SafeVarargs public static void assertUnorderedCollection(T[] collection, Consumer... checkers) { assertUnorderedCollection(Arrays.asList(collection), checkers); } - @SafeVarargs public static void assertUnorderedCollection(Collection collection, Consumer... checkers) { Assert.assertNotNull(collection); if (collection.size() != checkers.length) { @@ -598,7 +586,6 @@ public abstract class UsefulTestCase extends TestCase { return ts[0]; } - @SafeVarargs public static void assertOneOf(T value, T... values) { boolean found = false; for (T v : values) { diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java index 0997e37cad97..32582370a526 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java @@ -226,7 +226,6 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture { */ void enableInspections(@NotNull InspectionProfileEntry... inspections); - @SuppressWarnings("unchecked") void enableInspections(@NotNull Class... inspections); void enableInspections(@NotNull Collection> inspections); diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index a76b1fc841b3..ebc0a9d1608f 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -264,9 +264,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig return myPsiManager != null; } - @SafeVarargs @Override - public final void enableInspections(@NotNull final Class... inspections) { + public void enableInspections(@NotNull final Class... inspections) { enableInspections(Arrays.asList(inspections)); } diff --git a/platform/util-rt/src/com/intellij/openapi/util/Conditions.java b/platform/util-rt/src/com/intellij/openapi/util/Conditions.java index 60c5bafeb3b6..e591f22998c9 100644 --- a/platform/util-rt/src/com/intellij/openapi/util/Conditions.java +++ b/platform/util-rt/src/com/intellij/openapi/util/Conditions.java @@ -18,7 +18,6 @@ package com.intellij.openapi.util; import com.intellij.reference.SoftReference; import com.intellij.util.ArrayUtilRt; -import org.jetbrains.annotations.NotNull; import java.util.HashMap; @@ -44,8 +43,7 @@ public class Conditions { }; } - @SafeVarargs - public static Condition oneOf(@NotNull final T... options) { + public static Condition oneOf(final T... options) { return new Condition() { @Override public boolean value(T t) { diff --git a/platform/util-rt/src/com/intellij/util/containers/ContainerUtilRt.java b/platform/util-rt/src/com/intellij/util/containers/ContainerUtilRt.java index e4de19910e36..e4b3153917f7 100644 --- a/platform/util-rt/src/com/intellij/util/containers/ContainerUtilRt.java +++ b/platform/util-rt/src/com/intellij/util/containers/ContainerUtilRt.java @@ -107,7 +107,6 @@ public class ContainerUtilRt { return new LinkedList(); } - @SafeVarargs @NotNull public static LinkedList newLinkedList(@NotNull T... elements) { final LinkedList list = newLinkedList(); @@ -125,7 +124,6 @@ public class ContainerUtilRt { return new ArrayList(); } - @SafeVarargs @NotNull public static ArrayList newArrayList(@NotNull T... elements) { ArrayList list = newArrayListWithCapacity(elements.length); @@ -170,7 +168,6 @@ public class ContainerUtilRt { return new com.intellij.util.containers.HashSet(initialCapacity); } - @SafeVarargs @NotNull public static HashSet newHashSet(@NotNull T... elements) { return new com.intellij.util.containers.HashSet(Arrays.asList(elements)); @@ -197,7 +194,6 @@ public class ContainerUtilRt { return new com.intellij.util.containers.LinkedHashSet(); } - @SafeVarargs @NotNull public static LinkedHashSet newLinkedHashSet(@NotNull T... elements) { return newLinkedHashSet(Arrays.asList(elements)); @@ -217,7 +213,6 @@ public class ContainerUtilRt { return new TreeSet(); } - @SafeVarargs @NotNull public static TreeSet newTreeSet(@NotNull T... elements) { TreeSet set = newTreeSet(); @@ -245,7 +240,6 @@ public class ContainerUtilRt { return new Stack(elements); } - @SafeVarargs @NotNull public static Stack newStack(@NotNull T... initial) { return new Stack(Arrays.asList(initial)); diff --git a/platform/util-rt/src/com/intellij/util/containers/Stack.java b/platform/util-rt/src/com/intellij/util/containers/Stack.java index 6cd8fc8cfb6d..29337c9c99b1 100644 --- a/platform/util-rt/src/com/intellij/util/containers/Stack.java +++ b/platform/util-rt/src/com/intellij/util/containers/Stack.java @@ -15,7 +15,6 @@ */ package com.intellij.util.containers; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -37,8 +36,7 @@ public class Stack extends ArrayList { super(init); } - @SafeVarargs - public Stack(@NotNull T... items) { + public Stack(T... items) { for (T item : items) { push(item); } diff --git a/platform/util-rt/src/java/lang/SafeVarargs.java b/platform/util-rt/src/java/lang/SafeVarargs.java deleted file mode 100644 index 7c1bcf74d062..000000000000 --- a/platform/util-rt/src/java/lang/SafeVarargs.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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. - */ -package java.lang; - -import java.lang.annotation.*; - -@Deprecated -/** - as soon as we migrate jdk7+, remove this - see also {@link com.intellij.Patches.USE_REFLECTION_TO_ACCESS_JDK7} - - retention changed to source because it is not the real SafeVarargs, it's just a stub to be compilation-compatible with jdk7 -*/ -@Retention(RetentionPolicy.SOURCE) -@Target({ElementType.CONSTRUCTOR, ElementType.METHOD}) -public @interface SafeVarargs { -} diff --git a/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java b/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java index 0d3b51146764..41feba6d1584 100644 --- a/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java +++ b/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java @@ -15,7 +15,6 @@ */ package com.intellij.openapi.util; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -39,8 +38,7 @@ public class MultiValuesMap{ } } - @SafeVarargs - public final void putAll(K key, @NotNull V... values) { + public void putAll(K key, V... values) { for (V value : values) { put(key, value); } diff --git a/platform/util/src/com/intellij/util/ArrayConsumer.java b/platform/util/src/com/intellij/util/ArrayConsumer.java index 77dde63d0530..e69174b18260 100644 --- a/platform/util/src/com/intellij/util/ArrayConsumer.java +++ b/platform/util/src/com/intellij/util/ArrayConsumer.java @@ -20,7 +20,6 @@ package com.intellij.util; */ public interface ArrayConsumer extends Consumer{ - @SuppressWarnings("unchecked") @Override void consume(final T... ts); } diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java index de6d17743f52..1edda3521fd8 100644 --- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java +++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java @@ -38,7 +38,6 @@ public class ContainerUtil extends ContainerUtilRt { private static final int INSERTION_SORT_THRESHOLD = 10; private static final int DEFAULT_CONCURRENCY_LEVEL = Math.min(16, Runtime.getRuntime().availableProcessors()); - @SafeVarargs @NotNull public static T[] ar(@NotNull T... elements) { return elements; @@ -54,7 +53,6 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newHashMap(map); } - @SafeVarargs @NotNull public static Map newHashMap(@NotNull Pair first, Pair... entries) { return ContainerUtilRt.newHashMap(first, entries); @@ -85,9 +83,8 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newLinkedHashMap(map); } - @SafeVarargs @NotNull - public static LinkedHashMap newLinkedHashMap(@NotNull Pair first, @NotNull Pair... entries) { + public static LinkedHashMap newLinkedHashMap(@NotNull Pair first, Pair... entries) { return ContainerUtilRt.newLinkedHashMap(first, entries); } @@ -128,7 +125,6 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newLinkedList(); } - @SafeVarargs @NotNull public static LinkedList newLinkedList(@NotNull T... elements) { return ContainerUtilRt.newLinkedList(elements); @@ -144,7 +140,6 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newArrayList(); } - @SafeVarargs @NotNull public static ArrayList newArrayList(@NotNull E... array) { return ContainerUtilRt.newArrayList(array); @@ -193,7 +188,6 @@ public class ContainerUtil extends ContainerUtilRt { return new SmartList(element); } - @SafeVarargs @NotNull public static List newSmartList(@NotNull T... elements) { return new SmartList(elements); @@ -209,7 +203,6 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newHashSet(initialCapacity); } - @SafeVarargs @NotNull public static HashSet newHashSet(@NotNull T... elements) { return ContainerUtilRt.newHashSet(elements); @@ -241,7 +234,6 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newLinkedHashSet(elements); } - @SafeVarargs @NotNull public static LinkedHashSet newLinkedHashSet(@NotNull T... elements) { return ContainerUtilRt.newLinkedHashSet(elements); @@ -257,13 +249,11 @@ public class ContainerUtil extends ContainerUtilRt { return new THashSet(strategy); } - @SafeVarargs @NotNull public static THashSet newTroveSet(@NotNull T... elements) { return newTroveSet(Arrays.asList(elements)); } - @SafeVarargs @NotNull public static THashSet newTroveSet(@NotNull TObjectHashingStrategy strategy, @NotNull T... elements) { return new THashSet(Arrays.asList(elements), strategy); @@ -308,7 +298,6 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newTreeSet(elements); } - @SafeVarargs @NotNull public static TreeSet newTreeSet(@NotNull T... elements) { return ContainerUtilRt.newTreeSet(elements); @@ -375,13 +364,11 @@ public class ContainerUtil extends ContainerUtilRt { return result; } - @SafeVarargs @NotNull public static Set immutableSet(@NotNull E ... elements) { return Collections.unmodifiableSet(new THashSet(Arrays.asList(elements))); } - @SafeVarargs @NotNull public static ImmutableList immutableList(@NotNull E ... array) { return new ImmutableListBackedByArray(array); @@ -809,7 +796,6 @@ public class ContainerUtil extends ContainerUtilRt { return result.isEmpty() ? ArrayUtil.EMPTY_INT_ARRAY : result.toNativeArray(); } - @SafeVarargs @NotNull public static List filter(@NotNull Condition condition, @NotNull T... collection) { return findAll(collection, condition); @@ -1027,7 +1013,6 @@ public class ContainerUtil extends ContainerUtilRt { } } - @SafeVarargs @NotNull public static > C addAll(@NotNull C collection, @NotNull A... elements) { //noinspection ManualArrayToCollectionCopy @@ -1040,7 +1025,6 @@ public class ContainerUtil extends ContainerUtilRt { /** * Adds all not-null elements from the {@code elements}, ignoring nulls */ - @SafeVarargs @NotNull public static > C addAllNotNull(@NotNull C collection, @NotNull A... elements) { for (T element : elements) { @@ -1051,7 +1035,6 @@ public class ContainerUtil extends ContainerUtilRt { return collection; } - @SafeVarargs public static boolean removeAll(@NotNull Collection collection, @NotNull T... elements) { boolean modified = false; for (T element : elements) { @@ -1110,9 +1093,8 @@ public class ContainerUtil extends ContainerUtilRt { * @param appendTail specify whether additional values should be appended in front or after the list * @return read-only list consisting of the elements from specified list with some additional values */ - @SafeVarargs @NotNull - public static List concat(boolean appendTail, @NotNull List list, @NotNull T... values) { + public static List concat(boolean appendTail, @NotNull List list, T... values) { return appendTail ? concat(list, list(values)) : concat(list(values), list); } @@ -1141,7 +1123,6 @@ public class ContainerUtil extends ContainerUtilRt { }; } - @SafeVarargs @NotNull public static Iterable concat(@NotNull final Iterable... iterables) { return new Iterable() { @@ -1158,7 +1139,6 @@ public class ContainerUtil extends ContainerUtilRt { }; } - @SafeVarargs @NotNull public static Iterator concatIterators(@NotNull Iterator... iterators) { return new SequenceIterator(iterators); @@ -1169,7 +1149,6 @@ public class ContainerUtil extends ContainerUtilRt { return new SequenceIterator(iterators); } - @SafeVarargs @NotNull public static Iterable concat(@NotNull final T[]... iterables) { return new Iterable() { @@ -1189,7 +1168,6 @@ public class ContainerUtil extends ContainerUtilRt { /** * @return read-only list consisting of the lists added together */ - @SafeVarargs @NotNull public static List concat(@NotNull final List... lists) { int size = 0; @@ -1550,7 +1528,6 @@ public class ContainerUtil extends ContainerUtilRt { /** * @return read-only list consisting of the elements with nulls filtered out */ - @SafeVarargs @NotNull public static List packNullables(@NotNull T... elements) { List list = new ArrayList(); @@ -1586,7 +1563,6 @@ public class ContainerUtil extends ContainerUtilRt { return result.toArray(emptyArray); } - @SafeVarargs @NotNull public static Set set(@NotNull T ... items) { return newHashSet(items); @@ -1689,7 +1665,6 @@ public class ContainerUtil extends ContainerUtilRt { return items.subList(0, items.size() - 1); } - @SafeVarargs @NotNull public static List list(@NotNull T... items) { return Arrays.asList(items); @@ -1972,7 +1947,6 @@ public class ContainerUtil extends ContainerUtilRt { return ContainerUtilRt.newStack(initial); } - @SafeVarargs @NotNull public static Stack newStack(@NotNull T... initial) { return ContainerUtilRt.newStack(initial); diff --git a/platform/util/src/com/intellij/util/containers/OpenTHashSet.java b/platform/util/src/com/intellij/util/containers/OpenTHashSet.java index 370d42182f33..0785ca3f3639 100644 --- a/platform/util/src/com/intellij/util/containers/OpenTHashSet.java +++ b/platform/util/src/com/intellij/util/containers/OpenTHashSet.java @@ -17,7 +17,6 @@ package com.intellij.util.containers; import gnu.trove.THashSet; import gnu.trove.TObjectHashingStrategy; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Arrays; @@ -62,8 +61,7 @@ public class OpenTHashSet extends THashSet { super(ts, strategy); } - @SafeVarargs - public OpenTHashSet(final TObjectHashingStrategy strategy, @NotNull T... ts) { + public OpenTHashSet(final TObjectHashingStrategy strategy, final T... ts) { super(Arrays.asList(ts), strategy); } diff --git a/platform/util/src/com/intellij/util/containers/SequenceIterator.java b/platform/util/src/com/intellij/util/containers/SequenceIterator.java index b3448f68d97b..35e7b836786c 100644 --- a/platform/util/src/com/intellij/util/containers/SequenceIterator.java +++ b/platform/util/src/com/intellij/util/containers/SequenceIterator.java @@ -25,7 +25,6 @@ public class SequenceIterator implements Iterator { private final Iterator[] myIterators; private int myCurrentIndex; - @SafeVarargs public SequenceIterator(@NotNull Iterator... iterators){ myIterators = new Iterator[iterators.length]; System.arraycopy(iterators, 0, myIterators, 0, iterators.length); diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/ConcurrentTasks.java b/platform/vcs-api/src/com/intellij/openapi/vcs/ConcurrentTasks.java index 342e4d0d769f..c045561561a3 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/ConcurrentTasks.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/ConcurrentTasks.java @@ -21,7 +21,6 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; import com.intellij.util.Consumer; import com.intellij.util.concurrency.Semaphore; -import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.LinkedList; @@ -42,7 +41,7 @@ public class ConcurrentTasks { final EmptyProgressIndicator pi = new EmptyProgressIndicator() { @Override public void checkCanceled() { - if (myResultKnown || myParentIndicator != null && myParentIndicator.isCanceled()) { + if (myResultKnown || (myParentIndicator != null) && myParentIndicator.isCanceled()) { super.cancel(); } super.checkCanceled(); @@ -92,7 +91,7 @@ public class ConcurrentTasks { } // in it possible to even interrupt() threads involved, but at the moment it's better for tasks themselves to check cancel status for (Future future : futures) { - if (!future.isCancelled() && !future.isDone()) { + if ((! future.isCancelled() && (! future.isDone()))) { future.cancel(true); } } @@ -106,8 +105,7 @@ public class ConcurrentTasks { return myResult; } - @SafeVarargs - public ConcurrentTasks(final ProgressIndicator parentIndicator, @NotNull Consumer>... tasks) { + public ConcurrentTasks(final ProgressIndicator parentIndicator, final Consumer>... tasks) { myParentIndicator = parentIndicator; myTasks = Arrays.asList(tasks); mySemaphore = new Semaphore(); diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java index 751a2b0293d1..6a389f2206fd 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java @@ -149,7 +149,6 @@ public abstract class BaseInspection extends BaseJavaBatchLocalInspectionTool { return null; } - @SafeVarargs protected static void parseString(String string, List... outs) { final List strings = StringUtil.split(string, ","); for (List out : outs) { @@ -169,7 +168,6 @@ public abstract class BaseInspection extends BaseJavaBatchLocalInspectionTool { } } - @SafeVarargs protected static String formatString(List... strings) { final StringBuilder buffer = new StringBuilder(); final int size = strings[0].size(); diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java index 3b440dc60d32..08ea82310e0e 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java @@ -257,7 +257,6 @@ public class IfCanBeSwitchInspection extends BaseInspection { } } - @SafeVarargs @Nullable public static T getPrevSiblingOfType(@Nullable PsiElement element, @NotNull Class aClass, @NotNull Class... stopAt) { diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/switchtoif/ReplaceIfWithSwitchIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/switchtoif/ReplaceIfWithSwitchIntention.java index 1a901a7c9baa..cde03e1aeb1c 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/switchtoif/ReplaceIfWithSwitchIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/switchtoif/ReplaceIfWithSwitchIntention.java @@ -133,7 +133,6 @@ public class ReplaceIfWithSwitchIntention extends Intention { } } - @SafeVarargs @Nullable public static T getPrevSiblingOfType(@Nullable PsiElement element, @NotNull Class aClass, @NotNull Class... stopAt) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/patterns/GroovyMethodCallPattern.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/patterns/GroovyMethodCallPattern.java index fd4d6dba2905..d87020be6cbc 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/patterns/GroovyMethodCallPattern.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/patterns/GroovyMethodCallPattern.java @@ -34,8 +34,7 @@ public class GroovyMethodCallPattern extends GroovyExpressionPattern... arguments) { + public GroovyMethodCallPattern withArguments(final ElementPattern... arguments) { return with(new PatternCondition("withArguments") { @Override public boolean accepts(@NotNull GrCallExpression callExpression, ProcessingContext context) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java index 091659bb7981..98bd1d918f5c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java @@ -392,7 +392,6 @@ public class ResolveUtil { return resolveExistingElement(place, processor, PsiClass.class); } - @SafeVarargs @Nullable public static T resolveExistingElement(PsiElement place, ResolverProcessor processor, Class... classes) { treeWalkUp(place, processor, true); diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenTestCase.java index 5b5d98b4e429..0b1c369ed693 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenTestCase.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenTestCase.java @@ -504,17 +504,14 @@ public abstract class MavenTestCase extends UsefulTestCase { new SetWithToString(new THashSet(actual, FileUtil.PATH_HASHING_STRATEGY))); } - @SafeVarargs protected static void assertUnorderedElementsAreEqual(T[] actual, T... expected) { assertUnorderedElementsAreEqual(Arrays.asList(actual), expected); } - @SafeVarargs protected static void assertUnorderedElementsAreEqual(Collection actual, T... expected) { assertUnorderedElementsAreEqual(actual, Arrays.asList(expected)); } - @SafeVarargs protected static void assertOrderedElementsAreEqual(Collection actual, T... expected) { String s = "\nexpected: " + Arrays.asList(expected) + "\nactual: " + new ArrayList(actual); assertEquals(s, expected.length, actual.size()); @@ -527,13 +524,11 @@ public abstract class MavenTestCase extends UsefulTestCase { } } - @SafeVarargs protected static void assertContain(List actual, T... expected) { List expectedList = Arrays.asList(expected); assertTrue("expected: " + expectedList + "\n" + "actual: " + actual.toString(), actual.containsAll(expectedList)); } - @SafeVarargs protected static void assertDoNotContain(List actual, T... expected) { List actualCopy = new ArrayList(actual); actualCopy.removeAll(Arrays.asList(expected)); diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepositoryUtil.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepositoryUtil.java index d8eadcd62929..7880170c8577 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepositoryUtil.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepositoryUtil.java @@ -102,7 +102,6 @@ public class GenericRepositoryUtil { return StringUtil.capitalizeWords(prettyName, true); } - @SafeVarargs public static List concat(List list, T... values) { return ContainerUtil.concat(true, list, values); } diff --git a/python/src/com/jetbrains/python/editor/PythonEnterHandler.java b/python/src/com/jetbrains/python/editor/PythonEnterHandler.java index a94c65941f91..c055606c450a 100644 --- a/python/src/com/jetbrains/python/editor/PythonEnterHandler.java +++ b/python/src/com/jetbrains/python/editor/PythonEnterHandler.java @@ -295,7 +295,6 @@ public class PythonEnterHandler extends EnterHandlerDelegateAdapter { return findAfterCaret(node, PyStatement.class); } - @SafeVarargs private static PsiElement findBeforeCaret(ASTNode atCaret, Class... classes) { while (atCaret != null) { atCaret = TreeUtil.prevLeaf(atCaret); @@ -306,7 +305,6 @@ public class PythonEnterHandler extends EnterHandlerDelegateAdapter { return null; } - @SafeVarargs private static PsiElement findAfterCaret(ASTNode atCaret, Class... classes) { while (atCaret != null) { if (atCaret.getElementType() != TokenType.WHITE_SPACE) { @@ -317,7 +315,6 @@ public class PythonEnterHandler extends EnterHandlerDelegateAdapter { return null; } - @SafeVarargs @Nullable private static T getNonStrictParentOfType(@NotNull PsiElement element, @NotNull Class... classes) { PsiElement run = element; diff --git a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java index ee90d0c862f3..3118157c0bfb 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java @@ -693,7 +693,6 @@ public class PyPackageManagerImpl extends PyPackageManager { myExceptionCache = null; } - @SafeVarargs private static List list(T... xs) { return Arrays.asList(xs); } diff --git a/python/src/com/jetbrains/python/psi/PyUtil.java b/python/src/com/jetbrains/python/psi/PyUtil.java index c7c2d68dd224..1d86c097a511 100644 --- a/python/src/com/jetbrains/python/psi/PyUtil.java +++ b/python/src/com/jetbrains/python/psi/PyUtil.java @@ -1003,7 +1003,6 @@ public class PyUtil { * @param variants things to search among * @return true iff what.equals() one of the variants. */ - @SafeVarargs public static boolean among(@NotNull T what, T... variants) { for (T s : variants) { if (what.equals(s)) return true; diff --git a/python/testSrc/com/jetbrains/python/PyRequirementTest.java b/python/testSrc/com/jetbrains/python/PyRequirementTest.java index 84b0db457d19..75fb9a55e16f 100644 --- a/python/testSrc/com/jetbrains/python/PyRequirementTest.java +++ b/python/testSrc/com/jetbrains/python/PyRequirementTest.java @@ -100,7 +100,6 @@ public class PyRequirementTest extends PyTestCase { PyRequirement.fromString("git+git://github.com/django/django.git@stable/1.5.x")); } - @SafeVarargs private static List list(T... xs) { return Arrays.asList(xs); } diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyCodeFragmentTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyCodeFragmentTest.java index fafaf4c657b5..8b6f81b29f4f 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyCodeFragmentTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyCodeFragmentTest.java @@ -44,8 +44,7 @@ public class PyCodeFragmentTest extends LightMarkedTestCase { final private String END_MARKER = ""; final private String RESULT_MARKER = ""; - @SafeVarargs - private final void doTest(Pair... files2Create) throws Exception { + private void doTest(Pair... files2Create) throws Exception { final String testName = getTestName(false).toLowerCase(); final String fullPath = getTestDataPath() + testName + ".test"; diff --git a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java index de6dbcb9f964..350fe416980f 100644 --- a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java +++ b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java @@ -131,8 +131,7 @@ public class NavigationGutterIconBuilder { return setTargets(ContainerUtil.createMaybeSingletonList(target)); } - @SafeVarargs - public final NavigationGutterIconBuilder setTargets(@NotNull T... targets) { + public NavigationGutterIconBuilder setTargets(@NotNull T... targets) { return setTargets(Arrays.asList(targets)); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java index 61ddcf895ff1..b06563e4e223 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java @@ -200,8 +200,7 @@ public class ModelMergerImpl implements ModelMerger { myMergingStrategyClasses.add(aClass); } - @SafeVarargs - public final T mergeModels(final Class aClass, final T... implementations) { + public T mergeModels(final Class aClass, final T... implementations) { if (implementations.length == 1) return implementations[0]; final MergingInvocationHandler handler = new MergingInvocationHandler(aClass, Arrays.asList(implementations)); return _mergeModels(aClass, handler, implementations); @@ -212,8 +211,7 @@ public class ModelMergerImpl implements ModelMerger { } - @SafeVarargs - private final T _mergeModels(final Class aClass, final MergingInvocationHandler handler, final T... implementations) { + private T _mergeModels(final Class aClass, final MergingInvocationHandler handler, final T... implementations) { final Set commonClasses = getCommonClasses(new THashSet(), implementations); commonClasses.add(MERGED_OBJECT_CLASS); commonClasses.add(aClass); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ModelMerger.java b/xml/dom-openapi/src/com/intellij/util/xml/ModelMerger.java index d2401ccecf21..572aa1010158 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ModelMerger.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ModelMerger.java @@ -27,7 +27,6 @@ import java.util.List; * @see DomManager#createModelMerger() */ public interface ModelMerger { - @SuppressWarnings("unchecked") T mergeModels(Class aClass, T... implementations); T mergeModels(Class aClass, Collection implementations); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java index c34e671be2cd..2481f42aba2f 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java @@ -50,7 +50,6 @@ public class ModelMergerUtil { return null; } - @SafeVarargs @Nullable public static V getImplementation(final Class clazz, final T... elements) { return getImplementation(clazz, Arrays.asList(elements)); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java index f409fd1f8c45..f1c7c089450d 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java @@ -27,7 +27,6 @@ import org.jetbrains.annotations.NotNull; */ public abstract class BasicDomElementsInspection extends DomElementsInspection { - @SafeVarargs public BasicDomElementsInspection(@NotNull Class domClass, Class... additionalClasses) { super(domClass, additionalClasses); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java index ff881cccc99e..3c7844b0e04e 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java @@ -49,7 +49,6 @@ public abstract class DomElementsInspection extends XmlSup private final Set> myDomClasses; - @SafeVarargs public DomElementsInspection(Class domClass, @NotNull Class... additionalClasses) { myDomClasses = new THashSet>(Arrays.asList(additionalClasses)); myDomClasses.add(domClass);