This is needed to allow referencing ModuleDescription from GlobalSearchScope. The classes were converted to Java because we cannot use Kotlin in core-api module which is used inside the Kotlin compiler. Properties were converted to functions in implementations because Kotlin doesn't allow overriding Java getters with properties (KT-6653).
--- /dev/null
+/*
+ * Copyright 2000-2017 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.module;
+
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author nik
+ */
+@ApiStatus.Experimental
+public interface LoadedModuleDescription extends ModuleDescription {
+ @NotNull
+ Module getModule();
+}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.intellij.openapi.module
+package com.intellij.openapi.module;
-import com.intellij.openapi.vfs.pointers.VirtualFilePointer
-import org.jetbrains.annotations.ApiStatus
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
/**
* Represents a description of a module which may be either loaded into the project or unloaded. Use this class only if you need to process
- * all modules including unloaded, in other cases [Module] should be used instead.
- * @see [ModuleManager.getUnloadedModuleDescriptions]
+ * all modules including unloaded, in other cases {@link Module} should be used instead.
+ *
+ * @see UnloadedModuleDescription
+ * @see LoadedModuleDescription
* @author nik
*/
@ApiStatus.Experimental
-interface ModuleDescription {
- val name: String
+public interface ModuleDescription {
+ @NotNull
+ String getName();
/**
* Names of the modules on which the current module depend.
*/
- val dependencyModuleNames: List<String>
+ @NotNull
+ List<String> getDependencyModuleNames();
}
-
-@ApiStatus.Experimental
-interface UnloadedModuleDescription : ModuleDescription {
- val contentRoots: List<VirtualFilePointer>
- val groupPath: List<String>
-}
-
-@ApiStatus.Experimental
-interface LoadedModuleDescription : ModuleDescription {
- val module: Module
-}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2000-2017 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.module;
+
+import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+/**
+ * @author nik
+ */
+@ApiStatus.Experimental
+public interface UnloadedModuleDescription extends ModuleDescription {
+ @NotNull
+ List<VirtualFilePointer> getContentRoots();
+
+ @NotNull
+ List<String> getGroupPath();
+}
/**
* @author nik
*/
-class LoadedModuleDescriptionImpl(override val module: Module): LoadedModuleDescription {
- override val name: String
- get() = module.name
+class LoadedModuleDescriptionImpl(private val module: Module): LoadedModuleDescription {
+ override fun getModule() = module
- override val dependencyModuleNames: List<String>
- get() = ModuleRootManager.getInstance(module).dependencyModuleNames.asList()
+ override fun getName() = module.name
+
+ override fun getDependencyModuleNames() = ModuleRootManager.getInstance(module).dependencyModuleNames.asList()
}
\ No newline at end of file
* @author nik
*/
class UnloadedModuleDescriptionImpl(val modulePath: ModulePath,
- override val dependencyModuleNames: List<String>,
- override val contentRoots: List<VirtualFilePointer>) : UnloadedModuleDescription {
- override val groupPath: List<String>
- get() = modulePath.group?.split(ModuleManagerImpl.MODULE_GROUP_SEPARATOR) ?: emptyList()
+ private val dependencyModuleNames: List<String>,
+ private val contentRoots: List<VirtualFilePointer>) : UnloadedModuleDescription {
+ override fun getGroupPath() = modulePath.group?.split(ModuleManagerImpl.MODULE_GROUP_SEPARATOR) ?: emptyList()
- override val name: String
- get() = modulePath.moduleName
+ override fun getName() = modulePath.moduleName
+
+ override fun getContentRoots() = contentRoots
+
+ override fun getDependencyModuleNames() = dependencyModuleNames
companion object {
@JvmStatic