*/
public class UnicodeCharacterNames {
- public static void iterate(Consumer<String> consumer) {
+ public static void iterate(Consumer<? super String> consumer) {
try {
final Class<?> aClass = Class.forName("java.lang.CharacterName");
final Method initNamePool = ReflectionUtil.getDeclaredMethod(aClass, "initNamePool");
popup.showCenteredInCurrentWindow(project);
}
- private static void doBuild(@NotNull Project project, final @NotNull List<ArtifactPopupItem> items, boolean rebuild) {
+ private static void doBuild(@NotNull Project project, final @NotNull List<? extends ArtifactPopupItem> items, boolean rebuild) {
final Artifact[] artifacts = getArtifacts(items, project);
if (rebuild) {
ProjectTaskManager.getInstance(project).rebuild(artifacts);
}
}
- private static Artifact[] getArtifacts(final List<ArtifactPopupItem> items, final Project project) {
+ private static Artifact[] getArtifacts(final List<? extends ArtifactPopupItem> items, final Project project) {
Set<Artifact> artifacts = new LinkedHashSet<>();
for (ArtifactPopupItem item : items) {
artifacts.addAll(item.getArtifacts(project));
myPackIntoArchives = packIntoArchives;
}
- public static void startPackagingFiles(Project project, List<VirtualFile> files, Artifact[] artifacts, final @NotNull Runnable onFinishedInAwt) {
+ public static void startPackagingFiles(Project project, List<? extends VirtualFile> files, Artifact[] artifacts, final @NotNull Runnable onFinishedInAwt) {
startPackagingFiles(project, files, artifacts, true).doWhenProcessed(
() -> ApplicationManager.getApplication().invokeLater(onFinishedInAwt));
}
- public static ActionCallback startPackagingFiles(final Project project, final List<VirtualFile> files,
+ public static ActionCallback startPackagingFiles(final Project project, final List<? extends VirtualFile> files,
final Artifact[] artifacts, final boolean packIntoArchives) {
final ActionCallback callback = new ActionCallback();
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Packaging Files") {
return isFiltered(qName, Arrays.asList(classFilters));
}
- public static boolean isFiltered(@NotNull String qName, List<ClassFilter> classFilters) {
+ public static boolean isFiltered(@NotNull String qName, List<? extends ClassFilter> classFilters) {
if (qName.indexOf('[') != -1) {
return false; //is array
}
return (int)Arrays.stream(classFilters).filter(ClassFilter::isEnabled).count();
}
- public static ClassFilter[] readFilters(List<Element> children) {
+ public static ClassFilter[] readFilters(List<? extends Element> children) {
if (ContainerUtil.isEmpty(children)) {
return ClassFilter.EMPTY_ARRAY;
}
return f2.equals(f1);
}
- private static boolean elementListsEqual(List<Element> l1, List<Element> l2) {
+ private static boolean elementListsEqual(List<? extends Element> l1, List<? extends Element> l2) {
if (l1 == null) return l2 == null;
if (l2 == null) return false;
if (l1.size() != l2.size()) return false;
- Iterator<Element> i1 = l1.iterator();
+ Iterator<? extends Element> i1 = l1.iterator();
for (Element aL2 : l2) {
Element elem1 = i1.next();
return true;
}
- private static boolean attributeListsEqual(List<Attribute> l1, List<Attribute> l2) {
+ private static boolean attributeListsEqual(List<? extends Attribute> l1, List<? extends Attribute> l2) {
if (l1 == null) return l2 == null;
if (l2 == null) return false;
if (l1.size() != l2.size()) return false;
- Iterator<Attribute> i1 = l1.iterator();
+ Iterator<? extends Attribute> i1 = l1.iterator();
for (Attribute aL2 : l2) {
Attribute attr1 = i1.next();
}
}
- public static String getSourceName(Location location, Function<Throwable, String> defaultName) {
+ public static String getSourceName(Location location, Function<? super Throwable, String> defaultName) {
try {
return location.sourceName();
}
return Boolean.TRUE.equals(debugProcess.getUserData(BatchEvaluator.REMOTE_SESSION_KEY));
}
- public static <T, E extends Exception> T suppressExceptions(ThrowableComputable<T, E> supplier, T defaultValue) throws E {
+ public static <T, E extends Exception> T suppressExceptions(ThrowableComputable<? extends T, ? extends E> supplier, T defaultValue) throws E {
return suppressExceptions(supplier, defaultValue, true, null);
}
- public static <T, E extends Exception> T suppressExceptions(ThrowableComputable<T, E> supplier,
+ public static <T, E extends Exception> T suppressExceptions(ThrowableComputable<? extends T, ? extends E> supplier,
T defaultValue,
boolean ignorePCE,
Class<E> rethrow) throws E {
}
}
- public static Map<DebuggerSession, Map<String, HotSwapFile>> findModifiedClasses(List<DebuggerSession> sessions, Map<String, List<String>> generatedPaths) {
+ public static Map<DebuggerSession, Map<String, HotSwapFile>> findModifiedClasses(List<? extends DebuggerSession> sessions, Map<String, List<String>> generatedPaths) {
final Map<DebuggerSession, Map<String, HotSwapFile>> result = new HashMap<>();
List<Pair<DebuggerSession, Long>> sessionWithStamps = new ArrayList<>();
for (DebuggerSession session : sessions) {
}
- public static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClasses(final List<DebuggerSession> sessions,
+ public static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClasses(final List<? extends DebuggerSession> sessions,
final HotSwapProgress swapProgress) {
final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses = new HashMap<>();
public class JavaTypeInfo implements TypeInfo {
private final ReferenceType referenceType;
- public static List<TypeInfo> wrap(List<ReferenceType> types) {
+ public static List<TypeInfo> wrap(List<? extends ReferenceType> types) {
return types.stream().map(JavaTypeInfo::new).collect(Collectors.toList());
}
EventRequest request,
PsiElement context,
TextWithImports text,
- EvaluatingComputable<ExpressionEvaluator> supplier) throws EvaluateException {
+ EvaluatingComputable<? extends ExpressionEvaluator> supplier) throws EvaluateException {
EvaluatorCache cache = (EvaluatorCache)request.getProperty(propertyName);
if (cache != null && Objects.equals(cache.myContext, context) && Objects.equals(cache.myTextWithImports, text)) {
return cache.myEvaluator;
protected static boolean canPutAtElement(@NotNull final VirtualFile file,
final int line,
@NotNull Project project,
- @NotNull PairFunction<PsiElement, Document, Boolean> processor) {
+ @NotNull PairFunction<? super PsiElement, ? super Document, Boolean> processor) {
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
// JSPX supports jvm debugging, but not in XHTML files
if (psiFile == null || psiFile.getViewProvider().getFileType() == StdFileTypes.XHTML) {
@Nullable
public static ExpressionEvaluator create(@NotNull Project project,
@Nullable PsiElement psiContext,
- @NotNull Function<PsiElement, PsiCodeFragment> fragmentFactory)
+ @NotNull Function<? super PsiElement, ? extends PsiCodeFragment> fragmentFactory)
throws EvaluateException {
if (Registry.is("debugger.compiling.evaluator") && psiContext != null) {
return ApplicationManager.getApplication().runReadAction((ThrowableComputable<ExpressionEvaluator, EvaluateException>)() -> {
public static String[] collectClassFQNames(String packageName,
@Nullable Path rootPath,
JavaTestConfigurationBase configuration,
- Function<ClassLoader, Predicate<Class<?>>> predicateProducer) {
+ Function<? super ClassLoader, ? extends Predicate<Class<?>>> predicateProducer) {
Module module = configuration.getConfigurationModule().getModule();
ClassLoader classLoader = createUsersClassLoader(configuration);
Set<String> classes = new HashSet<>();
}
@NotNull
- private static <T> MultiMap<String, String> request(List<T> collection, Function<T, String> toString, String what) throws IOException {
+ private static <T> MultiMap<String, String> request(List<T> collection, Function<? super T, String> toString, String what) throws IOException {
if (collection.isEmpty()) return MultiMap.empty();
String url = INTELLIJ_TEST_DISCOVERY_HOST + "/search/tests/by-" + what;
LOG.debug(url);
return new MyRunProfile(testMethods, module, configuration, configurationName);
}
- public static Module detectTargetModule(Collection<Module> survivedModules, Project project) {
+ public static Module detectTargetModule(Collection<? extends Module> survivedModules, Project project) {
ModuleManager moduleManager = ModuleManager.getInstance(project);
final Set<Module> allModules = new HashSet<>(Arrays.asList(moduleManager.getModules()));
survivedModules
}
private static void collectPatterns(@NotNull Project project,
- @NotNull Set<String> patterns,
+ @NotNull Set<? super String> patterns,
@NotNull String classFQName,
@NotNull String methodName,
byte frameworkId) {
private static void runAllDiscoveredTests(@NotNull Project project,
@NotNull DiscoveredTestsTree tree,
- @NotNull Ref<JBPopup> ref,
+ @NotNull Ref<? extends JBPopup> ref,
@NotNull ConfigurationContext context,
@NotNull String title) {
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
}
@NotNull
- public static List<String> getRelativeAffectedPaths(@NotNull Project project, @NotNull Collection<Change> changes) {
+ public static List<String> getRelativeAffectedPaths(@NotNull Project project, @NotNull Collection<? extends Change> changes) {
VirtualFile baseDir = getBasePathAsVirtualFile(project);
return baseDir == null ?
Collections.emptyList() :
}
@Nullable
- public static FrameworkSupportInModuleProvider findProvider(@NotNull String id, final List<FrameworkSupportInModuleProvider> providers) {
+ public static FrameworkSupportInModuleProvider findProvider(@NotNull String id, final List<? extends FrameworkSupportInModuleProvider> providers) {
for (FrameworkSupportInModuleProvider provider : providers) {
String frameworkId = provider.getFrameworkType().getId();
if (id.equals(frameworkId)
}
public static Collection<LibraryDescriptor> getLibraryDependencies(ModuleDescriptor module,
- @Nullable List<LibraryDescriptor> allLibraries) {
+ @Nullable List<? extends LibraryDescriptor> allLibraries) {
final Set<LibraryDescriptor> libs = new HashSet<>();
if (allLibraries != null) {
for (LibraryDescriptor library : allLibraries) {
}
- private static List<LibraryDescriptor> buildInitialLibrariesLayout(final Set<File> jars) {
+ private static List<LibraryDescriptor> buildInitialLibrariesLayout(final Set<? extends File> jars) {
final Map<File, LibraryDescriptor> rootToLibraryMap = new HashMap<>();
for (File jar : jars) {
final File parent = jar.getParentFile();
}
}
- public static MultiMap<ProjectStructureDetector, DetectedProjectRoot> createRootsMap(List<DetectedRootData> list) {
+ public static MultiMap<ProjectStructureDetector, DetectedProjectRoot> createRootsMap(List<? extends DetectedRootData> list) {
MultiMap<ProjectStructureDetector, DetectedProjectRoot> roots = new MultiMap<>();
for (final DetectedRootData rootData : list) {
for (ProjectStructureDetector detector : rootData.getSelectedDetectors()) {
}
@Nullable
- protected static Library getLibraryFromOrderEntriesList(List<LibraryOrderEntry> orderEntries) {
+ protected static Library getLibraryFromOrderEntriesList(List<? extends LibraryOrderEntry> orderEntries) {
if (orderEntries.isEmpty()) return null;
Library library = orderEntries.get(0).getLibrary();
}
}
- public static Condition<Sdk> getSdkFilter(@Nullable final Condition<SdkTypeId> filter) {
+ public static Condition<Sdk> getSdkFilter(@Nullable final Condition<? super SdkTypeId> filter) {
return filter == null ? Conditions.alwaysTrue() : sdk -> filter.value(sdk.getSdkType());
}
myArtifactEditor.addNewPackagingElement(myElementType);
}
- public static void addCompositeCreateActions(List<AnAction> actions, final ArtifactEditorEx artifactEditor) {
+ public static void addCompositeCreateActions(List<? super AnAction> actions, final ArtifactEditorEx artifactEditor) {
for (CompositePackagingElementType packagingElementType : PackagingElementFactory.getInstance().getCompositeElementTypes()) {
actions.add(new AddCompositeElementAction(artifactEditor, packagingElementType));
}
}
public static void addNodes(@NotNull List<? extends PackagingElement<?>> elements, @NotNull CompositePackagingElementNode parentNode,
- @NotNull CompositePackagingElement parentElement, @NotNull ArtifactEditorContext context,
- @NotNull ComplexElementSubstitutionParameters substitutionParameters, @NotNull Collection<PackagingNodeSource> nodeSources,
- @NotNull List<PackagingElementNode<?>> nodes,
- ArtifactType artifactType,
- Set<PackagingElement<?>> processed) {
+ @NotNull CompositePackagingElement parentElement, @NotNull ArtifactEditorContext context,
+ @NotNull ComplexElementSubstitutionParameters substitutionParameters, @NotNull Collection<PackagingNodeSource> nodeSources,
+ @NotNull List<PackagingElementNode<?>> nodes,
+ ArtifactType artifactType,
+ Set<? super PackagingElement<?>> processed) {
for (PackagingElement<?> element : elements) {
final PackagingElementNode<?> prev = findEqual(nodes, element);
if (prev != null) {
}
@Nullable
- private static PackagingElementNode<?> findEqual(List<PackagingElementNode<?>> children, PackagingElement<?> element) {
+ private static PackagingElementNode<?> findEqual(List<? extends PackagingElementNode<?>> children, PackagingElement<?> element) {
for (PackagingElementNode<?> node : children) {
if (node.getFirstElement().isEqualTo(element)) {
return node;
return result;
}
- private static void collectDependentModules(final Module module, Set<Module> modules, ArtifactEditorContext context) {
+ private static void collectDependentModules(final Module module, Set<? super Module> modules, ArtifactEditorContext context) {
if (!modules.add(module)) return;
for (OrderEntry entry : context.getModulesProvider().getRootModel(module).getOrderEntries()) {
public static AddCustomLibraryDialog createDialog(@NotNull CustomLibraryDescription description,
final @NotNull Module module,
- final ParameterizedRunnable<ModifiableRootModel> beforeLibraryAdded) {
+ final ParameterizedRunnable<? super ModifiableRootModel> beforeLibraryAdded) {
return createDialog(description, LibrariesContainerFactory.createContainer(module), module, null, beforeLibraryAdded);
}
public static AddCustomLibraryDialog createDialog(CustomLibraryDescription description,
final @NotNull LibrariesContainer librariesContainer, final @NotNull Module module,
final @Nullable ModifiableRootModel modifiableRootModel,
- @Nullable ParameterizedRunnable<ModifiableRootModel> beforeLibraryAdded) {
+ @Nullable ParameterizedRunnable<? super ModifiableRootModel> beforeLibraryAdded) {
return new AddCustomLibraryDialog(description, librariesContainer, module, modifiableRootModel, beforeLibraryAdded);
}
@NotNull PsiMember member,
@NotNull ProgressIndicator progress,
@Nullable PsiFile ignoreFile,
- @NotNull Processor<UsageInfo> usageInfoProcessor) {
+ @NotNull Processor<? super UsageInfo> usageInfoProcessor) {
String name = member.getName();
if (name == null) {
log("* "+member.getName()+" no name; false");
return usedStatus == Boolean.TRUE;
}
- private static boolean isParameterUsedRecursively(@NotNull PsiElement element, @NotNull Collection<PsiReference> array) {
+ private static boolean isParameterUsedRecursively(@NotNull PsiElement element, @NotNull Collection<? extends PsiReference> array) {
if (!(element instanceof PsiParameter)) return false;
PsiParameter parameter = (PsiParameter)element;
PsiElement scope = parameter.getDeclarationScope();
}
}
- private static void processLiterals(@NotNull final Set<PsiLiteralExpression> literals,
+ private static void processLiterals(@NotNull final Set<? extends PsiLiteralExpression> literals,
@NotNull final PsiCall call,
@NotNull final HighlightInfo info) {
for (PsiLiteralExpression literal : literals) {
abstract class PResults {
// SoP = sum of products
- static Set<Set<EKey>> join(Set<Set<EKey>> sop1, Set<Set<EKey>> sop2) {
+ static Set<Set<EKey>> join(Set<? extends Set<EKey>> sop1, Set<? extends Set<EKey>> sop2) {
Set<Set<EKey>> sop = new HashSet<>();
sop.addAll(sop1);
sop.addAll(sop2);
return sop;
}
- static Set<Set<EKey>> meet(Set<Set<EKey>> sop1, Set<Set<EKey>> sop2) {
+ static Set<Set<EKey>> meet(Set<? extends Set<EKey>> sop1, Set<? extends Set<EKey>> sop2) {
Set<Set<EKey>> sop = new HashSet<>();
for (Set<EKey> prod1 : sop1) {
for (Set<EKey> prod2 : sop2) {
sop.add(prod);
}
- static void checkLimit(Set<Set<EKey>> sop) throws AnalyzerException {
+ static void checkLimit(Set<? extends Set<EKey>> sop) throws AnalyzerException {
int size = sop.stream().mapToInt(Set::size).sum();
if (size > Analysis.EQUATION_SIZE_LIMIT) {
throw new AnalyzerException(null, "HEquation size is too big");
import static com.intellij.util.ObjectUtils.tryCast;
class InlinerUtil {
- static boolean isLambdaChainParameterReference(PsiExpression expression, Predicate<PsiType> chainTypePredicate) {
+ static boolean isLambdaChainParameterReference(PsiExpression expression, Predicate<? super PsiType> chainTypePredicate) {
if(!(expression instanceof PsiReferenceExpression)) return false;
PsiParameter target = tryCast(((PsiReferenceExpression)expression).resolve(), PsiParameter.class);
if (target == null) return false;
return myRefModule;
}
- private static boolean isSelfInheritor(UClass uClass, List<UClass> visited) {
+ private static boolean isSelfInheritor(UClass uClass, List<? super UClass> visited) {
if (visited.contains(uClass)) return true;
visited.add(uClass);
if (uClass.getUastSuperTypes().stream()
*/
}
- public static void createAddToSpecialAnnotationFixes(@NotNull PsiModifierListOwner owner, @NotNull Processor<String> processor) {
+ public static void createAddToSpecialAnnotationFixes(@NotNull PsiModifierListOwner owner, @NotNull Processor<? super String> processor) {
final PsiModifierList modifierList = owner.getModifierList();
if (modifierList != null) {
final PsiAnnotation[] psiAnnotations = modifierList.getAnnotations();
public static boolean processElementUsages(@NotNull final PsiElement element,
@NotNull final FindUsagesOptions options,
- @NotNull final Processor<UsageInfo> processor) {
+ @NotNull final Processor<? super UsageInfo> processor) {
if (options instanceof JavaVariableFindUsagesOptions) {
final JavaVariableFindUsagesOptions varOptions = (JavaVariableFindUsagesOptions) options;
if (varOptions.isReadAccess || varOptions.isWriteAccess){
final PsiElement context,
boolean getRawSubtypes,
@NotNull final PrefixMatcher matcher,
- Consumer<PsiType> consumer) {
+ Consumer<? super PsiType> consumer) {
int arrayDim = psiType.getArrayDimensions();
psiType = psiType.getDeepComponentType();
PsiClassType baseType,
int arrayDim,
boolean getRawSubtypes,
- Consumer<PsiType> result,
+ Consumer<? super PsiType> result,
@NotNull PsiClass baseClass,
PsiSubstitutor baseSubstitutor) {
PsiManager manager = context.getManager();
public static void processJavaClasses(@NotNull final CompletionParameters parameters,
@NotNull final PrefixMatcher prefixMatcher,
final boolean filterByScope,
- @NotNull final Consumer<PsiClass> consumer) {
+ @NotNull final Consumer<? super PsiClass> consumer) {
final PsiElement context = parameters.getPosition();
final Project project = context.getProject();
final GlobalSearchScope scope = filterByScope ? context.getContainingFile().getResolveScope() : GlobalSearchScope.allScope(project);
public static void processJavaClasses(@NotNull final PrefixMatcher prefixMatcher,
@NotNull Project project,
@NotNull GlobalSearchScope scope,
- @NotNull Processor<PsiClass> processor) {
+ @NotNull Processor<? super PsiClass> processor) {
final Set<String> names = new THashSet<>(10000);
AllClassesSearchExecutor.processClassNames(project, scope, s -> {
if (prefixMatcher.prefixMatches(s)) {
}
public static void fillCompletionVariants(JavaSmartCompletionParameters parameters,
- final Consumer<LookupElement> result,
+ final Consumer<? super LookupElement> result,
PrefixMatcher matcher) {
final PsiElement element = parameters.getPosition();
if (JavaKeywordCompletion.isAfterTypeDot(element)) {
public static void addAllClasses(@NotNull CompletionParameters parameters,
final boolean filterByScope,
@NotNull final PrefixMatcher matcher,
- @NotNull final Consumer<LookupElement> consumer) {
+ @NotNull final Consumer<? super LookupElement> consumer) {
final PsiElement insertedElement = parameters.getPosition();
if (JavaCompletionContributor.ANNOTATION_NAME.accepts(insertedElement)) {
public static void processInheritors(final CompletionParameters parameters,
Collection<? extends PsiClassType> expectedClassTypes,
- final PrefixMatcher matcher, final Consumer<PsiType> consumer) {
+ final PrefixMatcher matcher, final Consumer<? super PsiType> consumer) {
final PsiElement context = parameters.getPosition();
GlobalSearchScope scope = context.getResolveScope();
expectedClassTypes = ContainerUtil.mapNotNull(expectedClassTypes, type ->
private static boolean processMostProbableInheritors(PsiFile contextFile,
PsiElement context,
Collection<? extends PsiClassType> expectedClassTypes,
- Consumer<PsiType> consumer) {
+ Consumer<? super PsiType> consumer) {
for (final PsiClassType type : expectedClassTypes) {
consumer.consume(type);
}
@NotNull
- private static Consumer<LookupElement> decorateWithoutTypeCheck(final CompletionResultSet result, final Collection<ExpectedTypeInfo> infos) {
+ private static Consumer<LookupElement> decorateWithoutTypeCheck(final CompletionResultSet result, final Collection<? extends ExpectedTypeInfo> infos) {
return lookupElement -> result.addElement(decorate(lookupElement, infos));
}
private static void addExpectedTypeMembers(CompletionParameters params,
- THashSet<ExpectedTypeInfo> mergedInfos,
+ THashSet<? extends ExpectedTypeInfo> mergedInfos,
boolean quick,
Consumer<LookupElement> consumer) {
PsiElement position = params.getPosition();
super.fillCompletionVariants(parameters, JavaCompletionSorting.addJavaSorting(parameters, result));
}
- public static SmartCompletionDecorator decorate(LookupElement lookupElement, Collection<ExpectedTypeInfo> infos) {
+ public static SmartCompletionDecorator decorate(LookupElement lookupElement, Collection<? extends ExpectedTypeInfo> infos) {
return new SmartCompletionDecorator(lookupElement, infos);
}
return isInNamedElement || element.getTextRange().contains(offset-1);
}
- public static void addClassesWithMember(final String memberName, final PsiFile file, final Set<String> possibleClassNames, final boolean method,
+ public static void addClassesWithMember(final String memberName, final PsiFile file, final Set<? super String> possibleClassNames, final boolean method,
final boolean staticAccess) {
addClassesWithMember(memberName, file, possibleClassNames, method, staticAccess, true);
}
return method;
}
- public static void doCreate(PsiClass targetClass, PsiMethod method, List<Pair<PsiExpression, PsiType>> arguments, PsiSubstitutor substitutor,
+ public static void doCreate(PsiClass targetClass, PsiMethod method, List<? extends Pair<PsiExpression, PsiType>> arguments, PsiSubstitutor substitutor,
ExpectedTypeInfo[] expectedTypes, @Nullable PsiElement context) {
doCreate(targetClass, method, shouldBeAbstractImpl(null, targetClass), arguments, substitutor, expectedTypes, context);
}
@Nullable
public static JavaOverrideImplementMemberChooser create(final PsiElement aClass,
final boolean toImplement,
- final Collection<CandidateInfo> candidates,
- final Collection<CandidateInfo> secondary) {
+ final Collection<? extends CandidateInfo> candidates,
+ final Collection<? extends CandidateInfo> secondary) {
final Project project = aClass.getProject();
final PsiFile file = aClass.getContainingFile();
if (candidates.isEmpty() && secondary.isEmpty()) return null;
: CodeInsightBundle.message("methods.to.override.chooser.title");
}
- private static PsiMethodMember[] convertToMethodMembers(Collection<CandidateInfo> candidates) {
+ private static PsiMethodMember[] convertToMethodMembers(Collection<? extends CandidateInfo> candidates) {
return ContainerUtil.map2Array(candidates, PsiMethodMember.class, s -> new PsiMethodMember(s));
}
@NotNull
public static List<PsiGenerationInfo<PsiMethod>> overrideOrImplementMethods(@NotNull PsiClass aClass,
- @NotNull Collection<PsiMethodMember> candidates,
+ @NotNull Collection<? extends PsiMethodMember> candidates,
boolean toCopyJavaDoc,
boolean toInsertAtOverride)
throws IncorrectOperationException {
}
@NotNull
- public static List<PsiGenerationInfo<PsiMethod>> convert2GenerationInfos(@NotNull Collection<PsiMethod> methods) {
+ public static List<PsiGenerationInfo<PsiMethod>> convert2GenerationInfos(@NotNull Collection<? extends PsiMethod> methods) {
return ContainerUtil.map2List(methods, s -> createGenerationInfo(s));
}
}
public static boolean addAnnotationsDependency(@NotNull final Project project,
- @NotNull final Set<Module> modulesWithoutAnnotations,
+ @NotNull final Set<? extends Module> modulesWithoutAnnotations,
@NotNull String annoFQN, final String title) {
final Library annotationsLib = LibraryUtil.findLibraryByClass(annoFQN, project);
if (annotationsLib != null) {
* @return list of declaration statements or null if error
*/
@Nullable("when failed to get declaration of any var")
- static List<PsiDeclarationStatement> getDeclarations(@NotNull List<PsiLocalVariable> variables) {
+ static List<PsiDeclarationStatement> getDeclarations(@NotNull List<? extends PsiLocalVariable> variables) {
List<PsiDeclarationStatement> list = new ArrayList<>();
for (PsiLocalVariable var : variables) {
PsiDeclarationStatement declarationStatement = PsiTreeUtil.getParentOfType(var, PsiDeclarationStatement.class);
@Contract("null -> null")
@Nullable
- static TerminalOperation getTerminal(List<OperationRecord> operations) {
+ static TerminalOperation getTerminal(List<? extends OperationRecord> operations) {
if (operations == null || operations.isEmpty()) return null;
OperationRecord record = operations.get(operations.size()-1);
if(record.myOperation instanceof TerminalOperation) {
return false;
}
- private static PsiDirectory getWritableModuleDirectory(@NotNull Query<VirtualFile> vFiles, @NotNull Module module, PsiManager manager) {
+ private static PsiDirectory getWritableModuleDirectory(@NotNull Query<? extends VirtualFile> vFiles, @NotNull Module module, PsiManager manager) {
for (VirtualFile vFile : vFiles) {
if (ModuleUtil.findModuleForFile(vFile, module.getProject()) != module) continue;
PsiDirectory directory = manager.findDirectory(vFile);
public static void checkSuperMethod(@NotNull PsiMethod method,
@NotNull String actionString,
- @NotNull final PsiElementProcessor<PsiMethod> processor,
+ @NotNull final PsiElementProcessor<? super PsiMethod> processor,
@NotNull Editor editor) {
ApplicationManager.getApplication().assertIsDispatchThread();
PsiClass aClass = method.getContainingClass();
public class ClassLiteralGetter {
public static void addCompletions(@NotNull final JavaSmartCompletionParameters parameters,
- @NotNull Consumer<LookupElement> result, final PrefixMatcher matcher) {
+ @NotNull Consumer<? super LookupElement> result, final PrefixMatcher matcher) {
PsiType expectedType = parameters.getDefaultType();
if (!InheritanceUtil.isInheritor(expectedType, CommonClassNames.JAVA_LANG_CLASS)) {
expectedType = parameters.getExpectedType();
public static <Parent extends PsiElement, Child extends PsiElement> void synchronizeList(
Parent list,
- List<Child> newElements,
+ List<? extends Child> newElements,
ChildrenGenerator<Parent, Child> generator,
boolean[] shouldRemoveChild) throws IncorrectOperationException
{
private static boolean checkUnableToInsertCodeBlock(final PsiCodeBlock methodBody,
final PsiElement element,
- final Predicate<PsiMethodCallExpression> errorCondition) {
+ final Predicate<? super PsiMethodCallExpression> errorCondition) {
PsiStatement[] statements = methodBody.getStatements();
if (statements.length > 1 || statements.length == 1 && !(statements[0] instanceof PsiExpressionStatement)) {
PsiMethodCallExpression expr = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class, true, PsiStatement.class);
private static void processChainedCallsInSuper(PsiMethod superConstructorWithChain,
PsiClass targetClass,
- List<FixableUsageInfo> usages,
- Set<PsiMethod> addedSuperConstructors) {
+ List<? super FixableUsageInfo> usages,
+ Set<? super PsiMethod> addedSuperConstructors) {
addedSuperConstructors.add(superConstructorWithChain);
PsiMethod chainedConstructor = InlineUtil.getChainedConstructor(superConstructorWithChain);
while (chainedConstructor != null && addedSuperConstructors.add(chainedConstructor)) {
return myExpression == null;
}
- public static void processElementToWorkOn(final Editor editor, final PsiFile file, final String refactoringName, final String helpId, final Project project, final ElementsProcessor<ElementToWorkOn> processor) {
+ public static void processElementToWorkOn(final Editor editor, final PsiFile file, final String refactoringName, final String helpId, final Project project, final ElementsProcessor<? super ElementToWorkOn> processor) {
PsiLocalVariable localVar = null;
PsiExpression expr = null;
public class Util {
public static void analyzeExpression(PsiExpression expr,
- List<UsageInfo> localVars,
- List<UsageInfo> classMemberRefs,
- List<UsageInfo> params) {
+ List<? super UsageInfo> localVars,
+ List<? super UsageInfo> classMemberRefs,
+ List<? super UsageInfo> params) {
if (expr instanceof PsiThisExpression || expr instanceof PsiSuperExpression) {
classMemberRefs.add(new ClassMemberInExprUsageInfo(expr));
return PsiTreeUtil.isAncestor(getPhysical(ancestor), getPhysical(element), strict);
}
- public static boolean anyFieldsWithGettersPresent(List<UsageInfo> classMemberRefs) {
+ public static boolean anyFieldsWithGettersPresent(List<? extends UsageInfo> classMemberRefs) {
for (UsageInfo usageInfo : classMemberRefs) {
if (usageInfo.getElement() instanceof PsiReferenceExpression) {
}
}
- public static boolean isChooserNeeded(List<PsiExpression> exprs) {
+ public static boolean isChooserNeeded(List<? extends PsiExpression> exprs) {
if (exprs.size() == 1) {
final PsiExpression expression = exprs.get(0);
return expression instanceof PsiNewExpression && ((PsiNewExpression)expression).getAnonymousClass() != null;
isPreferStatements();
}
- public static int preferredSelection(PsiElement[] statementsInRange, List<PsiExpression> expressions) {
+ public static int preferredSelection(PsiElement[] statementsInRange, List<? extends PsiExpression> expressions) {
int selection;
if (statementsInRange.length == 1 &&
statementsInRange[0] instanceof PsiExpressionStatement &&
return findClassRefsInMember(member, false).length > 0;
}
- private static void addClassRefs(PsiTypeParameterListOwner originalMember, ArrayList<InternalUsageInfo> classRefs,
+ private static void addClassRefs(PsiTypeParameterListOwner originalMember, ArrayList<? super InternalUsageInfo> classRefs,
PsiClass containingClass, PsiElement element, boolean includeSelf) {
if (element instanceof PsiReferenceExpression) {
PsiReferenceExpression ref = (PsiReferenceExpression)element;
return false;
}
- public static boolean buildVariableData(PsiTypeParameterListOwner member, ArrayList<VariableData> result) {
+ public static boolean buildVariableData(PsiTypeParameterListOwner member, ArrayList<? super VariableData> result) {
final InternalUsageInfo[] classRefsInMethod = findClassRefsInMember(member, false);
return collectVariableData(member, classRefsInMethod, result);
}
public static boolean collectVariableData(PsiMember member, InternalUsageInfo[] internalUsages,
- ArrayList<VariableData> variableDatum) {
+ ArrayList<? super VariableData> variableDatum) {
HashSet<PsiField> reported = new HashSet<>();
HashSet<PsiField> accessedForWriting = new HashSet<>();
boolean needClassParameter = false;
return results.toArray(UsageInfo.EMPTY_ARRAY);
}
- static void doMigration(PsiElement elementToBind, String newQName, UsageInfo[] usages, ArrayList<SmartPsiElementPointer<PsiElement>> refsToShorten) {
+ static void doMigration(PsiElement elementToBind, String newQName, UsageInfo[] usages, ArrayList<? super SmartPsiElementPointer<PsiElement>> refsToShorten) {
try {
SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(elementToBind.getProject());
// rename all references
boolean searchInNonJavaFiles,
final PsiElement element,
final String newQName,
- ArrayList<UsageInfo> results) {
+ ArrayList<? super UsageInfo> results) {
final String stringToSearch = getStringToSearch(element);
if (stringToSearch == null) return;
TextOccurrencesUtil.findNonCodeUsages(element, stringToSearch, searchInStringsAndComments, searchInNonJavaFiles, newQName, results);
moveDirectoryRecursively(dir, destination, new HashSet<>());
}
- private static void moveDirectoryRecursively(PsiDirectory dir, PsiDirectory destination, HashSet<VirtualFile> movedPaths) throws IncorrectOperationException {
+ private static void moveDirectoryRecursively(PsiDirectory dir, PsiDirectory destination, HashSet<? super VirtualFile> movedPaths) throws IncorrectOperationException {
final VirtualFile destVFile = destination.getVirtualFile();
final VirtualFile sourceVFile = dir.getVirtualFile();
if (movedPaths.contains(sourceVFile)) return;
}
public static VirtualFile chooseSourceRoot(final PackageWrapper targetPackage,
- final List<VirtualFile> contentSourceRoots,
+ final List<? extends VirtualFile> contentSourceRoots,
final PsiDirectory initialDirectory) {
Project project = targetPackage.getManager().getProject();
//ensure that there would be no duplicates: e.g. when one content root is subfolder of another root (configured via excluded roots)
}
public static void buildDirectoryList(PackageWrapper aPackage,
- List<VirtualFile> contentSourceRoots,
- LinkedHashSet<PsiDirectory> targetDirectories,
+ List<? extends VirtualFile> contentSourceRoots,
+ LinkedHashSet<? super PsiDirectory> targetDirectories,
Map<PsiDirectory, String> relativePathsToCreate) {
final PsiDirectory[] directories = aPackage.getDirectories();
return sourceClasses.toArray(PsiClass.EMPTY_ARRAY);
}
- private static void findAvailableSuperClasses(PsiMethod method, List<PsiClass> sourceClasses){
+ private static void findAvailableSuperClasses(PsiMethod method, List<? super PsiClass> sourceClasses){
final PsiMethod[] superMethods = method.findSuperMethods(true);
for(PsiMethod superMethod : superMethods){
final PsiClass containingClass = superMethod.getContainingClass();
return out.toArray(PsiClass.EMPTY_ARRAY);
}
- private static void findNonLibrarySupers(PsiClass sourceClass, List<PsiClass> out){
+ private static void findNonLibrarySupers(PsiClass sourceClass, List<? super PsiClass> out){
final PsiClass[] supers = sourceClass.getSupers();
for(PsiClass psiClass : supers){
if(!(psiClass instanceof PsiCompiledElement) && !out.contains(psiClass))
private JavaUnresolvableLocalCollisionDetector() {
}
- public static void findCollisions(final PsiElement element, final String newName, final List<UsageInfo> result) {
+ public static void findCollisions(final PsiElement element, final String newName, final List<? super UsageInfo> result) {
if (!(element instanceof PsiLocalVariable || element instanceof PsiParameter)) {
return;
}
return ref;
}
- protected static void findMemberHidesOuterMemberCollisions(final PsiMember member, final String newName, final List<UsageInfo> result) {
+ protected static void findMemberHidesOuterMemberCollisions(final PsiMember member, final String newName, final List<? super UsageInfo> result) {
if (member instanceof PsiCompiledElement) return;
final PsiMember patternMember;
if (member instanceof PsiMethod) {
}
}
- protected static void qualifyOuterMemberReferences(final List<MemberHidesOuterMemberUsageInfo> outerHides) throws IncorrectOperationException {
+ protected static void qualifyOuterMemberReferences(final List<? extends MemberHidesOuterMemberUsageInfo> outerHides) throws IncorrectOperationException {
for (MemberHidesOuterMemberUsageInfo usage : outerHides) {
final PsiElement element = usage.getElement();
PsiJavaCodeReferenceElement collidingRef = (PsiJavaCodeReferenceElement)element;
return false;
}
- protected static void qualifyStaticImportReferences(final List<MemberHidesStaticImportUsageInfo> staticImportHides)
+ protected static void qualifyStaticImportReferences(final List<? extends MemberHidesStaticImportUsageInfo> staticImportHides)
throws IncorrectOperationException {
for (MemberHidesStaticImportUsageInfo info : staticImportHides) {
final PsiReference ref = info.getReference();
public class RefactoringConflictsUtil {
private RefactoringConflictsUtil() { }
- public static void analyzeAccessibilityConflicts(@NotNull Set<PsiMember> membersToMove,
+ public static void analyzeAccessibilityConflicts(@NotNull Set<? extends PsiMember> membersToMove,
@NotNull PsiClass targetClass,
@NotNull MultiMap<PsiElement, String> conflicts,
@Nullable String newVisibility) {
analyzeAccessibilityConflicts(membersToMove, targetClass, conflicts, newVisibility, targetClass, null);
}
- public static void analyzeAccessibilityConflicts(@NotNull Set<PsiMember> membersToMove,
+ public static void analyzeAccessibilityConflicts(@NotNull Set<? extends PsiMember> membersToMove,
@Nullable PsiClass targetClass,
@NotNull MultiMap<PsiElement, String> conflicts,
@Nullable String newVisibility,
@NotNull PsiElement context,
- @Nullable Set<PsiMethod> abstractMethods) {
+ @Nullable Set<? extends PsiMethod> abstractMethods) {
if (VisibilityUtil.ESCALATE_VISIBILITY.equals(newVisibility)) { //Still need to check for access object
newVisibility = PsiModifier.PUBLIC;
}
public static void checkUsedElements(PsiMember member,
PsiElement scope,
- @NotNull Set<PsiMember> membersToMove,
- @Nullable Set<PsiMethod> abstractMethods,
+ @NotNull Set<? extends PsiMember> membersToMove,
+ @Nullable Set<? extends PsiMethod> abstractMethods,
@Nullable PsiClass targetClass,
@NotNull PsiElement context,
MultiMap<PsiElement, String> conflicts) {
public static void checkUsedElements(PsiMember member,
PsiElement scope,
- @NotNull Set<PsiMember> membersToMove,
- @Nullable Set<PsiMethod> abstractMethods,
+ @NotNull Set<? extends PsiMember> membersToMove,
+ @Nullable Set<? extends PsiMethod> abstractMethods,
@Nullable PsiClass targetClass,
PsiClass accessClass,
@NotNull PsiElement context,
return result.toArray(PsiClass.EMPTY_ARRAY);
}
- private static void _findImplementingClasses(PsiClass anInterface, final Set<PsiClass> visited, final Collection<PsiClass> result) {
+ private static void _findImplementingClasses(PsiClass anInterface, final Set<? super PsiClass> visited, final Collection<? super PsiClass> result) {
LOG.assertTrue(anInterface.isInterface());
visited.add(anInterface);
ClassInheritorsSearch.search(anInterface, false).forEach(new PsiElementProcessorAdapter<>(new PsiElementProcessor<PsiClass>() {
}
public static void replaceMovedMemberTypeParameters(final PsiElement member,
- final Iterable<PsiTypeParameter> parametersIterable,
+ final Iterable<? extends PsiTypeParameter> parametersIterable,
final PsiSubstitutor substitutor,
final PsiElementFactory factory) {
final Map<PsiElement, PsiElement> replacement = new LinkedHashMap<>();
* @param initialRelation
* @return subset of graph.getVertices()
*/
- public static <T> Set<T> transitiveClosure(Graph<T> graph, Condition<T> initialRelation) {
+ public static <T> Set<T> transitiveClosure(Graph<T> graph, Condition<? super T> initialRelation) {
Set<T> result = new HashSet<>();
final Set<T> vertices = graph.getVertices();
return dataElements[0].getText();
}
- public static void fixJavadocsForParams(PsiMethod method, Set<PsiParameter> newParameters) throws IncorrectOperationException {
+ public static void fixJavadocsForParams(PsiMethod method, Set<? extends PsiParameter> newParameters) throws IncorrectOperationException {
fixJavadocsForParams(method, newParameters, Conditions.alwaysFalse());
}
public static void fixJavadocsForParams(PsiMethod method,
- Set<PsiParameter> newParameters,
- Condition<Pair<PsiParameter, String>> eqCondition) throws IncorrectOperationException {
+ Set<? extends PsiParameter> newParameters,
+ Condition<? super Pair<PsiParameter, String>> eqCondition) throws IncorrectOperationException {
fixJavadocsForParams(method, newParameters, eqCondition, Conditions.alwaysTrue());
}
public static void fixJavadocsForParams(PsiMethod method,
- Set<PsiParameter> newParameters,
- Condition<Pair<PsiParameter, String>> eqCondition,
- Condition<String> matchedToOldParam) throws IncorrectOperationException {
+ Set<? extends PsiParameter> newParameters,
+ Condition<? super Pair<PsiParameter, String>> eqCondition,
+ Condition<? super String> matchedToOldParam) throws IncorrectOperationException {
final PsiDocComment docComment = method.getDocComment();
if (docComment == null) return;
final PsiParameter[] parameters = method.getParameterList().getParameters();
@Nullable
public static PsiTypeParameterList createTypeParameterListWithUsedTypeParameters(@Nullable final PsiTypeParameterList fromList,
- Condition<PsiTypeParameter> filter,
+ Condition<? super PsiTypeParameter> filter,
@NotNull final PsiElement... elements) {
if (elements.length == 0) return null;
final Set<PsiTypeParameter> used = new HashSet<>();
invokeOnScope(project, Collections.singleton(member), scope, false);
}
- public static void invokeOnScope(final Project project, final Set<PsiMember> members, final AnalysisScope scope, boolean silent) {
+ public static void invokeOnScope(final Project project, final Set<? extends PsiMember> members, final AnalysisScope scope, boolean silent) {
final Map<PsiMember, List<Match>> duplicates = new HashMap<>();
final int fileCount = scope.getFileCount();
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
}
}
- public static void replaceDuplicate(final Project project, final Map<PsiMember, List<Match>> duplicates, final Set<PsiMember> methods) {
+ public static void replaceDuplicate(final Project project, final Map<PsiMember, List<Match>> duplicates, final Set<? extends PsiMember> methods) {
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
if (progressIndicator != null && progressIndicator.isCanceled()) return;
final PsiClass targetClass,
final PsiMethod method,
@Nullable String name,
- boolean automatic, Set<String> existingNames) {
+ boolean automatic, Set<? super String> existingNames) {
runTestMethodTemplate(methodKind, framework, editor, targetClass, null, method, name, automatic, existingNames);
}
final PsiMethod method,
@Nullable String name,
boolean automatic,
- Set<String> existingNames) {
+ Set<? super String> existingNames) {
runTestMethodTemplate(editor, targetClass, method, automatic,
createTestMethodTemplate(methodKind, framework, targetClass, sourceClass, name, automatic, existingNames));
}
@NotNull PsiClass targetClass,
@Nullable String name,
boolean automatic,
- Set<String> existingNames) {
+ Set<? super String> existingNames) {
return createTestMethodTemplate(methodKind, descriptor, targetClass, null, name, automatic, existingNames);
}
@Nullable PsiClass sourceClass,
@Nullable String name,
boolean automatic,
- Set<String> existingNames) {
+ Set<? super String> existingNames) {
FileTemplateDescriptor templateDesc = methodKind.getFileTemplateDescriptor(descriptor);
String templateName = templateDesc.getFileName();
FileTemplate fileTemplate = FileTemplateManager.getInstance(targetClass.getProject()).getCodeTemplate(templateName);
* @deprecated use {@link #computeTestRoots(Module)} instead
*/
@Deprecated
- protected static void checkForTestRoots(Module srcModule, Set<VirtualFile> testFolders) {
+ protected static void checkForTestRoots(Module srcModule, Set<? super VirtualFile> testFolders) {
testFolders.addAll(computeTestRoots(srcModule));
}
public static void addTestMethods(Editor editor,
PsiClass targetClass,
final TestFramework descriptor,
- Collection<MemberInfo> methods,
+ Collection<? extends MemberInfo> methods,
boolean generateBefore,
boolean generateAfter) throws IncorrectOperationException {
addTestMethods(editor, targetClass, null, descriptor, methods, generateBefore, generateAfter);
PsiClass targetClass,
@Nullable PsiClass sourceClass,
final TestFramework descriptor,
- Collection<MemberInfo> methods,
+ Collection<? extends MemberInfo> methods,
boolean generateBefore,
boolean generateAfter) throws IncorrectOperationException {
final Set<String> existingNames = new HashSet<>();
@Nullable PsiClass sourceClass,
Editor editor,
@Nullable String name,
- Set<String> existingNames, PsiMethod anchor) {
+ Set<? super String> existingNames, PsiMethod anchor) {
PsiMethod dummyMethod = TestIntegrationUtils.createDummyMethod(targetClass);
PsiMethod method = (PsiMethod)(anchor == null ? targetClass.add(dummyMethod) : targetClass.addAfter(dummyMethod, anchor));
PsiDocumentManager.getInstance(targetClass.getProject()).doPostponedOperationsAndUnblockDocument(editor.getDocument());
return null;
}
- public static void sortThreads(List<ThreadState> result) {
+ public static void sortThreads(List<? extends ThreadState> result) {
Collections.sort(result, (o1, o2) -> getInterestLevel(o2) - getInterestLevel(o1));
}
}
@NotNull
- public static Query<PsiClass> search(@NotNull SearchScope scope, @NotNull Project project, @NotNull Condition<String> shortNameCondition) {
+ public static Query<PsiClass> search(@NotNull SearchScope scope, @NotNull Project project, @NotNull Condition<? super String> shortNameCondition) {
return INSTANCE.createQuery(new SearchParameters(scope, project, shortNameCondition));
}
}
\ No newline at end of file
@NotNull
public static PsiAnnotation[] getAllAnnotations(@NotNull PsiModifierListOwner owner,
boolean inHierarchy,
- @Nullable Set<PsiModifierListOwner> visited) {
+ @Nullable Set<? super PsiModifierListOwner> visited) {
return getAllAnnotations(owner, inHierarchy, visited, true);
}
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.List;
+
/**
* @author peter
*/
private static boolean isReturnTypeCompatible(PsiMethodReferenceExpression expression,
JavaResolveResult result,
PsiType functionalInterfaceType,
- Ref<String> errorMessage) {
+ Ref<? super String> errorMessage) {
final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(resolveResult);
if (interfaceMethod != null) {
//<editor-fold desc="API and the inner kitchen.">
@NotNull
- public static <Psi extends PsiElement> List<Psi> collectAugments(@NotNull PsiElement element, @NotNull Class<Psi> type) {
+ public static <Psi extends PsiElement> List<Psi> collectAugments(@NotNull PsiElement element, @NotNull Class<? extends Psi> type) {
List<Psi> result = ContainerUtil.newSmartList();
forEach(element.getProject(), provider -> {
return manager.areElementsEquivalent(baseClass, aClass) || aClass.isInheritor(baseClass, checkDeep);
}
- public static boolean processSupers(@Nullable PsiClass aClass, boolean includeSelf, @NotNull Processor<PsiClass> superProcessor) {
+ public static boolean processSupers(@Nullable PsiClass aClass, boolean includeSelf, @NotNull Processor<? super PsiClass> superProcessor) {
if (aClass == null) return true;
if (includeSelf && !superProcessor.process(aClass)) return false;
* @param results
* @param includeNonProject
*/
- public static void getSuperClasses(@NotNull PsiClass aClass, @NotNull Set<PsiClass> results, boolean includeNonProject) {
+ public static void getSuperClasses(@NotNull PsiClass aClass, @NotNull Set<? super PsiClass> results, boolean includeNonProject) {
getSuperClassesOfList(aClass.getSuperTypes(), results, includeNonProject, new THashSet<>(), aClass.getManager());
}
public class PsiConcatenationUtil {
public static void buildFormatString(PsiExpression expression, StringBuilder formatString,
- List<PsiExpression> formatParameters, boolean printfFormat) {
+ List<? super PsiExpression> formatParameters, boolean printfFormat) {
if (expression instanceof PsiLiteralExpression) {
final PsiLiteralExpression literalExpression = (PsiLiteralExpression) expression;
final String text = String.valueOf(literalExpression.getValue());
return findConstructorInSuper(constructor, new HashSet<>());
}
- private static PsiMethod findConstructorInSuper(PsiMethod constructor, Set<PsiMethod> visited) {
+ private static PsiMethod findConstructorInSuper(PsiMethod constructor, Set<? super PsiMethod> visited) {
if (visited.contains(constructor)) return null;
visited.add(constructor);
PsiMethodCallExpression call = findThisOrSuperCallInConstructor(constructor);
}
@NotNull
- private static List<PsiClassType> filterOutUncheckedExceptions(@NotNull List<PsiClassType> exceptions) {
+ private static List<PsiClassType> filterOutUncheckedExceptions(@NotNull List<? extends PsiClassType> exceptions) {
List<PsiClassType> array = ContainerUtil.newArrayList();
for (PsiClassType exception : exceptions) {
if (!isUncheckedException(exception)) array.add(exception);
return result;
}
- private static void addExceptions(@NotNull List<PsiClassType> array, @NotNull Collection<PsiClassType> exceptions) {
+ private static void addExceptions(@NotNull List<PsiClassType> array, @NotNull Collection<? extends PsiClassType> exceptions) {
for (PsiClassType exception : exceptions) {
addException(array, exception);
}
return getUnhandledExceptions(method, methodCall, topElement, substitutor);
}
- public static void retainExceptions(List<PsiClassType> ex, List<PsiClassType> thrownEx) {
+ public static void retainExceptions(List<PsiClassType> ex, List<? extends PsiClassType> thrownEx) {
final List<PsiClassType> replacement = new ArrayList<>();
for (Iterator<PsiClassType> iterator = ex.iterator(); iterator.hasNext(); ) {
PsiClassType classType = iterator.next();
return false;
}
- public static void sortExceptionsByHierarchy(@NotNull List<PsiClassType> exceptions) {
+ public static void sortExceptionsByHierarchy(@NotNull List<? extends PsiClassType> exceptions) {
if (exceptions.size() <= 1) return;
sortExceptionsByHierarchy(exceptions.subList(1, exceptions.size()));
for (int i=0; i<exceptions.size()-1;i++) {
}
@NotNull
- protected static PackageDirectoryCache createCache(@NotNull final List<VirtualFile> roots) {
+ protected static PackageDirectoryCache createCache(@NotNull final List<? extends VirtualFile> roots) {
final MultiMap<String, VirtualFile> map = MultiMap.create();
map.putValues("", roots);
return new PackageDirectoryCache(map);
public class InferenceVariablesOrder {
- public static List<InferenceVariable> resolveOrder(Collection<InferenceVariable> vars, InferenceSession session) {
+ public static List<InferenceVariable> resolveOrder(Collection<? extends InferenceVariable> vars, InferenceSession session) {
return resolveOrderIterator(vars, session).next();
}
- public static Iterator<List<InferenceVariable>> resolveOrderIterator(Collection<InferenceVariable> vars, InferenceSession session) {
+ public static Iterator<List<InferenceVariable>> resolveOrderIterator(Collection<? extends InferenceVariable> vars, InferenceSession session) {
Map<InferenceVariable, InferenceGraphNode<InferenceVariable>> nodes =
new LinkedHashMap<>();
for (InferenceVariable var : vars) {
return ContainerUtil.map(acyclicNodes, node -> node.getValue()).iterator();
}
- public static <T> List<List<InferenceGraphNode<T>>> tarjan(Collection<InferenceGraphNode<T>> nodes) {
+ public static <T> List<List<InferenceGraphNode<T>>> tarjan(Collection<? extends InferenceGraphNode<T>> nodes) {
final ArrayList<List<InferenceGraphNode<T>>> result = new ArrayList<>();
final Stack<InferenceGraphNode<T>> currentStack = new Stack<>();
int index = 0;
return result;
}
- public static <T> ArrayList<InferenceGraphNode<T>> initNodes(Collection<InferenceGraphNode<T>> allNodes) {
+ public static <T> ArrayList<InferenceGraphNode<T>> initNodes(Collection<? extends InferenceGraphNode<T>> allNodes) {
final List<List<InferenceGraphNode<T>>> nodes = tarjan(allNodes);
final ArrayList<InferenceGraphNode<T>> acyclicNodes = new ArrayList<>();
for (List<InferenceGraphNode<T>> cycle : nodes) {
}
- private static <T> InferenceGraphNode<T> merge(final List<InferenceGraphNode<T>> cycle,
- final Collection<InferenceGraphNode<T>> allNodes) {
+ private static <T> InferenceGraphNode<T> merge(final List<? extends InferenceGraphNode<T>> cycle,
+ final Collection<? extends InferenceGraphNode<T>> allNodes) {
assert !cycle.isEmpty();
final InferenceGraphNode<T> root = cycle.get(0);
if (cycle.size() > 1) {
private static <T> int strongConnect(InferenceGraphNode<T> currentNode,
int index,
Stack<InferenceGraphNode<T>> currentStack,
- ArrayList<List<InferenceGraphNode<T>>> result) {
+ ArrayList<? super List<InferenceGraphNode<T>>> result) {
currentNode.index = index;
currentNode.lowlink = index;
index++;
return urls;
}
- public static void processClassPathItems(final VirtualFile virtualFile, final Module module, final Consumer<VirtualFile> consumer) {
+ public static void processClassPathItems(final VirtualFile virtualFile, final Module module, final Consumer<? super VirtualFile> consumer) {
processClassPathItems(virtualFile, module, consumer, true);
}
- public static void processClassPathItems(final VirtualFile virtualFile, final Module module, final Consumer<VirtualFile> consumer,
+ public static void processClassPathItems(final VirtualFile virtualFile, final Module module, final Consumer<? super VirtualFile> consumer,
boolean includeModuleOutput) {
if (isJarFile(virtualFile)){
consumer.consume(virtualFile);
}
}
- private static void addUrl(List<URL> urls, VirtualFile file) {
+ private static void addUrl(List<? super URL> urls, VirtualFile file) {
if (file == null || !file.isValid()) return;
final URL url = getUrl(file);
if (url != null) {
}
private static boolean determineType(PsiExpression retValue,
- List<Pair<PsiExpression, Boolean>> iterableReturnValues,
+ List<? super Pair<PsiExpression, Boolean>> iterableReturnValues,
PsiClass iterable,
PsiClass collection) {
if (retValue == null) return false;
public static final String JAVA_RUNTIME_VERSION = System.getProperty("java.runtime.version");
public static boolean compile(Collection<String> options,
- final Collection<File> sources,
- Collection<File> classpath,
+ final Collection<? extends File> sources,
+ Collection<? extends File> classpath,
Collection<File> platformClasspath,
- Collection<File> modulePath,
- Collection<File> upgradeModulePath,
- Collection<File> sourcePath,
+ Collection<? extends File> modulePath,
+ Collection<? extends File> upgradeModulePath,
+ Collection<? extends File> sourcePath,
Map<File, Set<File>> outputDirToRoots,
final DiagnosticOutputConsumer diagnosticConsumer,
final OutputFileConsumer outputSink,
return false;
}
- private static void setModulePath(JavacFileManager fileManager, String option, Collection<File> path) throws IOException {
+ private static void setModulePath(JavacFileManager fileManager, String option, Collection<? extends File> path) throws IOException {
JavaFileManager.Location location = StandardLocation.locationFor(option);
if (location != null) { // if this option is supported
fileManager.setLocation(location, path);
}
public static JavacRemoteProto.Message.Request createCompilationRequest(List<String> options,
- Collection<File> files,
- Collection<File> classpath,
- Collection<File> platformCp,
- Collection<File> modulePath,
- Collection<File> upgradeModulePath,
- Collection<File> sourcePath,
+ Collection<? extends File> files,
+ Collection<? extends File> classpath,
+ Collection<? extends File> platformCp,
+ Collection<? extends File> modulePath,
+ Collection<? extends File> upgradeModulePath,
+ Collection<? extends File> sourcePath,
Map<File, Set<File>> outs) {
final JavacRemoteProto.Message.Request.Builder builder = JavacRemoteProto.Message.Request.newBuilder();
builder.setRequestType(JavacRemoteProto.Message.Request.Type.COMPILE);
static void registerFile(String filePath,
TObjectIntHashMap<? extends JavacRef> refs,
- Collection<JavacDef> defs,
- Collection<JavacTypeCast> casts,
- Collection<JavacRef> implicitToString,
+ Collection<? extends JavacDef> defs,
+ Collection<? extends JavacTypeCast> casts,
+ Collection<? extends JavacRef> implicitToString,
final JavaBackwardReferenceIndexWriter writer) {
try {
registerFilesToCompile(context, Collections.singleton(file));
}
- public static void registerFilesToCompile(CompileContext context, Collection<File> files) {
+ public static void registerFilesToCompile(CompileContext context, Collection<? extends File> files) {
getFilesContainer(context, FILES_TO_COMPILE_KEY).addAll(files);
}
- public static void registerFilesWithErrors(CompileContext context, Collection<File> files) {
+ public static void registerFilesWithErrors(CompileContext context, Collection<? extends File> files) {
getFilesContainer(context, COMPILED_WITH_ERRORS_KEY).addAll(files);
}
registerSuccessfullyCompiled(context, Collections.singleton(file));
}
- public static void registerSuccessfullyCompiled(CompileContext context, Collection<File> files) {
+ public static void registerSuccessfullyCompiled(CompileContext context, Collection<? extends File> files) {
getFilesContainer(context, SUCCESSFULLY_COMPILED_FILES_KEY).addAll(files);
}
return myAffectedFiles;
}
- public static ConstantAffection compose(final Collection<ConstantAffection> affections) {
+ public static ConstantAffection compose(final Collection<? extends ConstantAffection> affections) {
if (affections.isEmpty()) {
return EMPTY;
}
}
}
- public static <X> void save(final Collection<X> x, final DataExternalizer<X> e, final DataOutput out) {
+ public static <X> void save(final Collection<? extends X> x, final DataExternalizer<X> e, final DataOutput out) {
try {
DataInputOutputUtil.writeINT(out, x.size());
return ContainerUtil.newArrayList(cp);
}
- public static void appendJavaCompilerClasspath(Collection<String> cp, boolean includeEcj) {
+ public static void appendJavaCompilerClasspath(Collection<? super String> cp, boolean includeEcj) {
final Class<StandardJavaFileManager> optimizedFileManagerClass = OptimizedFileManagerUtil.getManagerClass();
if (optimizedFileManagerClass != null) {
cp.add(getResourcePath(optimizedFileManagerClass)); // optimizedFileManager
}
}
- public static boolean deleteRecursively(@NotNull String path, @NotNull Collection<String> deletedPaths, @Nullable Set<File> parentDirs) {
+ public static boolean deleteRecursively(@NotNull String path, @NotNull Collection<String> deletedPaths, @Nullable Set<? super File> parentDirs) {
File file = new File(path);
boolean deleted = deleteRecursively(file, deletedPaths);
if (deleted && parentDirs != null) {
return JpsJavaExtensionService.dependencies(module).includedIn(kind).recursivelyExportedOnly().getModules();
}
- public static void processFilesToRecompile(CompileContext context, ModuleChunk chunk, FileProcessor<JavaSourceRootDescriptor, ModuleBuildTarget> processor) throws IOException {
+ public static void processFilesToRecompile(CompileContext context, ModuleChunk chunk, FileProcessor<JavaSourceRootDescriptor, ? super ModuleBuildTarget> processor) throws IOException {
for (ModuleBuildTarget target : chunk.getTargets()) {
processFilesToRecompile(context, target, processor);
}
}
- public static void processFilesToRecompile(CompileContext context, @NotNull ModuleBuildTarget target, FileProcessor<JavaSourceRootDescriptor, ModuleBuildTarget> processor) throws IOException {
+ public static void processFilesToRecompile(CompileContext context, @NotNull ModuleBuildTarget target, FileProcessor<JavaSourceRootDescriptor, ? super ModuleBuildTarget> processor) throws IOException {
context.getProjectDescriptor().fsState.processFilesToRecompile(context, target, processor);
}
private enum Applicability {
NONE, PARTIAL, ALL;
- static <T> Applicability calculate(Predicate<T> p, Collection<T> collection) {
+ static <T> Applicability calculate(Predicate<? super T> p, Collection<? extends T> collection) {
int count = 0;
int item = 0;
for (T elem : collection) {
// utility methods
public static InstrumentationClassFinder createInstrumentationClassFinder(@Nullable JpsSdk<?> sdk,
- Collection<File> platformCp,
- Collection<File> cp,
+ Collection<? extends File> platformCp,
+ Collection<? extends File> cp,
final OutputConsumer outputConsumer) throws
MalformedURLException {
final URL[] platformUrls;
/**
* @return true if annotation processing is enabled and corresponding options were added, false if profile is null or disabled
*/
- public static boolean addAnnotationProcessingOptions(List<String> options, @Nullable AnnotationProcessingConfiguration profile) {
+ public static boolean addAnnotationProcessingOptions(List<? super String> options, @Nullable AnnotationProcessingConfiguration profile) {
if (profile == null || !profile.isEnabled()) {
options.add("-proc:none");
return false;
return handlers;
}
- public static boolean shouldProcessDependenciesRecursively(final List<JpsJavaDependenciesEnumerationHandler> handlers) {
+ public static boolean shouldProcessDependenciesRecursively(final List<? extends JpsJavaDependenciesEnumerationHandler> handlers) {
if (handlers != null) {
for (JpsJavaDependenciesEnumerationHandler handler : handlers) {
if (!handler.shouldProcessDependenciesRecursively()) {
}
@NotNull
- public static List<JpsModule> loadModules(@NotNull List<Path> moduleFiles, @Nullable final JpsSdkType<?> projectSdkType,
+ public static List<JpsModule> loadModules(@NotNull List<? extends Path> moduleFiles, @Nullable final JpsSdkType<?> projectSdkType,
@NotNull final Map<String, String> pathVariables) {
List<JpsModule> modules = new ArrayList<>();
List<Future<Pair<Path, Element>>> futureModuleFilesContents = new ArrayList<>();
public abstract T evaluate(@NotNull PsiFile psiFile);
@Nullable
- public static <T> T getOrCompute(@NotNull PsiFile psiFile, @NotNull Function<PsiFile, T> eval, @NotNull Key<CachedValue<T>> key) {
+ public static <T> T getOrCompute(@NotNull PsiFile psiFile, @NotNull Function<? super PsiFile, ? extends T> eval, @NotNull Key<CachedValue<T>> key) {
final CachedValueProvider<T> provider = new CachedValueProviderOnPsiFile<T>(psiFile) {
@Override
@Nullable
return files.size() > 1;
}
- public static String createMessage(@NotNull final Collection<VirtualFile> schemaFiles,
+ public static String createMessage(@NotNull final Collection<? extends VirtualFile> schemaFiles,
@NotNull JsonSchemaService jsonSchemaService,
@NotNull String separator,
@NotNull String prefix,
import java.util.function.Predicate;
public class JvmAnalysisTestsUastUtil {
- public static <T extends UElement> Set<T> getUElementsOfTypeFromFile(@NotNull PsiFile file, @NotNull Class<T> type) {
+ public static <T extends UElement> Set<T> getUElementsOfTypeFromFile(@NotNull PsiFile file, @NotNull Class<? extends T> type) {
return getUElementsOfTypeFromFile(file, type, null);
}
public static <T extends UElement> Set<T> getUElementsOfTypeFromFile(@NotNull PsiFile file,
- @NotNull Class<T> type,
- @Nullable Predicate<T> filter) {
+ @NotNull Class<? extends T> type,
+ @Nullable Predicate<? super T> filter) {
Set<T> result = new HashSet<>();
PsiTreeUtil.processElements(file, new PsiElementProcessor() {
@Override
moduleBuilder.addLibrary("javaUtil", PathUtil.getJarPathForClass(Locale.class));
}
- protected static int matchCallExpression(UastCallMatcher matcher, Set<UCallExpression> expressions) {
+ protected static int matchCallExpression(UastCallMatcher matcher, Set<? extends UCallExpression> expressions) {
return (int)expressions.stream().filter(matcher::testCallExpression).count();
}
- protected static int matchCallableReferenceExpression(UastCallMatcher matcher, Set<UCallableReferenceExpression> expressions) {
+ protected static int matchCallableReferenceExpression(UastCallMatcher matcher, Set<? extends UCallableReferenceExpression> expressions) {
return (int)expressions.stream().filter(matcher::testCallableReferenceExpression).count();
}
@Nullable("null means all") final HighlightSeverity minSeverity,
final int startOffset,
final int endOffset,
- @NotNull final Processor<HighlightInfo> processor) {
+ @NotNull final Processor<? super HighlightInfo> processor) {
LOG.assertTrue(ApplicationManager.getApplication().isReadAccessAllowed());
final SeverityRegistrar severityRegistrar = SeverityRegistrar.getSeverityRegistrar(project);
private static final String ANNOTATOR_INSPECTION_SHORT_NAME = "Annotator";
- private static void appendFixes(@Nullable TextRange fixedRange, @NotNull HighlightInfo info, @Nullable List<Annotation.QuickFixInfo> fixes) {
+ private static void appendFixes(@Nullable TextRange fixedRange, @NotNull HighlightInfo info, @Nullable List<? extends Annotation.QuickFixInfo> fixes) {
if (fixes != null) {
for (final Annotation.QuickFixInfo quickFixInfo : fixes) {
TextRange range = fixedRange != null ? fixedRange : quickFixInfo.textRange;
@NotNull Document document,
int startOffset,
int endOffset,
- @NotNull Collection<HighlightInfo> highlights,
+ @NotNull Collection<? extends HighlightInfo> highlights,
@Nullable final EditorColorsScheme colorsScheme, // if null global scheme will be used
int group) {
TextRange range = new TextRange(startOffset, endOffset);
throw new RuntimeException("unknown inspection class: " + profileEntry + "; "+profileEntry.getClass());
}
- private static void registerTools(@NotNull Collection<InspectionToolProvider> providers,
+ private static void registerTools(@NotNull Collection<? extends InspectionToolProvider> providers,
@NotNull List<Supplier<InspectionToolWrapper>> factories) {
for (InspectionToolProvider provider : providers) {
//noinspection unchecked
public static boolean areElementsEquivalent(@NotNull PsiElement element1,
@NotNull PsiElement element2,
- @Nullable Comparator<PsiElement> resolvedElementsComparator,
+ @Nullable Comparator<? super PsiElement> resolvedElementsComparator,
boolean areCommentsSignificant) {
return areElementsEquivalent(element1, element2, new ReferenceComparator(resolvedElementsComparator), null, null, areCommentsSignificant);
}
* @deprecated use {@link FileModificationService#preparePsiElementsForWrite(Collection)} (to be removed in IDEA 2018)
*/
@Deprecated
- public static boolean ensureFilesWritable(@NotNull Project project, @NotNull Collection<PsiFile> psiFiles) {
+ public static boolean ensureFilesWritable(@NotNull Project project, @NotNull Collection<? extends PsiFile> psiFiles) {
return FileModificationService.getInstance().preparePsiElementsForWrite(psiFiles);
}
}
\ No newline at end of file
* @return Key instance.
*/
@NotNull
- public static <T> NotNullLazyKey<T, Project> createLazyKey(@NotNull final Class<T> serviceClass) {
+ public static <T> NotNullLazyKey<T, Project> createLazyKey(@NotNull final Class<? extends T> serviceClass) {
return NotNullLazyKey.create("Service: " + serviceClass.getName(), project -> getService(project, serviceClass));
}
}
return buildExtensions(allSupers);
}
- private static void collectSupers(@NotNull Class classKey, @NotNull Set<String> allSupers) {
+ private static void collectSupers(@NotNull Class classKey, @NotNull Set<? super String> allSupers) {
allSupers.add(classKey.getName());
final Class[] interfaces = classKey.getInterfaces();
for (final Class anInterface : interfaces) {
return file;
}
- public static boolean processFilesRecursively(@NotNull final VirtualFile root, @NotNull final Processor<VirtualFile> processor) {
+ public static boolean processFilesRecursively(@NotNull final VirtualFile root, @NotNull final Processor<? super VirtualFile> processor) {
final Ref<Boolean> result = Ref.create(true);
visitChildrenRecursively(root, new VirtualFileVisitor() {
@NotNull
/** @deprecated does not handle recursive symlinks, use {@link #visitChildrenRecursively(VirtualFile, VirtualFileVisitor)} (to be removed in IDEA 2018) */
@Deprecated
public static void processFilesRecursively(@NotNull VirtualFile root,
- @NotNull Processor<VirtualFile> processor,
- @NotNull Convertor<VirtualFile, Boolean> directoryFilter) {
+ @NotNull Processor<? super VirtualFile> processor,
+ @NotNull Convertor<? super VirtualFile, Boolean> directoryFilter) {
if (!processor.process(root)) return;
if (root.isDirectory() && directoryFilter.convert(root)) {
}
@NotNull
- private static <E> ObjectPattern.Capture<E> composeInitialConditions(final List<InitialPatternCondition> initial) {
+ private static <E> ObjectPattern.Capture<E> composeInitialConditions(final List<? extends InitialPatternCondition> initial) {
return new ObjectPattern.Capture<>(new InitialPatternCondition(Object.class) {
@Override
public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
}
@NotNull
- private static TextRange getManipulatorRange(@NotNull ElementManipulator<PsiElement> manipulator, @NotNull PsiElement element) {
+ private static TextRange getManipulatorRange(@NotNull ElementManipulator<? super PsiElement> manipulator, @NotNull PsiElement element) {
TextRange rangeInElement = manipulator.getRangeInElement(element);
TextRange elementRange = TextRange.from(0, element.getTextLength());
if (!elementRange.contains(rangeInElement)) {
* @param <H> key type
* @return instance
*/
- public static <T, H extends PsiElement> PsiCacheKey<T, H> create(@NonNls @NotNull String name, @NotNull Function<H, T> function) {
+ public static <T, H extends PsiElement> PsiCacheKey<T, H> create(@NonNls @NotNull String name, @NotNull Function<? super H, ? extends T> function) {
return create(name, function, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
}
}
@Nullable
- public static PsiElement findFirstParent(@Nullable PsiElement element, Condition<PsiElement> condition) {
+ public static PsiElement findFirstParent(@Nullable PsiElement element, Condition<? super PsiElement> condition) {
return findFirstParent(element, false, condition);
}
@Nullable
- public static PsiElement findFirstParent(@Nullable PsiElement element, boolean strict, Condition<PsiElement> condition) {
+ public static PsiElement findFirstParent(@Nullable PsiElement element, boolean strict, Condition<? super PsiElement> condition) {
if (strict && element != null) {
element = element.getParent();
}
}
@Nullable
- public static PsiElement findFirstContext(@Nullable PsiElement element, boolean strict, Condition<PsiElement> condition) {
+ public static PsiElement findFirstContext(@Nullable PsiElement element, boolean strict, Condition<? super PsiElement> condition) {
if (strict && element != null) {
element = element.getContext();
}
}
@NotNull
- public static <T extends PsiElement> List<T> getChildrenOfTypeAsList(@Nullable PsiElement element, @NotNull Class<T> aClass) {
+ public static <T extends PsiElement> List<T> getChildrenOfTypeAsList(@Nullable PsiElement element, @NotNull Class<? extends T> aClass) {
if (element == null) return Collections.emptyList();
List<T> result = null;
}
@NotNull
- public static <T extends PsiElement> List<T> getStubChildrenOfTypeAsList(@Nullable PsiElement element, @NotNull Class<T> aClass) {
+ public static <T extends PsiElement> List<T> getStubChildrenOfTypeAsList(@Nullable PsiElement element, @NotNull Class<? extends T> aClass) {
if (element == null) return Collections.emptyList();
StubElement<?> stub = element instanceof StubBasedPsiElement ? ((StubBasedPsiElement)element).getStub() : null;
if (stub == null) {
@Nullable
public static PsiElement findSiblingForward(@NotNull final PsiElement element,
@NotNull final IElementType elementType,
- @Nullable final Consumer<PsiElement> consumer) {
+ @Nullable final Consumer<? super PsiElement> consumer) {
return findSiblingForward(element, elementType, true, consumer);
}
@Nullable
public static PsiElement findSiblingBackward(@NotNull final PsiElement element,
@NotNull final IElementType elementType,
- @Nullable final Consumer<PsiElement> consumer) {
+ @Nullable final Consumer<? super PsiElement> consumer) {
return findSiblingBackward(element, elementType, true, consumer);
}
public static boolean treeWalkUp(@NotNull final PsiElement entrance,
@Nullable final PsiElement maxScope,
- @NotNull PairProcessor<PsiElement, PsiElement> eachScopeAndLastParent) {
+ @NotNull PairProcessor<? super PsiElement, ? super PsiElement> eachScopeAndLastParent) {
PsiElement prevParent = null;
PsiElement scope = entrance;
*
* @param files the files to reparse.
*/
- public static void reparseFiles(@NotNull final Collection<VirtualFile> files) {
+ public static void reparseFiles(@NotNull final Collection<? extends VirtualFile> files) {
ApplicationManager.getApplication().runWriteAction(() -> {
// files must be processed under one write action to prevent firing event for invalid files.
final Set<VFilePropertyChangeEvent> events = new THashSet<>();
return null;
}
- private static LighterASTNode findChildAtOffset(final int offset, List<LighterASTNode> children) {
+ private static LighterASTNode findChildAtOffset(final int offset, List<? extends LighterASTNode> children) {
return ContainerUtil.find(children, node -> containsOffset(node, offset));
}
}
@NotNull
- public static <T> List<T> map(@NotNull Function<ThreeSide, T> function) {
+ public static <T> List<T> map(@NotNull Function<? super ThreeSide, ? extends T> function) {
return ContainerUtil.list(
function.fun(LEFT),
function.fun(BASE),