Fix a number of compiler/IDE warnings in IDE and kapt modules

This commit is contained in:
Yan Zhulanow
2019-08-07 16:45:20 +09:00
parent 9fb622e148
commit f93549748a
22 changed files with 98 additions and 58 deletions
@@ -22,6 +22,7 @@ interface BuildSystemTypeDetector {
} }
fun Module.getBuildSystemType(): BuildSystemType { fun Module.getBuildSystemType(): BuildSystemType {
@Suppress("DEPRECATION")
for (extension in Extensions.getExtensions(BuildSystemTypeDetector.EP_NAME)) { for (extension in Extensions.getExtensions(BuildSystemTypeDetector.EP_NAME)) {
val result = extension.detectBuildSystemType(this) val result = extension.detectBuildSystemType(this)
if (result != null) { if (result != null) {
@@ -31,15 +31,18 @@ abstract class AfterAnalysisHighlightingVisitor protected constructor(
holder: AnnotationHolder, protected var bindingContext: BindingContext holder: AnnotationHolder, protected var bindingContext: BindingContext
) : HighlightingVisitor(holder) { ) : HighlightingVisitor(holder) {
protected fun attributeKeyForDeclarationFromExtensions(element: PsiElement, descriptor: DeclarationDescriptor) = protected fun attributeKeyForDeclarationFromExtensions(element: PsiElement, descriptor: DeclarationDescriptor): TextAttributesKey? {
Extensions.getExtensions(HighlighterExtension.EP_NAME).firstNotNullResult { extension -> @Suppress("DEPRECATION")
return Extensions.getExtensions(HighlighterExtension.EP_NAME).firstNotNullResult { extension ->
extension.highlightDeclaration(element, descriptor) extension.highlightDeclaration(element, descriptor)
} }
}
protected fun attributeKeyForCallFromExtensions( protected fun attributeKeyForCallFromExtensions(
expression: KtSimpleNameExpression, expression: KtSimpleNameExpression,
resolvedCall: ResolvedCall<out CallableDescriptor> resolvedCall: ResolvedCall<out CallableDescriptor>
): TextAttributesKey? { ): TextAttributesKey? {
@Suppress("DEPRECATION")
return Extensions.getExtensions(HighlighterExtension.EP_NAME).firstNotNullResult { extension -> return Extensions.getExtensions(HighlighterExtension.EP_NAME).firstNotNullResult { extension ->
extension.highlightCall(expression, resolvedCall) extension.highlightCall(expression, resolvedCall)
} }
@@ -77,7 +77,10 @@ internal class FunctionsHighlightingVisitor(holder: AnnotationHolder, bindingCon
private fun highlightCall(callee: PsiElement, resolvedCall: ResolvedCall<out CallableDescriptor>) { private fun highlightCall(callee: PsiElement, resolvedCall: ResolvedCall<out CallableDescriptor>) {
val calleeDescriptor = resolvedCall.resultingDescriptor val calleeDescriptor = resolvedCall.resultingDescriptor
val key = Extensions.getExtensions(HighlighterExtension.EP_NAME).firstNotNullResult { extension -> @Suppress("DEPRECATION")
val extensions = Extensions.getExtensions(HighlighterExtension.EP_NAME)
val key = extensions.firstNotNullResult { extension ->
extension.highlightCall(callee, resolvedCall) extension.highlightCall(callee, resolvedCall)
} ?: when { } ?: when {
calleeDescriptor.fqNameOrNull() == KOTLIN_SUSPEND_BUILT_IN_FUNCTION_FQ_NAME -> KEYWORD calleeDescriptor.fqNameOrNull() == KOTLIN_SUSPEND_BUILT_IN_FUNCTION_FQ_NAME -> KEYWORD
@@ -42,6 +42,7 @@ internal class PropertiesHighlightingVisitor(holder: AnnotationHolder, bindingCo
val resolvedCall = expression.getResolvedCall(bindingContext) val resolvedCall = expression.getResolvedCall(bindingContext)
val attributesKey = resolvedCall?.let { call -> val attributesKey = resolvedCall?.let { call ->
@Suppress("DEPRECATION")
Extensions.getExtensions(HighlighterExtension.EP_NAME).firstNotNullResult { extension -> Extensions.getExtensions(HighlighterExtension.EP_NAME).firstNotNullResult { extension ->
extension.highlightCall(expression, call) extension.highlightCall(expression, call)
} }
@@ -29,6 +29,7 @@ class QuickFixes {
private val actions: Multimap<DiagnosticFactory<*>, IntentionAction> = HashMultimap.create<DiagnosticFactory<*>, IntentionAction>() private val actions: Multimap<DiagnosticFactory<*>, IntentionAction> = HashMultimap.create<DiagnosticFactory<*>, IntentionAction>()
init { init {
@Suppress("DEPRECATION")
Extensions.getExtensions(QuickFixContributor.EP_NAME).forEach { it.registerQuickFixes(this) } Extensions.getExtensions(QuickFixContributor.EP_NAME).forEach { it.registerQuickFixes(this) }
} }
@@ -75,7 +75,10 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator {
} }
private fun PsiFile.isConfiguredByAnyGradleConfigurator(): Boolean { private fun PsiFile.isConfiguredByAnyGradleConfigurator(): Boolean {
return Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME) @Suppress("DEPRECATION")
val extensions = Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME)
return extensions
.filterIsInstance<KotlinWithGradleConfigurator>() .filterIsInstance<KotlinWithGradleConfigurator>()
.any { it.isFileConfigured(this) } .any { it.isFileConfigured(this) }
} }
@@ -52,7 +52,10 @@ fun DataNode<*>.getResolvedVersionByModuleData(groupId: String, libraryIds: List
} }
fun getDependencyModules(moduleData: DataNode<ModuleData>, gradleIdeaProject: IdeaProject): Collection<DataNode<ModuleData>> { fun getDependencyModules(moduleData: DataNode<ModuleData>, gradleIdeaProject: IdeaProject): Collection<DataNode<ModuleData>> {
for (modelFacade in Extensions.getExtensions(KotlinGradleModelFacade.EP_NAME)) { @Suppress("DEPRECATION")
val extensions = Extensions.getExtensions(KotlinGradleModelFacade.EP_NAME)
for (modelFacade in extensions) {
val dependencies = modelFacade.getDependencyModules(moduleData, gradleIdeaProject) val dependencies = modelFacade.getDependencyModules(moduleData, gradleIdeaProject)
if (dependencies.isNotEmpty()) { if (dependencies.isNotEmpty()) {
return dependencies return dependencies
@@ -61,9 +64,10 @@ fun getDependencyModules(moduleData: DataNode<ModuleData>, gradleIdeaProject: Id
return emptyList() return emptyList()
} }
// Removing the 'gradleIdeaProject' parameter, removing it breaks importer for some reason
fun findModulesByNames( fun findModulesByNames(
dependencyModuleNames: Set<String>, dependencyModuleNames: Set<String>,
gradleIdeaProject: IdeaProject, @Suppress("UNUSED_PARAMETER") gradleIdeaProject: IdeaProject,
ideProject: DataNode<ProjectData> ideProject: DataNode<ProjectData>
): LinkedHashSet<DataNode<ModuleData>> { ): LinkedHashSet<DataNode<ModuleData>> {
val modules = ExternalSystemApiUtil.getChildren(ideProject, ProjectKeys.MODULE) val modules = ExternalSystemApiUtil.getChildren(ideProject, ProjectKeys.MODULE)
@@ -180,7 +180,10 @@ fun getConfiguratorByName(name: String): KotlinProjectConfigurator? {
return allConfigurators().firstOrNull { it.name == name } return allConfigurators().firstOrNull { it.name == name }
} }
fun allConfigurators() = Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME) fun allConfigurators(): Array<KotlinProjectConfigurator> {
@Suppress("DEPRECATION")
return Extensions.getExtensions(KotlinProjectConfigurator.EP_NAME)
}
fun getCanBeConfiguredModules(project: Project, configurator: KotlinProjectConfigurator): List<Module> { fun getCanBeConfiguredModules(project: Project, configurator: KotlinProjectConfigurator): List<Module> {
return ModuleSourceRootMap(project).groupByBaseModules(project.allModules()) return ModuleSourceRootMap(project).groupByBaseModules(project.allModules())
@@ -224,6 +227,7 @@ fun getConfigurationPossibilitiesForConfigureNotification(
runnableConfigurators.add(configurator) runnableConfigurators.add(configurator)
} }
ConfigureKotlinStatus.CONFIGURED -> moduleAlreadyConfigured = true ConfigureKotlinStatus.CONFIGURED -> moduleAlreadyConfigured = true
else -> {}
} }
} }
if (moduleCanBeConfigured && !moduleAlreadyConfigured && !SuppressNotificationState.isKotlinNotConfiguredSuppressed( if (moduleCanBeConfigured && !moduleAlreadyConfigured && !SuppressNotificationState.isKotlinNotConfiguredSuppressed(
@@ -271,7 +275,7 @@ fun hasKotlinCommonRuntimeInScope(scope: GlobalSearchScope): Boolean {
class LibraryKindSearchScope( class LibraryKindSearchScope(
val module: Module, val module: Module,
val baseScope: GlobalSearchScope, baseScope: GlobalSearchScope,
val libraryKind: PersistentLibraryKind<*> val libraryKind: PersistentLibraryKind<*>
) : DelegatingGlobalSearchScope(baseScope) { ) : DelegatingGlobalSearchScope(baseScope) {
override fun contains(file: VirtualFile): Boolean { override fun contains(file: VirtualFile): Boolean {
@@ -28,7 +28,6 @@ import com.intellij.openapi.roots.OrderRootType
import com.intellij.openapi.roots.impl.libraries.LibraryEx import com.intellij.openapi.roots.impl.libraries.LibraryEx
import com.intellij.openapi.roots.libraries.Library import com.intellij.openapi.roots.libraries.Library
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.idea.compiler.configuration.Kotlin2JvmCompilerArgumentsHolder import org.jetbrains.kotlin.idea.compiler.configuration.Kotlin2JvmCompilerArgumentsHolder
import org.jetbrains.kotlin.idea.facet.getOrCreateFacet import org.jetbrains.kotlin.idea.facet.getOrCreateFacet
import org.jetbrains.kotlin.idea.facet.initializeIfNeeded import org.jetbrains.kotlin.idea.facet.initializeIfNeeded
@@ -39,7 +38,6 @@ import org.jetbrains.kotlin.idea.util.projectStructure.allModules
import org.jetbrains.kotlin.idea.util.projectStructure.sdk import org.jetbrains.kotlin.idea.util.projectStructure.sdk
import org.jetbrains.kotlin.idea.util.projectStructure.version import org.jetbrains.kotlin.idea.util.projectStructure.version
import org.jetbrains.kotlin.idea.versions.LibraryJarDescriptor import org.jetbrains.kotlin.idea.versions.LibraryJarDescriptor
import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind
import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
@@ -73,11 +71,11 @@ open class KotlinJavaModuleConfigurator protected constructor() : KotlinWithLibr
override val targetPlatform: TargetPlatform override val targetPlatform: TargetPlatform
get() = JvmPlatforms.unspecifiedJvmPlatform get() = JvmPlatforms.unspecifiedJvmPlatform
@Suppress("DEPRECATION_ERROR") @Suppress("DEPRECATION_ERROR", "OverridingDeprecatedMember")
override fun getTargetPlatform() = JvmPlatforms.CompatJvmPlatform override fun getTargetPlatform() = JvmPlatforms.CompatJvmPlatform
override fun getLibraryJarDescriptors(sdk: Sdk?): List<LibraryJarDescriptor> { override fun getLibraryJarDescriptors(sdk: Sdk?): List<LibraryJarDescriptor> {
var result = listOf( val result = mutableListOf(
LibraryJarDescriptor.RUNTIME_JAR, LibraryJarDescriptor.RUNTIME_JAR,
LibraryJarDescriptor.RUNTIME_SRC_JAR, LibraryJarDescriptor.RUNTIME_SRC_JAR,
LibraryJarDescriptor.REFLECT_JAR, LibraryJarDescriptor.REFLECT_JAR,
@@ -142,7 +140,10 @@ open class KotlinJavaModuleConfigurator protected constructor() : KotlinWithLibr
const val NAME = "java" const val NAME = "java"
val instance: KotlinJavaModuleConfigurator val instance: KotlinJavaModuleConfigurator
get() = Extensions.findExtension(KotlinProjectConfigurator.EP_NAME, KotlinJavaModuleConfigurator::class.java) get() {
@Suppress("DEPRECATION")
return Extensions.findExtension(KotlinProjectConfigurator.EP_NAME, KotlinJavaModuleConfigurator::class.java)
}
} }
private fun hasBrokenJsRuntime(module: Module): Boolean { private fun hasBrokenJsRuntime(module: Module): Boolean {
@@ -50,6 +50,7 @@ class JSLibraryType : LibraryType<DummyLibraryProperties>(JSLibraryKind) {
override fun getIcon(properties: DummyLibraryProperties?) = KotlinIcons.JS override fun getIcon(properties: DummyLibraryProperties?) = KotlinIcons.JS
companion object { companion object {
@Suppress("DEPRECATION")
fun getInstance() = Extensions.findExtension(EP_NAME, JSLibraryType::class.java) fun getInstance() = Extensions.findExtension(EP_NAME, JSLibraryType::class.java)
} }
@@ -56,6 +56,8 @@ class KotlinTemplatesFactory : ProjectTemplatesFactory() {
) )
) )
) )
@Suppress("DEPRECATION")
result.addAll(Extensions.getExtensions(EP_NAME).map { BuilderBasedTemplate(it) }) result.addAll(Extensions.getExtensions(EP_NAME).map { BuilderBasedTemplate(it) })
return result.toTypedArray() return result.toTypedArray()
} }
@@ -190,7 +190,10 @@ internal fun findProblem(
internal fun getQualifiedNameFromProviders(element: PsiElement): String? { internal fun getQualifiedNameFromProviders(element: PsiElement): String? {
DumbService.getInstance(element.project).isAlternativeResolveEnabled = true DumbService.getInstance(element.project).isAlternativeResolveEnabled = true
try { try {
for (provider in Extensions.getExtensions(QualifiedNameProvider.EP_NAME)) { @Suppress("DEPRECATION")
val extensions = Extensions.getExtensions(QualifiedNameProvider.EP_NAME)
for (provider in extensions) {
val result = provider.getQualifiedName(element) val result = provider.getQualifiedName(element)
if (result != null) return result if (result != null) return result
} }
@@ -25,7 +25,7 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.PsiReference import com.intellij.psi.PsiReference
import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.searches.ReferencesSearch import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.xdebugger.impl.XDebugSessionImpl import com.intellij.xdebugger.impl.XDebuggerManagerImpl
import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.idea.debugger.DebuggerClassNameProvider.Companion.getRelevantElement import org.jetbrains.kotlin.idea.debugger.DebuggerClassNameProvider.Companion.getRelevantElement
@@ -75,7 +75,7 @@ class InlineCallableUsagesSearcher(private val myDebugProcess: DebugProcess) {
} }
if (!isSuccess) { if (!isSuccess) {
XDebugSessionImpl.NOTIFICATION_GROUP.createNotification( XDebuggerManagerImpl.NOTIFICATION_GROUP.createNotification(
"Debugger can skip some executions of $declarationName because the computation of class names was interrupted", "Debugger can skip some executions of $declarationName because the computation of class names was interrupted",
MessageType.WARNING MessageType.WARNING
).notify(myDebugProcess.project) ).notify(myDebugProcess.project)
@@ -26,15 +26,12 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.psi.*; import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.GlobalSearchScope;
import kotlin.Unit; import kotlin.Unit;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.idea.core.util.DescriptorMemberChooserObject; import org.jetbrains.kotlin.idea.core.util.DescriptorMemberChooserObject;
import org.jetbrains.kotlin.idea.core.util.UiUtilsKt; import org.jetbrains.kotlin.idea.core.util.UiUtilsKt;
import org.jetbrains.kotlin.psi.KtProperty; import org.jetbrains.kotlin.psi.KtProperty;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List; import java.util.List;
public abstract class AddFieldBreakpointDialog extends DialogWrapper { public abstract class AddFieldBreakpointDialog extends DialogWrapper {
@@ -60,43 +57,41 @@ public abstract class AddFieldBreakpointDialog extends DialogWrapper {
} }
); );
myClassChooser.addActionListener(new ActionListener() { myClassChooser.addActionListener(e -> {
@Override PsiClass currentClass = getSelectedClass();
public void actionPerformed(ActionEvent e) { TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createAllProjectScopeChooser(
PsiClass currentClass = getSelectedClass(); DebuggerBundle.message("add.field.breakpoint.dialog.classchooser.title"));
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createAllProjectScopeChooser( if (currentClass != null) {
DebuggerBundle.message("add.field.breakpoint.dialog.classchooser.title")); PsiFile containingFile = currentClass.getContainingFile();
if (currentClass != null) { if (containingFile != null) {
PsiFile containingFile = currentClass.getContainingFile(); PsiDirectory containingDirectory = containingFile.getContainingDirectory();
if (containingFile != null) { if (containingDirectory != null) {
PsiDirectory containingDirectory = containingFile.getContainingDirectory(); chooser.selectDirectory(containingDirectory);
if (containingDirectory != null) {
chooser.selectDirectory(containingDirectory);
}
} }
} }
chooser.showDialog(); }
PsiClass selectedClass = chooser.getSelected(); chooser.showDialog();
if (selectedClass != null) { PsiClass selectedClass = chooser.getSelected();
myClassChooser.setText(selectedClass.getQualifiedName()); if (selectedClass != null) {
} myClassChooser.setText(selectedClass.getQualifiedName());
} }
}); });
myFieldChooser.addActionListener(new ActionListener() { myFieldChooser.addActionListener(e -> {
@Override PsiClass selectedClass = getSelectedClass();
public void actionPerformed(@NotNull ActionEvent e) { if (selectedClass == null) {
PsiClass selectedClass = getSelectedClass(); return;
DescriptorMemberChooserObject[] properties = FieldBreakpointDialogUtilKt.collectProperties(selectedClass); }
MemberChooser<DescriptorMemberChooserObject> chooser = new MemberChooser<DescriptorMemberChooserObject>(properties, false, false, myProject);
chooser.setTitle(DebuggerBundle.message("add.field.breakpoint.dialog.field.chooser.title", properties.length)); DescriptorMemberChooserObject[] properties = FieldBreakpointDialogUtilKt.collectProperties(selectedClass);
chooser.setCopyJavadocVisible(false); MemberChooser<DescriptorMemberChooserObject> chooser = new MemberChooser<>(properties, false, false, myProject);
chooser.show(); chooser.setTitle(DebuggerBundle.message("add.field.breakpoint.dialog.field.chooser.title", properties.length));
List<DescriptorMemberChooserObject> selectedElements = chooser.getSelectedElements(); chooser.setCopyJavadocVisible(false);
if (selectedElements != null && selectedElements.size() == 1) { chooser.show();
KtProperty field = (KtProperty) selectedElements.get(0).getElement(); List<DescriptorMemberChooserObject> selectedElements = chooser.getSelectedElements();
myFieldChooser.setText(field.getName()); if (selectedElements != null && selectedElements.size() == 1) {
} KtProperty field = (KtProperty) selectedElements.get(0).getElement();
myFieldChooser.setText(field.getName());
} }
}); });
myFieldChooser.setEnabled(false); myFieldChooser.setEnabled(false);
@@ -111,7 +106,7 @@ public abstract class AddFieldBreakpointDialog extends DialogWrapper {
private PsiClass getSelectedClass() { private PsiClass getSelectedClass() {
PsiManager psiManager = PsiManager.getInstance(myProject); PsiManager psiManager = PsiManager.getInstance(myProject);
String classQName = myClassChooser.getText(); String classQName = myClassChooser.getText();
if (classQName == null || classQName.isEmpty()) { if (classQName.isEmpty()) {
return null; return null;
} }
return JavaPsiFacade.getInstance(psiManager.getProject()).findClass(classQName, GlobalSearchScope.allScope(myProject)); return JavaPsiFacade.getInstance(psiManager.getProject()).findClass(classQName, GlobalSearchScope.allScope(myProject));
@@ -179,6 +179,7 @@ public class DebuggerSteppingHelper {
} }
} }
} }
//noinspection deprecation
for (DebuggerClassFilterProvider provider : Extensions.getExtensions(DebuggerClassFilterProvider.EP_NAME)) { for (DebuggerClassFilterProvider provider : Extensions.getExtensions(DebuggerClassFilterProvider.EP_NAME)) {
for (ClassFilter filter : provider.getFilters()) { for (ClassFilter filter : provider.getFilters()) {
if (filter.isEnabled()) { if (filter.isEnabled()) {
@@ -31,7 +31,11 @@ class KotlinRenameDispatcherHandler : RenameHandler {
companion object { companion object {
val EP_NAME = ExtensionPointName<RenameHandler>("org.jetbrains.kotlin.renameHandler") val EP_NAME = ExtensionPointName<RenameHandler>("org.jetbrains.kotlin.renameHandler")
private val handlers: Array<out RenameHandler> get() = Extensions.getExtensions(EP_NAME) private val handlers: Array<out RenameHandler>
get() {
@Suppress("DEPRECATION")
return Extensions.getExtensions(EP_NAME)
}
} }
internal fun getRenameHandler(dataContext: DataContext): RenameHandler? { internal fun getRenameHandler(dataContext: DataContext): RenameHandler? {
@@ -162,7 +162,9 @@ abstract class AbstractFindUsagesTest : KotlinLightCodeInsightFixtureTestCase()
return UsageType.COMMENT_USAGE return UsageType.COMMENT_USAGE
} }
@Suppress("DEPRECATION")
val providers = Extensions.getExtensions(UsageTypeProvider.EP_NAME) val providers = Extensions.getExtensions(UsageTypeProvider.EP_NAME)
return providers return providers
.mapNotNull { .mapNotNull {
it.getUsageType(element) it.getUsageType(element)
@@ -67,7 +67,9 @@ class InspectionDescriptionTest : LightPlatformTestCase() {
fun testExtensionPoints() { fun testExtensionPoints() {
val shortNames = THashMap<String, LocalInspectionEP>() val shortNames = THashMap<String, LocalInspectionEP>()
@Suppress("DEPRECATION")
val inspectionEPs = Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION) val inspectionEPs = Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION)
val tools = inspectionEPs.size val tools = inspectionEPs.size
val errors = StringBuilder() val errors = StringBuilder()
for (ep in inspectionEPs) { for (ep in inspectionEPs) {
@@ -66,11 +66,17 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
private fun enableInspectionTools(klass: Class<*>) { private fun enableInspectionTools(klass: Class<*>) {
val eps = ContainerUtil.newArrayList<InspectionEP>() val eps = ContainerUtil.newArrayList<InspectionEP>()
ContainerUtil.addAll(eps, *Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION)) ContainerUtil.addAll<InspectionEP, LocalInspectionEP, List<InspectionEP>>(
ContainerUtil.addAll(eps, *Extensions.getExtensions(InspectionEP.GLOBAL_INSPECTION)) eps,
*(@Suppress("DEPRECATION") Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION))
)
ContainerUtil.addAll<InspectionEP, InspectionEP, List<InspectionEP>>(
eps,
*(@Suppress("DEPRECATION") Extensions.getExtensions(InspectionEP.GLOBAL_INSPECTION))
)
val tool = eps.firstOrNull { it.implementationClass == klass.name }?.instantiateTool() val tool = eps.firstOrNull { it.implementationClass == klass.name }?.instantiateTool()
?: error("Could not find inspection tool for class: $klass") ?: error("Could not find inspection tool for class: $klass")
myFixture.enableInspections(tool) myFixture.enableInspections(tool)
} }
@@ -47,7 +47,10 @@ abstract class AbstractInlineTest : KotlinLightCodeInsightFixtureTestCase() {
val afterFileExists = afterFile.exists() val afterFileExists = afterFile.exists()
val targetElement = TargetElementUtil.findTargetElement(myFixture.editor, ELEMENT_NAME_ACCEPTED or REFERENCED_ELEMENT_ACCEPTED)!! val targetElement = TargetElementUtil.findTargetElement(myFixture.editor, ELEMENT_NAME_ACCEPTED or REFERENCED_ELEMENT_ACCEPTED)!!
@Suppress("DEPRECATION")
val handler = Extensions.getExtensions(InlineActionHandler.EP_NAME).firstOrNull { it.canInlineElement(targetElement) } val handler = Extensions.getExtensions(InlineActionHandler.EP_NAME).firstOrNull { it.canInlineElement(targetElement) }
val expectedErrors = InTextDirectivesUtils.findLinesWithPrefixesRemoved(myFixture.file.text, "// ERROR: ") val expectedErrors = InTextDirectivesUtils.findLinesWithPrefixesRemoved(myFixture.file.text, "// ERROR: ")
if (handler != null) { if (handler != null) {
try { try {
@@ -416,10 +416,11 @@ fun runRenameProcessor(
val processor = createProcessor() val processor = createProcessor()
if (renameParamsObject["overloadRenamer.onlyPrimaryElement"]?.asBoolean ?: false) { if (renameParamsObject["overloadRenamer.onlyPrimaryElement"]?.asBoolean == true) {
with(AutomaticOverloadsRenamer) { substitution.elementFilter = { false } } with(AutomaticOverloadsRenamer) { substitution.elementFilter = { false } }
} }
if (processor is RenameProcessor) { if (processor is RenameProcessor) {
@Suppress("DEPRECATION")
Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME).forEach { processor.addRenamerFactory(it) } Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME).forEach { processor.addRenamerFactory(it) }
} }
processor.run() processor.run()
-1
View File
@@ -31,7 +31,6 @@ fun main(args: Array<String>) {
if (messageCollector.hasErrors()) { if (messageCollector.hasErrors()) {
exitProcess(ExitCode.COMPILATION_ERROR.code) exitProcess(ExitCode.COMPILATION_ERROR.code)
return
} }
K2JVMCompiler.main(kaptTransformed.toTypedArray()) K2JVMCompiler.main(kaptTransformed.toTypedArray())