mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup: fix signatures
This commit is contained in:
@@ -74,7 +74,7 @@ public abstract class DownloadableLibraryType extends LibraryType<LibraryVersion
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static LibraryVersionProperties detectVersion(List<VirtualFile> classesRoots, String detectionClass) {
|
||||
private static LibraryVersionProperties detectVersion(List<? extends VirtualFile> classesRoots, String detectionClass) {
|
||||
if (!LibraryUtil.isClassAvailableInLibrary(classesRoots, detectionClass)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+3
-3
@@ -50,11 +50,11 @@ public abstract class LibraryPresentationManager {
|
||||
public abstract List<String> getDescriptions(@NotNull Library library, StructureConfigurableContext context);
|
||||
|
||||
@NotNull
|
||||
public abstract List<String> getDescriptions(@NotNull VirtualFile[] classRoots, Set<LibraryKind> excludedKinds);
|
||||
public abstract List<String> getDescriptions(@NotNull VirtualFile[] classRoots, Set<? extends LibraryKind> excludedKinds);
|
||||
|
||||
public abstract List<Library> getLibraries(@NotNull Set<LibraryKind> kinds, @NotNull Project project, @Nullable StructureConfigurableContext context);
|
||||
public abstract List<Library> getLibraries(@NotNull Set<? extends LibraryKind> kinds, @NotNull Project project, @Nullable StructureConfigurableContext context);
|
||||
|
||||
public abstract boolean isLibraryOfKind(@NotNull List<VirtualFile> files, @NotNull LibraryKind kind);
|
||||
public abstract boolean isLibraryOfKind(@NotNull List<? extends VirtualFile> files, @NotNull LibraryKind kind);
|
||||
|
||||
public abstract boolean isLibraryOfKind(@NotNull Library library, @NotNull LibrariesContainer librariesContainer,
|
||||
@NotNull Set<? extends LibraryKind> acceptedKinds);
|
||||
|
||||
+3
-3
@@ -118,7 +118,7 @@ public class LibraryPresentationManagerImpl extends LibraryPresentationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLibraryOfKind(@NotNull List<VirtualFile> files, @NotNull final LibraryKind kind) {
|
||||
public boolean isLibraryOfKind(@NotNull List<? extends VirtualFile> files, @NotNull final LibraryKind kind) {
|
||||
return !LibraryDetectionManager.getInstance().processProperties(files, new LibraryDetectionManager.LibraryPropertiesProcessor() {
|
||||
@Override
|
||||
public <P extends LibraryProperties> boolean processProperties(@NotNull LibraryKind processedKind, @NotNull P properties) {
|
||||
@@ -152,7 +152,7 @@ public class LibraryPresentationManagerImpl extends LibraryPresentationManager {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getDescriptions(@NotNull VirtualFile[] classRoots, final Set<LibraryKind> excludedKinds) {
|
||||
public List<String> getDescriptions(@NotNull VirtualFile[] classRoots, final Set<? extends LibraryKind> excludedKinds) {
|
||||
final SmartList<String> result = new SmartList<>();
|
||||
LibraryDetectionManager.getInstance().processProperties(Arrays.asList(classRoots), new LibraryDetectionManager.LibraryPropertiesProcessor() {
|
||||
@Override
|
||||
@@ -170,7 +170,7 @@ public class LibraryPresentationManagerImpl extends LibraryPresentationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Library> getLibraries(@NotNull Set<LibraryKind> kinds, @NotNull Project project, @Nullable StructureConfigurableContext context) {
|
||||
public List<Library> getLibraries(@NotNull Set<? extends LibraryKind> kinds, @NotNull Project project, @Nullable StructureConfigurableContext context) {
|
||||
List<Library> libraries = new ArrayList<>();
|
||||
if (context != null) {
|
||||
Collections.addAll(libraries, context.getProjectLibrariesProvider().getModifiableModel().getLibraries());
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.text.StringTokenizer;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -38,7 +39,7 @@ public class LibrariesHelperImpl extends LibrariesHelper {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public VirtualFile findRootByClass(List<VirtualFile> roots, String fqn) {
|
||||
public VirtualFile findRootByClass(@NotNull List<? extends VirtualFile> roots, String fqn) {
|
||||
for (VirtualFile file : roots) {
|
||||
if (findInFile(file, new StringTokenizer(fqn, "."))) return file;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class JarVersionDetectionUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String detectJarVersion(@NotNull String detectionClass, @NotNull List<VirtualFile> files) {
|
||||
public static String detectJarVersion(@NotNull String detectionClass, @NotNull List<? extends VirtualFile> files) {
|
||||
VirtualFile jarRoot = LibrariesHelper.getInstance().findRootByClass(files, detectionClass);
|
||||
return jarRoot != null && jarRoot.getFileSystem() instanceof JarFileSystem ?
|
||||
getMainAttribute(jarRoot, Attributes.Name.IMPLEMENTATION_VERSION) : null;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.openapi.roots.libraries;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -38,5 +39,5 @@ public abstract class LibrariesHelper {
|
||||
public abstract VirtualFile findJarByClass(final Library library, @NonNls String fqn);
|
||||
|
||||
@Nullable
|
||||
public abstract VirtualFile findRootByClass(List<VirtualFile> roots, String fqn);
|
||||
public abstract VirtualFile findRootByClass(@NotNull List<? extends VirtualFile> roots, String fqn);
|
||||
}
|
||||
|
||||
@@ -62,12 +62,10 @@ public class LibraryScopeCache {
|
||||
}
|
||||
});
|
||||
private final ConcurrentMap<String, GlobalSearchScope> mySdkScopes = ContainerUtil.newConcurrentMap();
|
||||
private final Map<List<OrderEntry>, GlobalSearchScope> myLibraryResolveScopeCache =
|
||||
ConcurrentFactoryMap.createMap(key -> calcLibraryScope(key));
|
||||
private final Map<List<OrderEntry>, GlobalSearchScope> myLibraryUseScopeCache =
|
||||
ConcurrentFactoryMap.createMap(key -> calcLibraryUseScope(key));
|
||||
private final Map<List<? extends OrderEntry>, GlobalSearchScope> myLibraryResolveScopeCache = ConcurrentFactoryMap.createMap(key -> calcLibraryScope(key));
|
||||
private final Map<List<? extends OrderEntry>, GlobalSearchScope> myLibraryUseScopeCache = ConcurrentFactoryMap.createMap(key -> calcLibraryUseScope(key));
|
||||
|
||||
public LibraryScopeCache(Project project) {
|
||||
public LibraryScopeCache(@NotNull Project project) {
|
||||
myProject = project;
|
||||
myLibrariesOnlyScope = new LibrariesOnlyScope(GlobalSearchScope.allScope(myProject), myProject);
|
||||
}
|
||||
@@ -85,7 +83,7 @@ public class LibraryScopeCache {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private GlobalSearchScope getScopeForLibraryUsedIn(@NotNull List<Module> modulesLibraryIsUsedIn) {
|
||||
private GlobalSearchScope getScopeForLibraryUsedIn(@NotNull List<? extends Module> modulesLibraryIsUsedIn) {
|
||||
Module[] array = modulesLibraryIsUsedIn.toArray(Module.EMPTY_ARRAY);
|
||||
GlobalSearchScope scope = myLibraryScopes.get(array);
|
||||
return scope != null ? scope : ConcurrencyUtil.cacheOrGet(myLibraryScopes, array,
|
||||
@@ -98,7 +96,7 @@ public class LibraryScopeCache {
|
||||
* @return a cached resolve scope
|
||||
*/
|
||||
@NotNull
|
||||
public GlobalSearchScope getLibraryScope(@NotNull List<OrderEntry> orderEntries) {
|
||||
public GlobalSearchScope getLibraryScope(@NotNull List<? extends OrderEntry> orderEntries) {
|
||||
return myLibraryResolveScopeCache.get(orderEntries);
|
||||
}
|
||||
|
||||
@@ -108,7 +106,7 @@ public class LibraryScopeCache {
|
||||
* @return a cached use scope
|
||||
*/
|
||||
@NotNull
|
||||
public GlobalSearchScope getLibraryUseScope(@NotNull List<OrderEntry> orderEntries) {
|
||||
public GlobalSearchScope getLibraryUseScope(@NotNull List<? extends OrderEntry> orderEntries) {
|
||||
return myLibraryUseScopeCache.get(orderEntries);
|
||||
}
|
||||
|
||||
@@ -131,7 +129,7 @@ public class LibraryScopeCache {
|
||||
}
|
||||
}
|
||||
|
||||
Comparator<Module> comparator = (o1, o2) -> o1.getName().compareTo(o2.getName());
|
||||
Comparator<Module> comparator = Comparator.comparing(Module::getName);
|
||||
Collections.sort(modulesLibraryUsedIn, comparator);
|
||||
List<Module> uniquesList = ContainerUtil.removeDuplicatesFromSorted(modulesLibraryUsedIn, comparator);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public abstract class HyperlinkInfoFactory {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract HyperlinkInfo createMultipleFilesHyperlinkInfo(@NotNull List<VirtualFile> files,
|
||||
public abstract HyperlinkInfo createMultipleFilesHyperlinkInfo(@NotNull List<? extends VirtualFile> files,
|
||||
int line, @NotNull Project project);
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public abstract class HyperlinkInfoFactory {
|
||||
* @return newly created HyperlinkInfo which navigates to given line and column
|
||||
*/
|
||||
@NotNull
|
||||
public abstract HyperlinkInfo createMultipleFilesHyperlinkInfo(@NotNull List<VirtualFile> files,
|
||||
public abstract HyperlinkInfo createMultipleFilesHyperlinkInfo(@NotNull List<? extends VirtualFile> files,
|
||||
int line,
|
||||
@NotNull Project project,
|
||||
ToIntFunction<? super PsiFile> columnFinder);
|
||||
|
||||
+2
-2
@@ -33,14 +33,14 @@ public class HyperlinkInfoFactoryImpl extends HyperlinkInfoFactory {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HyperlinkInfo createMultipleFilesHyperlinkInfo(@NotNull List<VirtualFile> files,
|
||||
public HyperlinkInfo createMultipleFilesHyperlinkInfo(@NotNull List<? extends VirtualFile> files,
|
||||
int line, @NotNull Project project) {
|
||||
return new MultipleFilesHyperlinkInfo(files, line, project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HyperlinkInfo createMultipleFilesHyperlinkInfo(@NotNull List<VirtualFile> files,
|
||||
public HyperlinkInfo createMultipleFilesHyperlinkInfo(@NotNull List<? extends VirtualFile> files,
|
||||
int line,
|
||||
@NotNull Project project,
|
||||
@Nullable ToIntFunction<? super PsiFile> columnFinder) {
|
||||
|
||||
+6
-6
@@ -32,10 +32,10 @@ import java.util.Map;
|
||||
* @author nik
|
||||
*/
|
||||
public class LibraryDetectionManagerImpl extends LibraryDetectionManager {
|
||||
private final Map<List<VirtualFile>, List<Pair<LibraryKind, LibraryProperties>>> myCache = Collections.synchronizedMap(new HashMap<List<VirtualFile>, List<Pair<LibraryKind, LibraryProperties>>>());
|
||||
private final Map<List<? extends VirtualFile>, List<Pair<LibraryKind, LibraryProperties>>> myCache = Collections.synchronizedMap(new HashMap<>());
|
||||
|
||||
@Override
|
||||
public boolean processProperties(@NotNull List<VirtualFile> files, @NotNull LibraryPropertiesProcessor processor) {
|
||||
public boolean processProperties(@NotNull List<? extends VirtualFile> files, @NotNull LibraryPropertiesProcessor processor) {
|
||||
for (Pair<LibraryKind, LibraryProperties> pair : getOrComputeKinds(files)) {
|
||||
if (!processor.processProperties(pair.getFirst(), pair.getSecond())) {
|
||||
return false;
|
||||
@@ -46,10 +46,10 @@ public class LibraryDetectionManagerImpl extends LibraryDetectionManager {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Pair<LibraryType<?>, LibraryProperties<?>> detectType(@NotNull List<VirtualFile> files) {
|
||||
public Pair<LibraryType<?>, LibraryProperties<?>> detectType(@NotNull List<? extends VirtualFile> files) {
|
||||
Pair<LibraryType<?>, LibraryProperties<?>> result = null;
|
||||
for (LibraryType<?> type : LibraryType.EP_NAME.getExtensions()) {
|
||||
final LibraryProperties<?> properties = type.detect(files);
|
||||
final LibraryProperties<?> properties = type.detect((List<VirtualFile>)files);
|
||||
if (properties != null) {
|
||||
if (result != null) {
|
||||
return null;
|
||||
@@ -60,7 +60,7 @@ public class LibraryDetectionManagerImpl extends LibraryDetectionManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<Pair<LibraryKind, LibraryProperties>> getOrComputeKinds(List<VirtualFile> files) {
|
||||
private List<Pair<LibraryKind, LibraryProperties>> getOrComputeKinds(List<? extends VirtualFile> files) {
|
||||
List<Pair<LibraryKind, LibraryProperties>> result = myCache.get(files);
|
||||
if (result == null) {
|
||||
result = computeKinds(files);
|
||||
@@ -69,7 +69,7 @@ public class LibraryDetectionManagerImpl extends LibraryDetectionManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<Pair<LibraryKind, LibraryProperties>> computeKinds(List<VirtualFile> files) {
|
||||
private static List<Pair<LibraryKind, LibraryProperties>> computeKinds(List<? extends VirtualFile> files) {
|
||||
final SmartList<Pair<LibraryKind, LibraryProperties>> result = new SmartList<>();
|
||||
final LibraryType<?>[] libraryTypes = LibraryType.EP_NAME.getExtensions();
|
||||
final LibraryPresentationProvider[] presentationProviders = LibraryPresentationProvider.EP_NAME.getExtensions();
|
||||
|
||||
+2
-2
@@ -31,10 +31,10 @@ public abstract class LibraryDetectionManager {
|
||||
return ServiceManager.getService(LibraryDetectionManager.class);
|
||||
}
|
||||
|
||||
public abstract boolean processProperties(@NotNull List<VirtualFile> files, @NotNull LibraryPropertiesProcessor processor);
|
||||
public abstract boolean processProperties(@NotNull List<? extends VirtualFile> files, @NotNull LibraryPropertiesProcessor processor);
|
||||
|
||||
@Nullable
|
||||
public abstract Pair<LibraryType<?>, LibraryProperties<?>> detectType(@NotNull List<VirtualFile> files);
|
||||
public abstract Pair<LibraryType<?>, LibraryProperties<?>> detectType(@NotNull List<? extends VirtualFile> files);
|
||||
|
||||
public interface LibraryPropertiesProcessor {
|
||||
<P extends LibraryProperties> boolean processProperties(@NotNull LibraryKind kind, @NotNull P properties);
|
||||
|
||||
@@ -44,6 +44,7 @@ public abstract class OrderEnumerator {
|
||||
*
|
||||
* @return this instance
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderEnumerator productionOnly();
|
||||
|
||||
/**
|
||||
@@ -51,6 +52,7 @@ public abstract class OrderEnumerator {
|
||||
*
|
||||
* @return this instance
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderEnumerator compileOnly();
|
||||
|
||||
/**
|
||||
@@ -58,32 +60,41 @@ public abstract class OrderEnumerator {
|
||||
*
|
||||
* @return this instance
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderEnumerator runtimeOnly();
|
||||
|
||||
@NotNull
|
||||
public abstract OrderEnumerator withoutSdk();
|
||||
|
||||
@NotNull
|
||||
public abstract OrderEnumerator withoutLibraries();
|
||||
|
||||
@NotNull
|
||||
public abstract OrderEnumerator withoutDepModules();
|
||||
|
||||
/**
|
||||
* Skip root module's entries
|
||||
* @return this
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderEnumerator withoutModuleSourceEntries();
|
||||
|
||||
@NotNull
|
||||
public OrderEnumerator librariesOnly() {
|
||||
return withoutSdk().withoutDepModules().withoutModuleSourceEntries();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public OrderEnumerator sdkOnly() {
|
||||
return withoutDepModules().withoutLibraries().withoutModuleSourceEntries();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public VirtualFile[] getAllLibrariesAndSdkClassesRoots() {
|
||||
return withoutModuleSourceEntries().withoutDepModules().recursively().exportedOnly().classes().usingCache().getRoots();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public VirtualFile[] getAllSourceRoots() {
|
||||
return recursively().exportedOnly().sources().usingCache().getRoots();
|
||||
}
|
||||
@@ -94,6 +105,7 @@ public abstract class OrderEnumerator {
|
||||
*
|
||||
* @return this instance
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderEnumerator recursively();
|
||||
|
||||
/**
|
||||
@@ -101,6 +113,7 @@ public abstract class OrderEnumerator {
|
||||
*
|
||||
* @return this instance
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderEnumerator exportedOnly();
|
||||
|
||||
/**
|
||||
@@ -109,7 +122,8 @@ public abstract class OrderEnumerator {
|
||||
* @param condition filtering condition
|
||||
* @return this instance
|
||||
*/
|
||||
public abstract OrderEnumerator satisfying(Condition<OrderEntry> condition);
|
||||
@NotNull
|
||||
public abstract OrderEnumerator satisfying(@NotNull Condition<? super OrderEntry> condition);
|
||||
|
||||
/**
|
||||
* Use {@code provider.getRootModel()} to process module dependencies
|
||||
@@ -117,6 +131,7 @@ public abstract class OrderEnumerator {
|
||||
* @param provider provider
|
||||
* @return this instance
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderEnumerator using(@NotNull RootModelProvider provider);
|
||||
|
||||
/**
|
||||
@@ -132,28 +147,33 @@ public abstract class OrderEnumerator {
|
||||
/**
|
||||
* @return {@link OrderRootsEnumerator} instance for processing classes roots
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderRootsEnumerator classes();
|
||||
|
||||
/**
|
||||
* @return {@link OrderRootsEnumerator} instance for processing source roots
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderRootsEnumerator sources();
|
||||
|
||||
/**
|
||||
* @param rootType root type
|
||||
* @return {@link OrderRootsEnumerator} instance for processing roots of the specified type
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderRootsEnumerator roots(@NotNull OrderRootType rootType);
|
||||
|
||||
/**
|
||||
* @param rootTypeProvider custom root type provider
|
||||
* @return {@link OrderRootsEnumerator} instance for processing roots of the provided type
|
||||
*/
|
||||
@NotNull
|
||||
public abstract OrderRootsEnumerator roots(@NotNull NotNullFunction<? super OrderEntry, ? extends OrderRootType> rootTypeProvider);
|
||||
|
||||
/**
|
||||
* @return classes roots for all entries processed by this enumerator
|
||||
*/
|
||||
@NotNull
|
||||
public VirtualFile[] getClassesRoots() {
|
||||
return classes().getRoots();
|
||||
}
|
||||
@@ -161,6 +181,7 @@ public abstract class OrderEnumerator {
|
||||
/**
|
||||
* @return source roots for all entries processed by this enumerator
|
||||
*/
|
||||
@NotNull
|
||||
public VirtualFile[] getSourceRoots() {
|
||||
return sources().getRoots();
|
||||
}
|
||||
@@ -168,6 +189,7 @@ public abstract class OrderEnumerator {
|
||||
/**
|
||||
* @return list containing classes roots for all entries processed by this enumerator
|
||||
*/
|
||||
@NotNull
|
||||
public PathsList getPathsList() {
|
||||
return classes().getPathsList();
|
||||
}
|
||||
@@ -175,6 +197,7 @@ public abstract class OrderEnumerator {
|
||||
/**
|
||||
* @return list containing source roots for all entries processed by this enumerator
|
||||
*/
|
||||
@NotNull
|
||||
public PathsList getSourcePathsList() {
|
||||
return sources().getPathsList();
|
||||
}
|
||||
@@ -184,21 +207,21 @@ public abstract class OrderEnumerator {
|
||||
*
|
||||
* @param processor processor
|
||||
*/
|
||||
public abstract void forEach(@NotNull Processor<OrderEntry> processor);
|
||||
public abstract void forEach(@NotNull Processor<? super OrderEntry> processor);
|
||||
|
||||
/**
|
||||
* Runs {@code processor.process()} for each library processed by this enumerator.
|
||||
*
|
||||
* @param processor processor
|
||||
*/
|
||||
public abstract void forEachLibrary(@NotNull Processor<Library> processor);
|
||||
public abstract void forEachLibrary(@NotNull Processor<? super Library> processor);
|
||||
|
||||
/**
|
||||
* Runs {@code processor.process()} for each module processed by this enumerator.
|
||||
*
|
||||
* @param processor processor
|
||||
*/
|
||||
public abstract void forEachModule(@NotNull Processor<Module> processor);
|
||||
public abstract void forEachModule(@NotNull Processor<? super Module> processor);
|
||||
|
||||
/**
|
||||
* Passes order entries to the specified visitor.
|
||||
|
||||
+4
-3
@@ -39,7 +39,7 @@ public class ModifiableModelCommitter {
|
||||
multiCommit(Arrays.asList(rootModels), moduleModel);
|
||||
}
|
||||
|
||||
public static void multiCommit(@NotNull Collection<ModifiableRootModel> rootModels, @NotNull ModifiableModuleModel moduleModel) {
|
||||
public static void multiCommit(@NotNull Collection<? extends ModifiableRootModel> rootModels, @NotNull ModifiableModuleModel moduleModel) {
|
||||
ApplicationManager.getApplication().assertWriteAccessAllowed();
|
||||
|
||||
final List<RootModelImpl> modelsToCommit = getSortedChangedModels(rootModels, moduleModel);
|
||||
@@ -61,7 +61,7 @@ public class ModifiableModelCommitter {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<RootModelImpl> getSortedChangedModels(Collection<ModifiableRootModel> rootModels, ModifiableModuleModel moduleModel) {
|
||||
private static List<RootModelImpl> getSortedChangedModels(@NotNull Collection<? extends ModifiableRootModel> rootModels, @NotNull ModifiableModuleModel moduleModel) {
|
||||
List<RootModelImpl> result = null;
|
||||
for (ModifiableRootModel model : rootModels) {
|
||||
RootModelImpl rootModel = (RootModelImpl)model;
|
||||
@@ -82,7 +82,8 @@ public class ModifiableModelCommitter {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static DFSTBuilder<RootModelImpl> createDFSTBuilder(List<RootModelImpl> rootModels, final ModifiableModuleModel moduleModel) {
|
||||
@NotNull
|
||||
private static DFSTBuilder<RootModelImpl> createDFSTBuilder(@NotNull List<? extends RootModelImpl> rootModels, @NotNull ModifiableModuleModel moduleModel) {
|
||||
final Map<String, RootModelImpl> nameToModel = ContainerUtil.newHashMap();
|
||||
for (RootModelImpl rootModel : rootModels) {
|
||||
String name = rootModel.getModule().getName();
|
||||
|
||||
+21
-6
@@ -47,7 +47,7 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume
|
||||
boolean myRecursively;
|
||||
boolean myRecursivelyExportedOnly;
|
||||
private boolean myExportedOnly;
|
||||
private Condition<OrderEntry> myCondition;
|
||||
private Condition<? super OrderEntry> myCondition;
|
||||
RootModelProvider myModulesProvider;
|
||||
private final OrderRootsCache myCache;
|
||||
|
||||
@@ -69,54 +69,63 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume
|
||||
return customHandlers == null ? Collections.emptyList() : customHandlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator productionOnly() {
|
||||
myProductionOnly = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator compileOnly() {
|
||||
myCompileOnly = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator runtimeOnly() {
|
||||
myRuntimeOnly = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator withoutSdk() {
|
||||
myWithoutJdk = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator withoutLibraries() {
|
||||
myWithoutLibraries = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator withoutDepModules() {
|
||||
myWithoutDepModules = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator withoutModuleSourceEntries() {
|
||||
myWithoutModuleSourceEntries = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator recursively() {
|
||||
myRecursively = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator exportedOnly() {
|
||||
if (myRecursively) {
|
||||
@@ -128,33 +137,39 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator satisfying(Condition<OrderEntry> condition) {
|
||||
public OrderEnumerator satisfying(@NotNull Condition<? super OrderEntry> condition) {
|
||||
myCondition = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderEnumerator using(@NotNull RootModelProvider provider) {
|
||||
myModulesProvider = provider;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderRootsEnumerator classes() {
|
||||
return new OrderRootsEnumeratorImpl(this, OrderRootType.CLASSES);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderRootsEnumerator sources() {
|
||||
return new OrderRootsEnumeratorImpl(this, OrderRootType.SOURCES);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderRootsEnumerator roots(@NotNull OrderRootType rootType) {
|
||||
return new OrderRootsEnumeratorImpl(this, rootType);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OrderRootsEnumerator roots(@NotNull NotNullFunction<? super OrderEntry, ? extends OrderRootType> rootTypeProvider) {
|
||||
return new OrderRootsEnumeratorImpl(this, rootTypeProvider);
|
||||
@@ -325,14 +340,14 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEach(@NotNull final Processor<OrderEntry> processor) {
|
||||
public void forEach(@NotNull final Processor<? super OrderEntry> processor) {
|
||||
forEach((entry, handlers) -> processor.process(entry));
|
||||
}
|
||||
|
||||
protected abstract void forEach(@NotNull PairProcessor<? super OrderEntry, ? super List<OrderEnumerationHandler>> processor);
|
||||
|
||||
@Override
|
||||
public void forEachLibrary(@NotNull final Processor<Library> processor) {
|
||||
public void forEachLibrary(@NotNull final Processor<? super Library> processor) {
|
||||
forEach((entry, handlers) -> {
|
||||
if (entry instanceof LibraryOrderEntry) {
|
||||
final Library library = ((LibraryOrderEntry)entry).getLibrary();
|
||||
@@ -345,7 +360,7 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachModule(@NotNull final Processor<Module> processor) {
|
||||
public void forEachModule(@NotNull final Processor<? super Module> processor) {
|
||||
forEach((orderEntry, customHandlers) -> {
|
||||
if (myRecursively && orderEntry instanceof ModuleSourceOrderEntry) {
|
||||
final Module module = ((ModuleSourceOrderEntry)orderEntry).getRootModel().getModule();
|
||||
@@ -459,7 +474,7 @@ abstract class OrderEnumeratorBase extends OrderEnumerator implements OrderEnume
|
||||
private R myValue;
|
||||
private final RootPolicy<R> myPolicy;
|
||||
|
||||
private OrderEntryProcessor(RootPolicy<R> policy, R initialValue) {
|
||||
private OrderEntryProcessor(@NotNull RootPolicy<R> policy, R initialValue) {
|
||||
myPolicy = policy;
|
||||
myValue = initialValue;
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ import java.util.List;
|
||||
public class ProjectOrderEnumerator extends OrderEnumeratorBase {
|
||||
private final Project myProject;
|
||||
|
||||
public ProjectOrderEnumerator(Project project, OrderRootsCache rootsCache) {
|
||||
public ProjectOrderEnumerator(@NotNull Project project, @NotNull OrderRootsCache rootsCache) {
|
||||
super(rootsCache);
|
||||
myProject = project;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class ProjectOrderEnumerator extends OrderEnumeratorBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachModule(@NotNull Processor<Module> processor) {
|
||||
public void forEachModule(@NotNull Processor<? super Module> processor) {
|
||||
processRootModules(processor);
|
||||
}
|
||||
|
||||
|
||||
@@ -460,8 +460,8 @@ public class RootIndex {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable Pair<VirtualFile, Collection<Object>> libraryClassRootInfo = myRootInfo.findLibraryRootInfo(roots, false);
|
||||
@Nullable Pair<VirtualFile, Collection<Object>> librarySourceRootInfo = myRootInfo.findLibraryRootInfo(roots, true);
|
||||
@Nullable Pair<VirtualFile, Collection<?>> libraryClassRootInfo = myRootInfo.findLibraryRootInfo(roots, false);
|
||||
@Nullable Pair<VirtualFile, Collection<?>> librarySourceRootInfo = myRootInfo.findLibraryRootInfo(roots, true);
|
||||
result.addAll(myRootInfo.getLibraryOrderEntries(roots,
|
||||
Pair.getFirst(libraryClassRootInfo),
|
||||
Pair.getFirst(librarySourceRootInfo),
|
||||
@@ -582,7 +582,7 @@ public class RootIndex {
|
||||
}
|
||||
|
||||
@Nullable("returns null only if dir is under ignored folder")
|
||||
private static List<VirtualFile> getHierarchy(VirtualFile dir, @NotNull Set<VirtualFile> allRoots, @NotNull RootInfo info) {
|
||||
private static List<VirtualFile> getHierarchy(VirtualFile dir, @NotNull Set<? extends VirtualFile> allRoots, @NotNull RootInfo info) {
|
||||
List<VirtualFile> hierarchy = ContainerUtil.newArrayList();
|
||||
boolean hasContentRoots = false;
|
||||
while (dir != null) {
|
||||
@@ -635,7 +635,7 @@ public class RootIndex {
|
||||
* root and there are no source roots on the path to the excluded root) returns {@code null}.
|
||||
*/
|
||||
@Nullable
|
||||
private VirtualFile findNearestContentRoot(@NotNull List<VirtualFile> hierarchy) {
|
||||
private VirtualFile findNearestContentRoot(@NotNull List<? extends VirtualFile> hierarchy) {
|
||||
Collection<Module> sourceRootOwners = null;
|
||||
boolean underExcludedSourceRoot = false;
|
||||
for (VirtualFile root : hierarchy) {
|
||||
@@ -674,7 +674,7 @@ public class RootIndex {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isExcludedByPattern(VirtualFile contentRoot, List<VirtualFile> hierarchy, FileTypeAssocTable<Boolean> table) {
|
||||
private static boolean isExcludedByPattern(@NotNull VirtualFile contentRoot, List<? extends VirtualFile> hierarchy, @NotNull FileTypeAssocTable<Boolean> table) {
|
||||
for (VirtualFile file : hierarchy) {
|
||||
if (table.findAssociatedFileType(file.getNameSequence()) != null) {
|
||||
return true;
|
||||
@@ -687,7 +687,7 @@ public class RootIndex {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private VirtualFile findNearestContentRootForExcluded(@NotNull List<VirtualFile> hierarchy) {
|
||||
private VirtualFile findNearestContentRootForExcluded(@NotNull List<? extends VirtualFile> hierarchy) {
|
||||
for (VirtualFile root : hierarchy) {
|
||||
if (contentRootOf.containsKey(root) || contentRootOfUnloaded.containsKey(root)) {
|
||||
return root;
|
||||
@@ -700,7 +700,7 @@ public class RootIndex {
|
||||
* @return root and set of libraries that provided it
|
||||
*/
|
||||
@Nullable
|
||||
private Pair<VirtualFile, Collection<Object>> findLibraryRootInfo(@NotNull List<VirtualFile> hierarchy, boolean source) {
|
||||
private Pair<VirtualFile, Collection<?>> findLibraryRootInfo(@NotNull List<? extends VirtualFile> hierarchy, boolean source) {
|
||||
Set<Object> librariesToIgnore = ContainerUtil.newHashSet();
|
||||
for (VirtualFile root : hierarchy) {
|
||||
librariesToIgnore.addAll(excludedFromLibraries.get(root));
|
||||
@@ -727,9 +727,9 @@ public class RootIndex {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Collection<Object> findLibraryRootProducers(@NotNull Collection<Object> producers,
|
||||
private static Collection<Object> findLibraryRootProducers(@NotNull Collection<?> producers,
|
||||
@NotNull VirtualFile root,
|
||||
@NotNull Set<Object> librariesToIgnore) {
|
||||
@NotNull Set<?> librariesToIgnore) {
|
||||
Set<Object> libraries = ContainerUtil.newHashSet();
|
||||
for (Object library : producers) {
|
||||
if (librariesToIgnore.contains(library)) continue;
|
||||
@@ -745,7 +745,7 @@ public class RootIndex {
|
||||
}
|
||||
|
||||
private String calcPackagePrefix(@NotNull VirtualFile root,
|
||||
@NotNull List<VirtualFile> hierarchy,
|
||||
@NotNull List<? extends VirtualFile> hierarchy,
|
||||
VirtualFile moduleContentRoot,
|
||||
VirtualFile libraryClassRoot,
|
||||
VirtualFile librarySourceRoot) {
|
||||
@@ -760,7 +760,7 @@ public class RootIndex {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private VirtualFile findPackageRootInfo(@NotNull List<VirtualFile> hierarchy,
|
||||
private VirtualFile findPackageRootInfo(@NotNull List<? extends VirtualFile> hierarchy,
|
||||
VirtualFile moduleContentRoot,
|
||||
VirtualFile libraryClassRoot,
|
||||
VirtualFile librarySourceRoot) {
|
||||
@@ -781,7 +781,7 @@ public class RootIndex {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private LinkedHashSet<OrderEntry> getLibraryOrderEntries(@NotNull List<VirtualFile> hierarchy,
|
||||
private LinkedHashSet<OrderEntry> getLibraryOrderEntries(@NotNull List<? extends VirtualFile> hierarchy,
|
||||
@Nullable VirtualFile libraryClassRoot,
|
||||
@Nullable VirtualFile librarySourceRoot,
|
||||
@NotNull MultiMap<VirtualFile, OrderEntry> libClassRootEntries,
|
||||
@@ -803,7 +803,7 @@ public class RootIndex {
|
||||
|
||||
|
||||
@Nullable
|
||||
private ModuleSourceOrderEntry getModuleSourceEntry(@NotNull List<VirtualFile> hierarchy,
|
||||
private ModuleSourceOrderEntry getModuleSourceEntry(@NotNull List<? extends VirtualFile> hierarchy,
|
||||
@NotNull VirtualFile moduleContentRoot,
|
||||
@NotNull MultiMap<VirtualFile, OrderEntry> libClassRootEntries) {
|
||||
Module module = contentRootOf.get(moduleContentRoot);
|
||||
@@ -821,13 +821,13 @@ public class RootIndex {
|
||||
|
||||
@NotNull
|
||||
private static Pair<DirectoryInfo, String> calcDirectoryInfo(@NotNull final VirtualFile root,
|
||||
@NotNull final List<VirtualFile> hierarchy,
|
||||
@NotNull final List<? extends VirtualFile> hierarchy,
|
||||
@NotNull RootInfo info) {
|
||||
VirtualFile moduleContentRoot = info.findNearestContentRoot(hierarchy);
|
||||
Pair<VirtualFile, Collection<Object>> librarySourceRootInfo = info.findLibraryRootInfo(hierarchy, true);
|
||||
Pair<VirtualFile, Collection<?>> librarySourceRootInfo = info.findLibraryRootInfo(hierarchy, true);
|
||||
VirtualFile librarySourceRoot = Pair.getFirst(librarySourceRootInfo);
|
||||
|
||||
Pair<VirtualFile, Collection<Object>> libraryClassRootInfo = info.findLibraryRootInfo(hierarchy, false);
|
||||
Pair<VirtualFile, Collection<?>> libraryClassRootInfo = info.findLibraryRootInfo(hierarchy, false);
|
||||
VirtualFile libraryClassRoot = Pair.getFirst(libraryClassRootInfo);
|
||||
|
||||
boolean inProject = moduleContentRoot != null ||
|
||||
@@ -871,7 +871,7 @@ public class RootIndex {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Condition<VirtualFile> getLibraryExclusionPredicate(@Nullable Pair<VirtualFile, Collection<Object>> libraryRootInfo) {
|
||||
private static Condition<VirtualFile> getLibraryExclusionPredicate(@Nullable Pair<VirtualFile, Collection<?>> libraryRootInfo) {
|
||||
Condition<VirtualFile> result = Conditions.alwaysFalse();
|
||||
if (libraryRootInfo != null) {
|
||||
for (Object library : libraryRootInfo.second) {
|
||||
|
||||
Reference in New Issue
Block a user