mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
annotate varargs methods with SafeVarargs or add corresponding external annotation to get rid of yellow callsites
This commit is contained in:
@@ -63,6 +63,7 @@ public abstract class InspectionValidator {
|
||||
/**
|
||||
* @deprecated Provide inspection classes via {@link #getInspectionToolClasses(CompileContext)} instead.
|
||||
*/
|
||||
@SafeVarargs
|
||||
protected InspectionValidator(@NotNull final String description,
|
||||
@NotNull final String progressIndicatorText,
|
||||
final Class<? extends LocalInspectionTool>... inspectionToolClasses) {
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -56,7 +57,7 @@ public class HighlightExceptionsHandler extends HighlightUsagesHandlerBase<PsiCl
|
||||
protected void selectTargets(final List<PsiClass> targets, final Consumer<List<PsiClass>> selectionConsumer) {
|
||||
new ChooseClassAndDoHighlightRunnable(myClassTypes, myEditor, CodeInsightBundle.message("highlight.exceptions.thrown.chooser.title")) {
|
||||
@Override
|
||||
protected void selected(PsiClass... classes) {
|
||||
protected void selected(@NotNull PsiClass... classes) {
|
||||
selectionConsumer.consume(Arrays.asList(classes));
|
||||
}
|
||||
}.run();
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -50,7 +51,7 @@ public class HighlightOverridingMethodsHandler extends HighlightUsagesHandlerBas
|
||||
protected void selectTargets(final List<PsiClass> targets, final Consumer<List<PsiClass>> selectionConsumer) {
|
||||
new ChooseClassAndDoHighlightRunnable(targets, myEditor, CodeInsightBundle.message("highlight.overridden.classes.chooser.title")) {
|
||||
@Override
|
||||
protected void selected(PsiClass... classes) {
|
||||
protected void selected(@NotNull PsiClass... classes) {
|
||||
selectionConsumer.consume(Arrays.asList(classes));
|
||||
}
|
||||
}.run();
|
||||
|
||||
+6
-3
@@ -33,11 +33,13 @@ public class AnnotatedElementsSearch extends ExtensibleQueryFactory<PsiModifierL
|
||||
private final Class<? extends PsiModifierListOwner>[] myTypes;
|
||||
private final boolean myApproximate;
|
||||
|
||||
public Parameters(final PsiClass annotationClass, final SearchScope scope, Class<? extends PsiModifierListOwner>... types) {
|
||||
@SafeVarargs
|
||||
public Parameters(final PsiClass annotationClass, final SearchScope scope, @NotNull Class<? extends PsiModifierListOwner>... types) {
|
||||
this(annotationClass, scope, false, types);
|
||||
}
|
||||
|
||||
public Parameters(final PsiClass annotationClass, final SearchScope scope, boolean approximate, Class<? extends PsiModifierListOwner>... types) {
|
||||
@SafeVarargs
|
||||
public Parameters(final PsiClass annotationClass, final SearchScope scope, boolean approximate, @NotNull Class<? extends PsiModifierListOwner>... types) {
|
||||
myAnnotationClass = annotationClass;
|
||||
myScope = scope;
|
||||
myTypes = types;
|
||||
@@ -65,7 +67,8 @@ public class AnnotatedElementsSearch extends ExtensibleQueryFactory<PsiModifierL
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends PsiModifierListOwner> Query<T> searchElements(@NotNull PsiClass annotationClass, @NotNull SearchScope scope, Class<? extends T>... types) {
|
||||
@SafeVarargs
|
||||
public static <T extends PsiModifierListOwner> Query<T> searchElements(@NotNull PsiClass annotationClass, @NotNull SearchScope scope, @NotNull Class<? extends T>... types) {
|
||||
//noinspection unchecked
|
||||
return (Query<T>)searchElements(new Parameters(annotationClass, scope, types));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<item name="com.intellij.patterns.PsiJavaPatterns com.intellij.patterns.PsiJavaElementPattern.Capture<com.intellij.psi.PsiElement> psiElement(java.lang.Class<? extends com.intellij.psi.PsiElement>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
</root>
|
||||
@@ -2,6 +2,9 @@
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<annotation-paths>
|
||||
<root url="file://$MODULE_DIR$/anno" />
|
||||
</annotation-paths>
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<item name="com.intellij.patterns.StandardPatterns com.intellij.patterns.ElementPattern<E> and(com.intellij.patterns.ElementPattern<? extends E>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.patterns.StandardPatterns com.intellij.patterns.ElementPattern<T> instanceOf(java.lang.Class<T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.patterns.StandardPatterns com.intellij.patterns.ElementPattern<E> or(com.intellij.patterns.ElementPattern<? extends E>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.patterns.TreeElementPattern Self insideSequence(boolean, com.intellij.patterns.ElementPattern<? extends ParentType>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.patterns.TreeElementPattern Self withParents(java.lang.Class<? extends ParentType>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
</root>
|
||||
@@ -3,4 +3,43 @@
|
||||
<item name="com.intellij.psi.util.CachedValueProvider">
|
||||
<annotation name="java.lang.FunctionalInterface" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil java.util.Collection<T> collectElementsOfType(com.intellij.psi.PsiElement, java.lang.Class<T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil java.util.Collection<T> findChildrenOfAnyType(com.intellij.psi.PsiElement, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T findChildOfAnyType(com.intellij.psi.PsiElement, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T findChildOfAnyType(com.intellij.psi.PsiElement, boolean, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil java.util.List<T> getChildrenOfAnyType(com.intellij.psi.PsiElement, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T getChildOfAnyType(com.intellij.psi.PsiElement, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T getContextOfType(com.intellij.psi.PsiElement, java.lang.Class<T>, boolean, java.lang.Class<? extends com.intellij.psi.PsiElement>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T getContextOfType(com.intellij.psi.PsiElement, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T getContextOfType(com.intellij.psi.PsiElement, boolean, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T getNonStrictParentOfType(com.intellij.psi.PsiElement, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T getParentOfType(com.intellij.psi.PsiElement, java.lang.Class<T>, boolean, java.lang.Class<? extends com.intellij.psi.PsiElement>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil T getParentOfType(com.intellij.psi.PsiElement, java.lang.Class<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.psi.util.PsiTreeUtil boolean instanceOf(java.lang.Object, java.lang.Class<?>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
</root>
|
||||
+1
@@ -108,6 +108,7 @@ public abstract class PlatformIdTableBuilding {
|
||||
private static class CompositeTodoIndexer extends VersionedTodoIndexer {
|
||||
private final DataIndexer<TodoIndexEntry, Integer, FileContent>[] indexers;
|
||||
|
||||
@SafeVarargs
|
||||
public CompositeTodoIndexer(@NotNull DataIndexer<TodoIndexEntry, Integer, FileContent>... indexers) {
|
||||
this.indexers = indexers;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ public abstract class AbstractAction {
|
||||
private static final String SERVER_URL = Registry.get("frameworks.download.libraries.server.url").asString();
|
||||
private final Pair<String, String>[] myParams;
|
||||
|
||||
protected AbstractAction(Pair<String, String>... params) {
|
||||
@SafeVarargs
|
||||
protected AbstractAction(@NotNull Pair<String, String>... params) {
|
||||
myParams = params;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ParameterInfoUtils {
|
||||
return findParentOfTypeWithStopElements(file, offset, parentClass);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@Nullable
|
||||
public static <T extends PsiElement> T findParentOfTypeWithStopElements (PsiFile file, int offset, Class<T> parentClass, @NotNull Class<? extends PsiElement>... stopAt) {
|
||||
PsiElement element = file.findElementAt(offset);
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.semantic;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -37,7 +38,8 @@ public class SemKey<T extends SemElement> {
|
||||
private final List<SemKey> myInheritors = ContainerUtil.createEmptyCOWList();
|
||||
private final int myUniqueId;
|
||||
|
||||
private SemKey(String debugName, SemKey<? super T>... supers) {
|
||||
@SafeVarargs
|
||||
private SemKey(String debugName, @NotNull SemKey<? super T>... supers) {
|
||||
myDebugName = debugName;
|
||||
mySupers = supers;
|
||||
myUniqueId = counter.getAndIncrement();
|
||||
@@ -75,7 +77,8 @@ public class SemKey<T extends SemElement> {
|
||||
return myDebugName;
|
||||
}
|
||||
|
||||
public static <T extends SemElement> SemKey<T> createKey(String debugName, SemKey<? super T>... supers) {
|
||||
@SafeVarargs
|
||||
public static <T extends SemElement> SemKey<T> createKey(String debugName, @NotNull SemKey<? super T>... supers) {
|
||||
return new SemKey<>(debugName, supers);
|
||||
}
|
||||
|
||||
@@ -88,7 +91,8 @@ public class SemKey<T extends SemElement> {
|
||||
return myUniqueId;
|
||||
}
|
||||
|
||||
public <K extends T> SemKey<K> subKey(@NonNls String debugName, SemKey<? super T>... otherSupers) {
|
||||
@SafeVarargs
|
||||
public final <K extends T> SemKey<K> subKey(@NonNls String debugName, @NotNull SemKey<? super T>... otherSupers) {
|
||||
if (otherSupers.length == 0) {
|
||||
return new SemKey<>(debugName, this);
|
||||
}
|
||||
|
||||
+4
-2
@@ -192,7 +192,8 @@ public final class CompletionServiceImpl extends CompletionService{
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean assertPhase(Class<? extends CompletionPhase>... possibilities) {
|
||||
@SafeVarargs
|
||||
public static boolean assertPhase(@NotNull Class<? extends CompletionPhase>... possibilities) {
|
||||
if (!isPhase(possibilities)) {
|
||||
LOG.error(ourPhase + "; set at " + ourPhaseTrace);
|
||||
return false;
|
||||
@@ -200,7 +201,8 @@ public final class CompletionServiceImpl extends CompletionService{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isPhase(Class<? extends CompletionPhase>... possibilities) {
|
||||
@SafeVarargs
|
||||
public static boolean isPhase(@NotNull Class<? extends CompletionPhase>... possibilities) {
|
||||
CompletionPhase phase = getCompletionPhase();
|
||||
for (Class<? extends CompletionPhase> possibility : possibilities) {
|
||||
if (possibility.isInstance(phase)) {
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import com.intellij.openapi.ui.popup.PopupChooserBuilder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
@@ -41,7 +42,7 @@ public abstract class ChooseOneOrAllRunnable<T extends PsiElement> implements Ru
|
||||
myTitle = title;
|
||||
}
|
||||
|
||||
protected abstract void selected(T... classes);
|
||||
protected abstract void selected(@NotNull T... classes);
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -94,7 +94,8 @@ public abstract class RunManagerEx extends RunManager {
|
||||
@NotNull
|
||||
public abstract Map<String, List<RunnerAndConfigurationSettings>> getStructure(@NotNull ConfigurationType type);
|
||||
|
||||
public static void disableTasks(Project project, RunConfiguration settings, Key<? extends BeforeRunTask>... keys) {
|
||||
@SafeVarargs
|
||||
public static void disableTasks(Project project, RunConfiguration settings, @NotNull Key<? extends BeforeRunTask>... keys) {
|
||||
for (Key<? extends BeforeRunTask> key : keys) {
|
||||
List<? extends BeforeRunTask> tasks = getInstanceEx(project).getBeforeRunTasks(settings, key);
|
||||
for (BeforeRunTask task : tasks) {
|
||||
@@ -103,7 +104,8 @@ public abstract class RunManagerEx extends RunManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getTasksCount(Project project, RunConfiguration settings, Key<? extends BeforeRunTask>... keys) {
|
||||
@SafeVarargs
|
||||
public static int getTasksCount(Project project, RunConfiguration settings, @NotNull Key<? extends BeforeRunTask>... keys) {
|
||||
return Arrays.stream(keys).mapToInt(key -> getInstanceEx(project).getBeforeRunTasks(settings, key).size()).sum();
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,8 @@ public abstract class SmartEnterProcessorWithFixers extends SmartEnterProcessor
|
||||
ContainerUtil.addAllNotNull(myAfterEnterProcessors, processors);
|
||||
}
|
||||
|
||||
protected void addFixers(Fixer<? extends SmartEnterProcessorWithFixers>... fixers) {
|
||||
@SafeVarargs
|
||||
protected final void addFixers(@NotNull Fixer<? extends SmartEnterProcessorWithFixers>... fixers) {
|
||||
ContainerUtil.addAllNotNull(myFixers, fixers);
|
||||
}
|
||||
|
||||
|
||||
@@ -555,6 +555,7 @@ public class GeneratedParserUtilBase {
|
||||
state.hooks = Hooks.concat(hook, param, state.level, state.hooks);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public static <T> void register_hook_(PsiBuilder builder, Hook<T[]> hook, T... param) {
|
||||
ErrorState state = ErrorState.get(builder);
|
||||
state.hooks = Hooks.concat(hook, param, state.level, state.hooks);
|
||||
|
||||
@@ -33,7 +33,8 @@ public class BaseListPopupStep<T> extends BaseStep<T> implements ListPopupStep<T
|
||||
private List<Icon> myIcons;
|
||||
private int myDefaultOptionIndex = -1;
|
||||
|
||||
public BaseListPopupStep(@Nullable String title, T... values) {
|
||||
@SafeVarargs
|
||||
public BaseListPopupStep(@Nullable String title, @NotNull T... values) {
|
||||
this(title, values, new Icon[]{});
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ public class CollectionListModel<T> extends AbstractListModel<T> implements Edit
|
||||
myItems = new ArrayList<>(items);
|
||||
}
|
||||
|
||||
public CollectionListModel(final T... items) {
|
||||
@SafeVarargs
|
||||
public CollectionListModel(@NotNull T... items) {
|
||||
myItems = ContainerUtilRt.newArrayList(items);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ abstract public class TransferableList<T> implements Transferable {
|
||||
|
||||
private final List<T> myList;
|
||||
|
||||
public TransferableList(T... array) {
|
||||
@SafeVarargs
|
||||
public TransferableList(@NotNull T... array) {
|
||||
this(Arrays.asList(array));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.openapi.editor.impl.softwrap.mapping;
|
||||
|
||||
import com.intellij.openapi.editor.impl.softwrap.mapping.DataProvider;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -46,6 +45,7 @@ public class CompositeDataProvider {
|
||||
*
|
||||
* @param providers providers to register within the current composite provider
|
||||
*/
|
||||
@SafeVarargs
|
||||
public CompositeDataProvider(@NotNull DataProvider<? extends Comparable<?>, ?> ... providers) {
|
||||
// We assume here that given array ownership belongs to the current object now.
|
||||
for (int i = 0; i < providers.length; i++) {
|
||||
|
||||
+1
@@ -75,6 +75,7 @@ public class AnsiEscapeDecoderTest extends PlatformTestCase {
|
||||
return ContainerUtil.map(list, pair -> Pair.create(pair.first, pair.second.toString()));
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
private static AnsiEscapeDecoder.ColoredChunksAcceptor createExpectedAcceptor(@NotNull final Pair<String, Key>... expected) {
|
||||
return new AnsiEscapeDecoder.ColoredChunksAcceptor() {
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.history.core.tree.RootEntry;
|
||||
import com.intellij.history.integration.TestVirtualFile;
|
||||
import com.intellij.openapi.util.Clock;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.FSRecords;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -142,11 +143,13 @@ public abstract class LocalHistoryTestCase extends Assert {
|
||||
return v.getChanges();
|
||||
}
|
||||
|
||||
public static <T> T[] array(T... objects) {
|
||||
@SafeVarargs
|
||||
public static <T> T[] array(@NotNull T... objects) {
|
||||
return objects;
|
||||
}
|
||||
|
||||
public static <T> List<T> list(T... objects) {
|
||||
@SafeVarargs
|
||||
public static <T> List<T> list(@NotNull T... objects) {
|
||||
return Arrays.asList(objects);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -341,8 +341,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
InspectionsKt.enableInspectionTools(getProject(), getTestRootDisposable(), inspections);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@Override
|
||||
public void enableInspections(@NotNull final Class<? extends LocalInspectionTool>... inspections) {
|
||||
public final void enableInspections(@NotNull final Class<? extends LocalInspectionTool>... inspections) {
|
||||
enableInspections(Arrays.asList(inspections));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<item name="com.intellij.util.containers.ContainerUtil java.util.ArrayList<E> newArrayList(E...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.util.containers.ContainerUtil java.lang.Iterable<T> concat(java.lang.Iterable<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.util.containers.ContainerUtil java.util.List<T> concat(java.util.List<? extends T>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.util.containers.ContainerUtil java.util.List<T> list(T...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
<item name="com.intellij.util.containers.ContainerUtil java.util.Map<K, V> newHashMap(com.intellij.openapi.util.Pair<K, ? extends V>, com.intellij.openapi.util.Pair<K, ? extends V>...)">
|
||||
<annotation name="java.lang.SafeVarargs" />
|
||||
</item>
|
||||
</root>
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.util;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -63,7 +64,8 @@ public class ArrayUtilTest extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> void assertEqualsArray(T[] actual, T... expected) {
|
||||
@SafeVarargs
|
||||
private static <T> void assertEqualsArray(T[] actual, @NotNull T... expected) {
|
||||
assertEquals(expected.length, actual.length);
|
||||
for (int i = 0; i < actual.length; i++) {
|
||||
assertEquals(expected[i], actual[i]);
|
||||
|
||||
+2
@@ -170,6 +170,7 @@ public abstract class BaseInspection extends BaseJavaBatchLocalInspectionTool {
|
||||
return valueField;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public static void parseString(String string, List<String>... outs) {
|
||||
final List<String> strings = StringUtil.split(string, ",");
|
||||
for (List<String> out : outs) {
|
||||
@@ -189,6 +190,7 @@ public abstract class BaseInspection extends BaseJavaBatchLocalInspectionTool {
|
||||
}
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public static String formatString(List<String>... strings) {
|
||||
final StringBuilder buffer = new StringBuilder();
|
||||
final int size = strings[0].size();
|
||||
|
||||
+1
@@ -253,6 +253,7 @@ public class IfCanBeSwitchInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@Nullable
|
||||
public static <T extends PsiElement> T getPrevSiblingOfType(@Nullable PsiElement element, @NotNull Class<T> aClass,
|
||||
@NotNull Class<? extends PsiElement>... stopAt) {
|
||||
|
||||
+2
-1
@@ -185,8 +185,9 @@ public class InconsistentResourceBundleInspection extends GlobalSimpleInspection
|
||||
return ContainerUtil.getOrElse(mySettings, providerName, true);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@TestOnly
|
||||
public void enableProviders(final Class<? extends InconsistentResourceBundleInspectionProvider>... providerClasses) {
|
||||
public final void enableProviders(final Class<? extends InconsistentResourceBundleInspectionProvider>... providerClasses) {
|
||||
Set<Class<? extends InconsistentResourceBundleInspectionProvider>> providersToEnable = ContainerUtil.newHashSet(providerClasses);
|
||||
for (InconsistentResourceBundleInspectionProvider inspectionProvider : myInspectionProviders.getValue()) {
|
||||
if (providersToEnable.contains(inspectionProvider.getClass())) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public abstract class BasicDomElementsInspection<T extends DomElement> extends DomElementsInspection<T> {
|
||||
|
||||
@SafeVarargs
|
||||
public BasicDomElementsInspection(@NotNull Class<? extends T> domClass, Class<? extends T>... additionalClasses) {
|
||||
super(domClass, additionalClasses);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user