diff --git a/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt b/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt index 73656ac2f8f..abd90a587a5 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +@file:Suppress("UNUSED_PARAMETER") + package org.jetbrains.kotlin.incremental import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 9f51754270b..5b4b5db2aa9 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -173,7 +173,7 @@ public class ExpressionCodegen extends KtVisitor impleme return null; } - static class BlockStackElement { + public static class BlockStackElement { } static class LoopBlockStackElement extends BlockStackElement { @@ -2224,8 +2224,9 @@ public class ExpressionCodegen extends KtVisitor impleme if (!skipPropertyAccessors) { if (isBackingFieldMovedFromCompanion && context.getContextDescriptor() instanceof AccessorForPropertyBackingField) { - propertyDescriptor = (PropertyDescriptor) backingFieldContext.getParentContext() - .getAccessor(propertyDescriptor, AccessorKind.IN_CLASS_COMPANION, delegateType, superCallTarget); + CodegenContext parentContext = backingFieldContext.getParentContext(); + propertyDescriptor = + parentContext.getAccessor(propertyDescriptor, AccessorKind.IN_CLASS_COMPANION, delegateType, superCallTarget); } else { propertyDescriptor = diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java index c530e3574e9..2384b4f3343 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java @@ -1543,7 +1543,7 @@ public abstract class StackValue { //TODO: try to don't generate defaults at all in CollectionElementReceiver - List getterArguments = new ArrayList(collectionElementReceiver.valueArguments); + List getterArguments = new ArrayList<>(collectionElementReceiver.valueArguments); List getterDefaults = CollectionsKt.takeLastWhile(getterArguments, argument -> argument instanceof DefaultValueArgument); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InternalFinallyBlockInliner.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InternalFinallyBlockInliner.java index aa3efe9a9cd..9cfcbe862e8 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InternalFinallyBlockInliner.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InternalFinallyBlockInliner.java @@ -171,7 +171,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor { checkClusterInvariant(clustersFromInnermost); int originalDepthIndex = 0; - List nestedUnsplitBlocksWithoutFinally = new ArrayList(); + List nestedUnsplitBlocksWithoutFinally = new ArrayList<>(); while (tryCatchBlockIterator.hasNext()) { TryBlockCluster clusterToFindFinally = tryCatchBlockIterator.next(); List clusterBlocks = clusterToFindFinally.getBlocks(); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/typeAnnotationCollector.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/typeAnnotationCollector.kt index 05453211b6d..00c9e8b0081 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/typeAnnotationCollector.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/typeAnnotationCollector.kt @@ -35,7 +35,7 @@ private class State(val path: MutableList) { path.add(step) } - fun removeStep(step: String) { + fun removeStep() { path.removeAt(path.lastIndex) } @@ -93,7 +93,7 @@ abstract class TypeAnnotationCollector(val context: TypeSystemCommonBackendCo fun KotlinTypeMarker.process(step: String) { state.addStep(step) this.gatherTypeAnnotations() - state.removeStep(step) + state.removeStep() } diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/replUtil.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/replUtil.kt index 4f29edc5c2d..155b8e8105e 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/replUtil.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/replUtil.kt @@ -34,12 +34,12 @@ fun String.replUnescapeLineBreaks() = StringUtil.replace(this, XML_REPLACEMENTS, fun String.replEscapeLineBreaks() = StringUtil.replace(this, SOURCE_CHARS, XML_REPLACEMENTS) fun String.replOutputAsXml(escapeType: ReplEscapeType): String { - val escapedXml = StringUtil.escapeXml(replEscapeLineBreaks()) + val escapedXml = StringUtil.escapeXmlEntities(replEscapeLineBreaks()) return "$XML_PREAMBLE$escapedXml" } fun String.replInputAsXml(): String { - val escapedXml = StringUtil.escapeXml(replEscapeLineBreaks()) + val escapedXml = StringUtil.escapeXmlEntities(replEscapeLineBreaks()) return "$XML_PREAMBLE$escapedXml" } @@ -86,4 +86,4 @@ internal fun URLClassLoader.listLocalUrlsAsFiles(): List { internal fun List.ensureNotEmpty(error: String): List { if (this.isEmpty()) throw IllegalStateException(error) return this -} \ No newline at end of file +} diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/Usage.java b/compiler/cli/src/org/jetbrains/kotlin/cli/common/Usage.java index c2ab6f38500..77b2645816c 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/Usage.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/Usage.java @@ -102,6 +102,6 @@ public class Usage { private static void appendln(@NotNull StringBuilder sb, @NotNull String string) { sb.append(string); - StringsKt.appendln(sb); + sb.append('\n'); } } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CliKotlinAsJavaSupport.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CliKotlinAsJavaSupport.kt index b8b8106b1c6..6faea366e24 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CliKotlinAsJavaSupport.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CliKotlinAsJavaSupport.kt @@ -38,7 +38,7 @@ class CliKotlinAsJavaSupport( override fun getFacadeClassesInPackage(packageFqName: FqName, scope: GlobalSearchScope): Collection { return findFacadeFilesInPackage(packageFqName, scope) .groupBy { it.javaFileFacadeFqName } - .mapNotNull { (facadeClassFqName, files) -> + .mapNotNull { (facadeClassFqName, _) -> KtLightClassForFacade.createForFacade(psiManager, facadeClassFqName, scope) } } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt index 2d491bb5b1f..229b1364908 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt @@ -608,7 +608,10 @@ class KotlinCoreEnvironment private constructor( // made public for Upsource @JvmStatic @Deprecated("Use registerProjectServices(project) instead.", ReplaceWith("registerProjectServices(projectEnvironment.project)")) - fun registerProjectServices(projectEnvironment: JavaCoreProjectEnvironment, messageCollector: MessageCollector?) { + fun registerProjectServices( + projectEnvironment: JavaCoreProjectEnvironment, + @Suppress("UNUSED_PARAMETER") messageCollector: MessageCollector? + ) { registerProjectServices(projectEnvironment.project) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index 24d6efa1b2b..7af52d8b7c3 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -471,7 +471,6 @@ object KotlinToJVMBytecodeCompiler { psiSource.psi, this.a, this.b, this.c, factory.psiDiagnosticFactory, severity ) } - throw IllegalArgumentException("Unknown diagnostics: $this") } private fun getBuildFilePaths(buildFile: File?, sourceFilePaths: List): List = diff --git a/compiler/container/src/org/jetbrains/kotlin/container/Registry.kt b/compiler/container/src/org/jetbrains/kotlin/container/Registry.kt index 1d8ffb26f8d..bd65a647b2c 100644 --- a/compiler/container/src/org/jetbrains/kotlin/container/Registry.kt +++ b/compiler/container/src/org/jetbrains/kotlin/container/Registry.kt @@ -79,6 +79,7 @@ internal class ComponentRegistry { By mimicking the usual descriptors we get lazy evaluation and consistency checks for free. */ for (resolver in clashResolvers) { + @Suppress("UNCHECKED_CAST") val clashedComponents = registrationMap[resolver.applicableTo] as? Collection ?: continue if (clashedComponents.size <= 1) continue @@ -86,4 +87,4 @@ internal class ComponentRegistry { registrationMap[resolver.applicableTo] = substituteDescriptor } } -} \ No newline at end of file +} diff --git a/compiler/container/src/org/jetbrains/kotlin/container/Singletons.kt b/compiler/container/src/org/jetbrains/kotlin/container/Singletons.kt index 775753e885b..54a4cae892e 100644 --- a/compiler/container/src/org/jetbrains/kotlin/container/Singletons.kt +++ b/compiler/container/src/org/jetbrains/kotlin/container/Singletons.kt @@ -153,6 +153,7 @@ internal class ClashResolutionDescriptor>( override fun createInstance(context: ValueResolveContext): Any { state = ComponentState.Initializing + @Suppress("UNCHECKED_CAST") val extensions = computeArguments(clashedComponents) as List val resolution = resolver.resolveExtensionsClash(extensions) state = ComponentState.Initialized diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/analyzer/ModuleInfo.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/analyzer/ModuleInfo.kt index 94885db3a83..bb4ae7d2770 100644 --- a/compiler/frontend.common/src/org/jetbrains/kotlin/analyzer/ModuleInfo.kt +++ b/compiler/frontend.common/src/org/jetbrains/kotlin/analyzer/ModuleInfo.kt @@ -7,9 +7,8 @@ package org.jetbrains.kotlin.analyzer import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices import org.jetbrains.kotlin.platform.TargetPlatform - +import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices interface ModuleInfo { val name: Name @@ -30,7 +29,7 @@ interface ModuleInfo { // but if they are present, they should come after JVM built-ins in the dependencies list, because JVM built-ins contain // additional members dependent on the JDK fun dependencyOnBuiltIns(): ModuleInfo.DependencyOnBuiltIns = - analyzerServices?.dependencyOnBuiltIns() ?: ModuleInfo.DependencyOnBuiltIns.LAST + analyzerServices.dependencyOnBuiltIns() //TODO: (module refactoring) provide dependency on builtins after runtime in IDEA enum class DependencyOnBuiltIns { NONE, AFTER_SDK, LAST } @@ -41,4 +40,4 @@ interface ModuleInfo { } val ModuleDescriptor.moduleInfo: ModuleInfo? - get() = getCapability(ModuleInfo.Capability) \ No newline at end of file + get() = getCapability(ModuleInfo.Capability) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmResolverForModuleFactory.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmResolverForModuleFactory.kt index 7afacd0d561..1879fa01bf2 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmResolverForModuleFactory.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmResolverForModuleFactory.kt @@ -83,7 +83,7 @@ class JvmResolverForModuleFactory( } val resolverForModule = resolverForReferencedModule?.takeIf { - referencedClassModule.platform.isJvm() || referencedClassModule.platform == null + referencedClassModule.platform.isJvm() } ?: run { // in case referenced class lies outside of our resolver, resolve the class as if it is inside our module // this leads to java class being resolved several times @@ -95,7 +95,7 @@ class JvmResolverForModuleFactory( val trace = CodeAnalyzerInitializer.getInstance(project).createTrace() val lookupTracker = LookupTracker.DO_NOTHING - val packagePartProvider = (platformParameters as JvmPlatformParameters).packagePartProviderFactory(moduleContent) + val packagePartProvider = platformParameters.packagePartProviderFactory(moduleContent) val container = createContainerForLazyResolveWithJava( moduleDescriptor.platform!!, moduleContext, diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/KotlinJavaPsiFacade.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/KotlinJavaPsiFacade.java index 7e82a737c45..5bc2a987acb 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/KotlinJavaPsiFacade.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/KotlinJavaPsiFacade.java @@ -86,6 +86,7 @@ public class KotlinJavaPsiFacade { private long lastTimeSeen = -1L; @Override + @SuppressWarnings("deprecation") public void modificationCountChanged() { long now = modificationTracker.getJavaStructureModificationCount(); if (lastTimeSeen != now) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt index ea41e2b9ba2..bb8f5a62e68 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt @@ -75,8 +75,8 @@ class EmptyResolverForProject : ResolverForProject() { override val allModules: Collection = listOf() override fun diagnoseUnknownModuleInfo(infos: List) = throw IllegalStateException("Should not be called for $infos") - override fun moduleInfoForModuleDescriptor(descriptor: ModuleDescriptor): M { - throw IllegalStateException("$descriptor is not contained in this resolver") + override fun moduleInfoForModuleDescriptor(moduleDescriptor: ModuleDescriptor): M { + throw IllegalStateException("$moduleDescriptor is not contained in this resolver") } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/TextDiagnostic.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/TextDiagnostic.kt index 3d357e7c040..327c76c341a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/TextDiagnostic.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/diagnostics/TextDiagnostic.kt @@ -6,12 +6,10 @@ package org.jetbrains.kotlin.checkers.diagnostics import com.intellij.openapi.util.text.StringUtil -import com.intellij.psi.PsiElement import com.intellij.util.containers.ContainerUtil import org.jetbrains.kotlin.checkers.diagnostics.factories.DebugInfoDiagnosticFactory1 import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1 import org.jetbrains.kotlin.diagnostics.rendering.AbstractDiagnosticWithParametersRenderer import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer @@ -143,7 +141,10 @@ class TextDiagnostic( private fun asTextDiagnostic(actualDiagnostic: ActualDiagnostic): TextDiagnostic { val diagnostic = actualDiagnostic.diagnostic val renderer = when (diagnostic.factory) { - is DebugInfoDiagnosticFactory1 -> DiagnosticWithParameters1Renderer("{0}", TO_STRING) as DiagnosticRenderer + is DebugInfoDiagnosticFactory1 -> { + @Suppress("UNCHECKED_CAST") + DiagnosticWithParameters1Renderer("{0}", TO_STRING) as DiagnosticRenderer + } else -> DefaultErrorMessages.getRendererForDiagnostic(diagnostic) } val diagnosticName = actualDiagnostic.name diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index d25d2a24786..a3c552bc0d0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -1180,6 +1180,7 @@ public interface Errors { initializeFactoryNamesAndDefaultErrorMessages(aClass, DiagnosticFactoryToRendererMap::new); } + @SuppressWarnings({"unchecked", "rawtypes"}) public static void initializeFactoryNamesAndDefaultErrorMessages( @NotNull Class aClass, @NotNull DefaultErrorMessages.Extension defaultErrorMessages @@ -1193,7 +1194,6 @@ public interface Errors { DiagnosticFactory factory = (DiagnosticFactory)value; factory.setName(field.getName()); - //noinspection rawtypes, unchecked factory.setDefaultRenderer((DiagnosticRenderer) diagnosticToRendererMap.get(factory)); } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/bindingContextUtil/BindingContextUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/bindingContextUtil/BindingContextUtils.kt index 570633d7c32..6a24b78e4f0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/bindingContextUtil/BindingContextUtils.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/bindingContextUtil/BindingContextUtils.kt @@ -148,7 +148,7 @@ fun getEnclosingDescriptor(context: BindingContext, element: KtElement): Declara getEnclosingDescriptor(context, declaration) } else { context.get(DECLARATION_TO_DESCRIPTOR, declaration) - ?: throw KotlinExceptionWithAttachments("No descriptor for named declaration of type ${declaration?.javaClass}") + ?: throw KotlinExceptionWithAttachments("No descriptor for named declaration of type ${declaration.javaClass}") .withAttachment("declaration.kt", declaration.text) } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/InlineChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/InlineChecker.kt index d51e3bd0761..bdb62952ac6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/InlineChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/InlineChecker.kt @@ -76,7 +76,7 @@ internal class InlineChecker(private val descriptor: FunctionDescriptor) : CallC if (inlinableParameters.contains(targetDescriptor)) { when { - !checkNotInDefaultParameter(context, targetDescriptor, expression) -> { /*error*/ + !checkNotInDefaultParameter(context, expression) -> { /*error*/ } !isInsideCall(expression) -> context.trace.report(USAGE_IS_NOT_INLINABLE.on(expression, expression, descriptor)) } @@ -94,7 +94,7 @@ internal class InlineChecker(private val descriptor: FunctionDescriptor) : CallC checkRecursion(context, targetDescriptor, expression) } - private fun checkNotInDefaultParameter(context: CallCheckerContext, targetDescriptor: CallableDescriptor, expression: KtExpression) = + private fun checkNotInDefaultParameter(context: CallCheckerContext, expression: KtExpression) = !supportDefaultValueInline || expression.getParentOfType(true)?.let { val allow = it !in inlinableKtParameters if (!allow) { @@ -145,7 +145,7 @@ internal class InlineChecker(private val descriptor: FunctionDescriptor) : CallC if (argumentCallee != null && inlinableParameters.contains(argumentCallee)) { when { - !checkNotInDefaultParameter(context, argumentCallee, argumentExpression) -> { /*error*/ + !checkNotInDefaultParameter(context, argumentExpression) -> { /*error*/ } InlineUtil.isInline(targetDescriptor) && InlineUtil.isInlineParameter(targetParameterDescriptor) -> diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowValueFactoryImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowValueFactoryImpl.kt index 0ab94b2a8c5..edcd23c2c87 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowValueFactoryImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowValueFactoryImpl.kt @@ -24,10 +24,8 @@ import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils import org.jetbrains.kotlin.types.isError -class DataFlowValueFactoryImpl -@Deprecated("Please, avoid to use that implementation explicitly. If you need DataFlowValueFactory, use injection") -constructor(private val languageVersionSettings: LanguageVersionSettings) : DataFlowValueFactory { - +// Please, avoid using this implementation explicitly. If you need DataFlowValueFactory, use injection. +class DataFlowValueFactoryImpl constructor(private val languageVersionSettings: LanguageVersionSettings) : DataFlowValueFactory { // Receivers override fun createDataFlowValue( receiverValue: ReceiverValue, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt index d2380782a32..4995779cbd1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinResolutionCallbacksImpl.kt @@ -312,10 +312,10 @@ class KotlinResolutionCallbacksImpl( return convertSignedConstantToUnsigned(argumentExpression) } - override fun recordInlinabilityOfLambda(lambdas: Set>) { - val call = lambdas.first().value.atom.psiCallArgument.valueArgument as? KtLambdaArgument ?: return + override fun recordInlinabilityOfLambda(atom: Set>) { + val call = atom.first().value.atom.psiCallArgument.valueArgument as? KtLambdaArgument ?: return val literal = call.getLambdaExpression()?.functionLiteral ?: return - val isLambdaInline = lambdas.all { (candidate, atom) -> + val isLambdaInline = atom.all { (candidate, atom) -> if (!InlineUtil.isInline(candidate.resolvedCall.candidateDescriptor)) return val valueParameterDescriptor = candidate.resolvedCall.argumentToCandidateParameter[atom.atom] ?: return InlineUtil.isInlineParameter(valueParameterDescriptor) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt index cd7df0c5af0..0cee212bc6b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt @@ -155,6 +155,7 @@ class KotlinToResolvedCallTransformer( } } + @Suppress("UNCHECKED_CAST") val resolvedCall = ktPrimitiveCompleter.completeResolvedCall( candidate, baseResolvedCall.completedDiagnostic(resultSubstitutor), ) as ResolvedCall diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallArguments.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallArguments.kt index f3132ab0c1a..d878935b26a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallArguments.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallArguments.kt @@ -68,7 +68,6 @@ val KotlinCallArgument.psiExpression: KtExpression? class ParseErrorKotlinCallArgument( override val valueArgument: ValueArgument, override val dataFlowInfoAfterThisArgument: DataFlowInfo, - builtIns: KotlinBuiltIns ) : ExpressionKotlinCallArgument, SimplePSIKotlinCallArgument() { override val receiver = ReceiverValueWithSmartCastInfo( TransientReceiver(ErrorUtils.createErrorType("Error type for ParseError-argument $valueArgument")), diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt index df8c21de02a..cffcfdf6628 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt @@ -606,10 +606,8 @@ fun transformToReceiverWithSmartCastInfo( ) } -@Deprecated("Temporary error") internal class PreviousResolutionError(candidateLevel: ResolutionCandidateApplicability) : ResolutionDiagnostic(candidateLevel) -@Deprecated("Temporary error") internal fun createPreviousResolveError(status: ResolutionStatus): PreviousResolutionError? { val level = when (status) { ResolutionStatus.SUCCESS, ResolutionStatus.INCOMPLETE_TYPE_INFERENCE -> return null diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt index f74694cb6fd..ba0b230f2ee 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt @@ -721,7 +721,7 @@ class PSICallResolver( ): PSIKotlinCallArgument { val builtIns = outerCallContext.scope.ownerDescriptor.builtIns - fun createParseErrorElement() = ParseErrorKotlinCallArgument(valueArgument, startDataFlowInfo, builtIns) + fun createParseErrorElement() = ParseErrorKotlinCallArgument(valueArgument, startDataFlowInfo) val argumentExpression = valueArgument.getArgumentExpression() ?: return createParseErrorElement() val ktExpression = KtPsiUtil.deparenthesize(argumentExpression) ?: createParseErrorElement() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/ResolvedAtomCompleter.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/ResolvedAtomCompleter.kt index 4f405b74530..46c7a7ed709 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/ResolvedAtomCompleter.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/ResolvedAtomCompleter.kt @@ -202,6 +202,7 @@ class ResolvedAtomCompleter( } private fun completeLambda(lambda: ResolvedLambdaAtom) { + @Suppress("NAME_SHADOWING") val lambda = lambda.unwrap() val resultArgumentsInfo = lambda.resultArgumentsInfo!! val returnType = if (lambda.isCoercedToUnit) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt index e8f3a9a4942..4889500e35d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/ConstantExpressionEvaluator.kt @@ -849,7 +849,7 @@ private class ConstantExpressionEvaluatorVisitor( val compileTimeConstant = evaluate(argumentExpression, underlyingType) val evaluatedArgument = compileTimeConstant?.toConstantValue(underlyingType) ?: return null - val unsignedValue = ConstantValueFactory.createUnsignedValue(evaluatedArgument, classDescriptor.defaultType) ?: return null + val unsignedValue = ConstantValueFactory.createUnsignedValue(evaluatedArgument) ?: return null return unsignedValue.wrap(compileTimeConstant.parameters) } @@ -1168,7 +1168,7 @@ private fun typeStrToCompileTimeType(str: String) = when (str) { else -> throw IllegalArgumentException("Unsupported type: $str") } -fun evaluateUnary(name: String, typeStr: String, value: Any, tracer: () -> Unit = {}): Any? { +fun evaluateUnary(name: String, typeStr: String, value: Any): Any? { return evaluateUnaryAndCheck(name, typeStrToCompileTimeType(typeStr), value) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/OperationsMapGenerated.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/OperationsMapGenerated.kt index 330bd2e5277..4e60845f696 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/OperationsMapGenerated.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/constants/evaluate/OperationsMapGenerated.kt @@ -23,8 +23,8 @@ import java.util.HashMap /** This file is generated by org.jetbrains.kotlin.generators.evaluate:generate(). DO NOT MODIFY MANUALLY */ -internal val emptyBinaryFun: Function2 = { a, b -> BigInteger("0") } -internal val emptyUnaryFun: Function1 = { a -> 1.toLong() } +internal val emptyBinaryFun: Function2 = { _, _ -> BigInteger("0") } +internal val emptyUnaryFun: Function1 = { _ -> 1.toLong() } internal val unaryOperations: HashMap, Pair, Function1>> = hashMapOf, Pair, Function1>>( diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/inline/InlineAnalyzerExtension.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/inline/InlineAnalyzerExtension.kt index 52eccf96916..57e036c2ac9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/inline/InlineAnalyzerExtension.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/inline/InlineAnalyzerExtension.kt @@ -37,7 +37,7 @@ class InlineAnalyzerExtension( override fun process(descriptor: CallableMemberDescriptor, functionOrProperty: KtCallableDeclaration, trace: BindingTrace) { checkModalityAndOverrides(descriptor, functionOrProperty, trace) - notSupportedInInlineCheck(descriptor, functionOrProperty, trace) + notSupportedInInlineCheck(functionOrProperty, trace) if (descriptor is FunctionDescriptor) { assert(functionOrProperty is KtNamedFunction) { @@ -61,7 +61,6 @@ class InlineAnalyzerExtension( } private fun notSupportedInInlineCheck( - descriptor: CallableMemberDescriptor, functionOrProperty: KtCallableDeclaration, trace: BindingTrace ) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt index 5f5f61e5dc7..c88b6b1e23e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt @@ -81,21 +81,6 @@ private fun KotlinTypeRefiner.refineBareType(type: PossiblyBareType): PossiblyBa return PossiblyBareType.type(newType) } -@OptIn(TypeRefinement::class) -private fun KotlinTypeRefiner.refineLHS(lhs: T): T = when (lhs) { - is DoubleColonLHS.Expression -> { - val newType = lhs.typeInfo.type?.let { refineType(it) } - DoubleColonLHS.Expression( - lhs.typeInfo.replaceType(newType), - lhs.isObjectQualifier - ) as T - } - is DoubleColonLHS.Type -> { - DoubleColonLHS.Type(refineType(lhs.type), refineBareType(lhs.possiblyBareType)) as T - } - else -> throw IllegalStateException() -} - // Returns true if this expression has the form "A" which means it's a type on the LHS of a double colon expression internal val KtCallExpression.isWithoutValueArguments: Boolean get() = valueArgumentList == null && lambdaArguments.isEmpty() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingUtils.java index da82921787c..51b61d0a987 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ExpressionTypingUtils.java @@ -99,6 +99,7 @@ public class ExpressionTypingUtils { return fakeExpression; } + @SuppressWarnings("deprecation") public static void checkVariableShadowing( @NotNull LexicalScope scope, @NotNull BindingTrace trace, diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/builtins/IrBuiltInsMapGenerated.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/builtins/IrBuiltInsMapGenerated.kt index 78a80b2d8ff..f38c18ee239 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/builtins/IrBuiltInsMapGenerated.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/builtins/IrBuiltInsMapGenerated.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.ir.interpreter.state.* /** This file is generated by org.jetbrains.kotlin.backend.common.interpreter.builtins.GenerateBuiltInsMap.generateMap(). DO NOT MODIFY MANUALLY */ +@Suppress("DEPRECATION") val unaryFunctions = mapOf>( unaryOperation("hashCode", "Boolean") { a -> a.hashCode() }, unaryOperation("not", "Boolean") { a -> a.not() }, diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/builder/LightClassBuilder.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/builder/LightClassBuilder.kt index 5fd8cd41041..3f78b51acba 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/builder/LightClassBuilder.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/builder/LightClassBuilder.kt @@ -18,7 +18,6 @@ package org.jetbrains.kotlin.asJava.builder import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.progress.ProcessCanceledException -import com.intellij.openapi.project.Project import com.intellij.openapi.util.SystemInfo import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.impl.compiled.ClsFileImpl @@ -44,7 +43,7 @@ fun buildLightClass( val project = files.first().project try { - val classBuilderFactory = KotlinLightClassBuilderFactory(createJavaFileStub(project, packageFqName, files)) + val classBuilderFactory = KotlinLightClassBuilderFactory(createJavaFileStub(packageFqName, files)) val state = GenerationState.Builder( project, classBuilderFactory, @@ -77,7 +76,7 @@ fun buildLightClass( } } -private fun createJavaFileStub(project: Project, packageFqName: FqName, files: Collection): PsiJavaFileStub { +private fun createJavaFileStub(packageFqName: FqName, files: Collection): PsiJavaFileStub { val javaFileStub = PsiJavaFileStubImpl(packageFqName.asString(), /*compiled = */true) javaFileStub.psiFactory = ClsWrapperStubPsiFactory.INSTANCE diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt index e1de72bb5c5..cadf88b7cba 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt @@ -14,7 +14,6 @@ import com.intellij.openapi.util.TextRange import com.intellij.openapi.util.registry.Registry import com.intellij.psi.* import com.intellij.psi.impl.InheritanceImplUtil -import com.intellij.psi.impl.PsiSubstitutorImpl import com.intellij.psi.impl.java.stubs.PsiJavaFileStub import com.intellij.psi.impl.source.PsiImmediateClassType import com.intellij.psi.impl.source.tree.TreeUtil @@ -22,7 +21,10 @@ import com.intellij.psi.scope.PsiScopeProcessor import com.intellij.psi.search.SearchScope import com.intellij.psi.stubs.IStubElementType import com.intellij.psi.stubs.StubElement -import com.intellij.psi.util.* +import com.intellij.psi.util.CachedValue +import com.intellij.psi.util.CachedValueProvider +import com.intellij.psi.util.CachedValuesManager +import com.intellij.psi.util.PsiUtilCore import com.intellij.util.IncorrectOperationException import org.jetbrains.annotations.NonNls import org.jetbrains.kotlin.analyzer.KotlinModificationTrackerService @@ -489,7 +491,7 @@ abstract class KtLightClassForSourceDeclaration( return PsiSubstitutor.EMPTY } val javaLangEnumsTypeParameter = ancestor.typeParameters.firstOrNull() ?: return PsiSubstitutor.EMPTY - return PsiSubstitutorImpl.createSubstitutor( + return PsiSubstitutor.createSubstitutor( mapOf( javaLangEnumsTypeParameter to PsiImmediateClassType(this, PsiSubstitutor.EMPTY) ) diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightUtils.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightUtils.kt index a3a168dabbf..a45bb3975ce 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightUtils.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightUtils.kt @@ -470,8 +470,11 @@ inline fun runReadAction(crossinline runnable: () -> T): T { return ApplicationManager.getApplication().runReadAction(Computable { runnable() }) } +@Suppress("NOTHING_TO_INLINE") inline fun KtClassOrObject.safeIsLocal(): Boolean = runReadAction { this.isLocal } +@Suppress("NOTHING_TO_INLINE") inline fun KtFile.safeIsScript() = runReadAction { this.isScript() } -inline fun KtFile.safeScript() = runReadAction { this.script } \ No newline at end of file +@Suppress("NOTHING_TO_INLINE") +inline fun KtFile.safeScript() = runReadAction { this.script } diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightMethodImpl.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightMethodImpl.kt index d58778f90e7..cb3acb9da8b 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightMethodImpl.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightMethodImpl.kt @@ -253,6 +253,7 @@ open class KtLightMethodImpl protected constructor( override fun getBody() = null + @Suppress("DEPRECATION") override fun findDeepestSuperMethod() = clsDelegate.findDeepestSuperMethod() override fun findDeepestSuperMethods() = clsDelegate.findDeepestSuperMethods() diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightParameterImpl.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightParameterImpl.kt index 87bf8bdf272..0e197416f75 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightParameterImpl.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightParameterImpl.kt @@ -24,7 +24,7 @@ internal class KtLightParameterImpl( private val clsDelegateProvider: () -> PsiParameter?, private val index: Int, method: KtLightMethod -) : LightParameter(dummyDelegate.name ?: "p$index", dummyDelegate.type, method, KotlinLanguage.INSTANCE), +) : LightParameter(dummyDelegate.name, dummyDelegate.type, method, KotlinLanguage.INSTANCE), KtLightDeclaration, KtLightParameter { private val lazyDelegate by lazyPub { clsDelegateProvider() ?: dummyDelegate } @@ -33,7 +33,7 @@ internal class KtLightParameterImpl( override fun getType(): PsiType = lazyDelegate.type - override fun getName(): String = dummyDelegate.name ?: lazyDelegate.name ?: super.getName() + override fun getName(): String = dummyDelegate.name private val lightModifierList by lazyPub { KtLightSimpleModifierList(this, emptySet()) } diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtToJvmAnnotationsConverter.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtToJvmAnnotationsConverter.kt index cfb90cfe55b..790f94ab9e5 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtToJvmAnnotationsConverter.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtToJvmAnnotationsConverter.kt @@ -105,7 +105,6 @@ internal fun PsiAnnotation.tryConvertAsRetention(support: KtUltraLightSupport): val convertedValue = extractAnnotationFqName("value") ?.let { retentionMapping[it] } - ?: null convertedValue ?: return null diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/lightAnnotations.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/lightAnnotations.kt index 4b420716809..a21127a3efa 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/lightAnnotations.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/lightAnnotations.kt @@ -69,6 +69,7 @@ abstract class KtLightAbstractAnnotation(parent: PsiElement, computeDelegate: La override fun getOwner() = parent as? PsiAnnotationOwner + @Suppress("DEPRECATION") override fun getMetaData() = clsDelegate.metaData override fun getParameterList() = clsDelegate.parameterList @@ -91,6 +92,7 @@ class KtLightAnnotationForSourceEntry( override fun getOwner() = parent as? PsiAnnotationOwner + @Suppress("DEPRECATION") override fun getMetaData() = lazyClsDelegate?.value?.metaData override fun getQualifiedName() = qualifiedName diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtBlockExpression.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtBlockExpression.java index d9ce4e6a867..fd4f3248d62 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtBlockExpression.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtBlockExpression.java @@ -39,6 +39,7 @@ import java.util.List; import static org.jetbrains.kotlin.KtNodeTypes.BLOCK; +@SuppressWarnings("deprecation") public class KtBlockExpression extends LazyParseablePsiElement implements KtElement, KtExpression, KtStatementExpression, PsiModifiableCodeBlock { public KtBlockExpression(@Nullable CharSequence text) { diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java index addaf42d0a7..9cc18d84c36 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtDestructuringDeclarationEntry.java @@ -34,6 +34,7 @@ import java.util.List; import static org.jetbrains.kotlin.lexer.KtTokens.VAL_KEYWORD; import static org.jetbrains.kotlin.lexer.KtTokens.VAR_KEYWORD; +@SuppressWarnings("deprecation") public class KtDestructuringDeclarationEntry extends KtNamedDeclarationNotStubbed implements KtVariableDeclaration { public KtDestructuringDeclarationEntry(@NotNull ASTNode node) { super(node); diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtFunctionNotStubbed.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtFunctionNotStubbed.java index 32d71cda59c..3b10d30f6ee 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtFunctionNotStubbed.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtFunctionNotStubbed.java @@ -25,6 +25,7 @@ import org.jetbrains.kotlin.KtNodeTypes; import java.util.Collections; import java.util.List; +@SuppressWarnings("deprecation") public abstract class KtFunctionNotStubbed extends KtTypeParameterListOwnerNotStubbed implements KtFunction { public KtFunctionNotStubbed(@NotNull ASTNode node) { diff --git a/compiler/resolution/src/org/jetbrains/kotlin/contracts/description/ContractDescription.kt b/compiler/resolution/src/org/jetbrains/kotlin/contracts/description/ContractDescription.kt index 827c65ecddd..d07c5772282 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/contracts/description/ContractDescription.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/contracts/description/ContractDescription.kt @@ -43,6 +43,7 @@ open class ContractDescription( ContractInterpretationDispatcher().convertContractDescriptorToFunctor(this) } + @Suppress("UNUSED_PARAMETER") fun getFunctor(usageModule: ModuleDescriptor): Functor? = computeFunctor.invoke() } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CallableReferenceResolution.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CallableReferenceResolution.kt index 5dbdd80aedb..c83fef02236 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CallableReferenceResolution.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CallableReferenceResolution.kt @@ -14,7 +14,6 @@ import org.jetbrains.kotlin.resolve.calls.components.CreateFreshVariablesSubstit import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemOperation import org.jetbrains.kotlin.resolve.calls.inference.components.FreshVariableNewTypeSubstitutor import org.jetbrains.kotlin.resolve.calls.inference.model.ArgumentConstraintPosition -import org.jetbrains.kotlin.resolve.calls.inference.model.LowerPriorityToPreserveCompatibility import org.jetbrains.kotlin.resolve.calls.model.* import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind.DISPATCH_RECEIVER @@ -351,10 +350,11 @@ class CallableReferencesCandidateFactory( // If we've already mapped an argument to this value parameter, it'll always be a type mismatch. mappedArguments[valueParameter] = ResolvedCallArgument.SimpleArgument(fakeArgument) } - VarargMappingState.MAPPED_WITH_PLAIN_ARGS -> { mappedVarargElements.getOrPut(valueParameter) { ArrayList() }.add(fakeArgument) } + VarargMappingState.UNMAPPED -> { + } } } else { mappedArgument = substitutedParameter.type @@ -390,13 +390,13 @@ class CallableReferencesCandidateFactory( CoercionStrategy.NO_COERCION val adaptedArguments = - if (expectedType != null && ReflectionTypes.isBaseTypeForNumberedReferenceTypes(expectedType)) + if (ReflectionTypes.isBaseTypeForNumberedReferenceTypes(expectedType)) emptyMap() else mappedArguments val suspendConversionStrategy = - if (!descriptor.isSuspend && expectedType?.isSuspendFunctionType == true) { + if (!descriptor.isSuspend && expectedType.isSuspendFunctionType) { SuspendConversionStrategy.SUSPEND_CONVERSION } else { SuspendConversionStrategy.NO_CONVERSION diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/SimpleConstraintSystemImpl.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/SimpleConstraintSystemImpl.kt index db34d9def96..fd119dd6333 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/SimpleConstraintSystemImpl.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/components/SimpleConstraintSystemImpl.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.resolve.calls.components.ClassicTypeSystemContextForCS import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilder import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintSystemImpl +import org.jetbrains.kotlin.resolve.calls.inference.model.SimpleConstraintSystemConstraintPosition import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableFromCallableDescriptor import org.jetbrains.kotlin.resolve.calls.inference.substitute import org.jetbrains.kotlin.resolve.calls.results.SimpleConstraintSystem @@ -60,8 +61,7 @@ class SimpleConstraintSystemImpl(constraintInjector: ConstraintInjector, builtIn csBuilder.addSubtypeConstraint( subType, superType, - @Suppress("DEPRECATION") - org.jetbrains.kotlin.resolve.calls.inference.model.SimpleConstraintSystemConstraintPosition + SimpleConstraintSystemConstraintPosition ) } diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/ConstraintPositionAndErrors.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/ConstraintPositionAndErrors.kt index 96ad6f5ef23..18f74ae42d7 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/ConstraintPositionAndErrors.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/inference/model/ConstraintPositionAndErrors.kt @@ -94,7 +94,7 @@ class CoroutinePosition() : ConstraintPosition() { override fun toString(): String = "for coroutine call" } -@Deprecated("Should be used only in SimpleConstraintSystemImpl") +// TODO: should be used only in SimpleConstraintSystemImpl object SimpleConstraintSystemConstraintPosition : ConstraintPosition() abstract class ConstraintSystemCallDiagnostic(applicability: ResolutionCandidateApplicability) : KotlinCallDiagnostic(applicability) { diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallArguments.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallArguments.kt index 514f9f58341..501c9aa32e5 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallArguments.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallArguments.kt @@ -58,7 +58,7 @@ interface LambdaKotlinCallArgument : PostponableKotlinCallArgument { */ var hasBuilderInferenceAnnotation: Boolean get() = false - set(value) {} + set(@Suppress("UNUSED_PARAMETER") value) {} /** * parametersTypes == null means, that there is no declared arguments diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt index 55aa84d1835..2066293090f 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt @@ -150,7 +150,7 @@ sealed class UnstableSmartCast( operator fun invoke( argument: ExpressionKotlinCallArgument, targetType: UnwrappedType, - isReceiver: Boolean = false, // for reproducing OI behaviour + @Suppress("UNUSED_PARAMETER") isReceiver: Boolean = false, // for reproducing OI behaviour ): UnstableSmartCast { return UnstableSmartCastResolutionError(argument, targetType) } diff --git a/compiler/tests-common-jvm6/tests/org/jetbrains/kotlin/test/clientserver/TestProxy.kt b/compiler/tests-common-jvm6/tests/org/jetbrains/kotlin/test/clientserver/TestProxy.kt index 0b9ebc86bca..ec3cf70f4a2 100644 --- a/compiler/tests-common-jvm6/tests/org/jetbrains/kotlin/test/clientserver/TestProxy.kt +++ b/compiler/tests-common-jvm6/tests/org/jetbrains/kotlin/test/clientserver/TestProxy.kt @@ -55,8 +55,7 @@ class TestProxy(val serverPort: Int, val testClass: String, val classPath: List< } fun runTestNoOutput(): String { - return Socket("localhost", serverPort).use { clientSocket -> - + Socket("localhost", serverPort).use { clientSocket -> val output = ObjectOutputStream(clientSocket.getOutputStream()) try { output.writeObject(MessageHeader.NEW_TEST) diff --git a/compiler/tests-common/build.gradle.kts b/compiler/tests-common/build.gradle.kts index ac5a387b4b3..e9aef26e052 100644 --- a/compiler/tests-common/build.gradle.kts +++ b/compiler/tests-common/build.gradle.kts @@ -99,6 +99,12 @@ dependencies { } } +tasks.withType> { + kotlinOptions { + freeCompilerArgs += "-Xinline-classes" + } +} + sourceSets { "main" { } "test" { projectDefault() } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/asJava/AbstractCompilerLightClassTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/asJava/AbstractCompilerLightClassTest.kt index b8f2011d19c..cf3b9411d7f 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/asJava/AbstractCompilerLightClassTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/asJava/AbstractCompilerLightClassTest.kt @@ -31,14 +31,14 @@ abstract class AbstractCompilerLightClassTest : KotlinMultiFileTestWithJava) { - val environment = createEnvironment(file, files) - val expectedFile = KotlinTestUtils.replaceExtension(file, "java") - val allowFrontendExceptions = InTextDirectivesUtils.isDirectiveDefined(file.readText(), "// ALLOW_FRONTEND_EXCEPTION") + override fun doMultiFileTest(wholeFile: File, files: List) { + val environment = createEnvironment(wholeFile, files) + val expectedFile = KotlinTestUtils.replaceExtension(wholeFile, "java") + val allowFrontendExceptions = InTextDirectivesUtils.isDirectiveDefined(wholeFile.readText(), "// ALLOW_FRONTEND_EXCEPTION") LightClassTestCommon.testLightClass( expectedFile, - file, + wholeFile, { fqname -> findLightClass(allowFrontendExceptions, environment, fqname) }, LightClassTestCommon::removeEmptyDefaultImpls ) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/javac/AbstractDiagnosticsTestWithStdLibUsingJavac.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/javac/AbstractDiagnosticsTestWithStdLibUsingJavac.kt index 91e03ca0ee8..c67c91ed953 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/javac/AbstractDiagnosticsTestWithStdLibUsingJavac.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/javac/AbstractDiagnosticsTestWithStdLibUsingJavac.kt @@ -27,7 +27,7 @@ abstract class AbstractDiagnosticsTestWithStdLibUsingJavac : AbstractDiagnostics override fun shouldSkipTest(wholeFile: File, files: List): Boolean { - return isJavacSkipTest(wholeFile, files) + return isJavacSkipTest(wholeFile) } override fun setupEnvironment(environment: KotlinCoreEnvironment, testDataFile: File, files: List) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/javac/AbstractJavacForeignJava8AnnotationsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/javac/AbstractJavacForeignJava8AnnotationsTest.kt index 0b7641679c1..c282336e6d1 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/javac/AbstractJavacForeignJava8AnnotationsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/cfg/javac/AbstractJavacForeignJava8AnnotationsTest.kt @@ -19,13 +19,12 @@ package org.jetbrains.kotlin.checkers.javac import org.jetbrains.kotlin.checkers.AbstractForeignJava8AnnotationsTest import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.config.JVMConfigurationKeys -import org.jetbrains.kotlin.test.InTextDirectivesUtils import java.io.File abstract class AbstractJavacForeignJava8AnnotationsTest : AbstractForeignJava8AnnotationsTest() { override fun shouldSkipTest(wholeFile: File, files: List): Boolean { - return isSkipJavacTest(wholeFile, files) + return isSkipJavacTest(wholeFile) } override fun setupEnvironment(environment: KotlinCoreEnvironment, testDataFile: File, files: List) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt index d2f4643a485..551f3880b3e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt @@ -660,7 +660,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { val dependencies = ArrayList() dependencies.add(module) for (dependency in testModule.dependencies) { - dependencies.add(modules[dependency]!!) + dependencies.add(modules[dependency as TestModule?]!!) } dependencies.add(module.builtIns.builtInsModule) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt index 54ded363e89..47d2b7e80a8 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.kt @@ -490,7 +490,7 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava): Boolean { + fun isJavacSkipTest(wholeFile: File): Boolean { val testDataFileText = wholeFile.readText() if (isDirectiveDefined(testDataFileText, "// JAVAC_SKIP")) { return true @@ -499,7 +499,7 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava): Boolean { + fun isSkipJavacTest(wholeFile: File): Boolean { val testDataFileText = wholeFile.readText() if (isDirectiveDefined(testDataFileText, "// SKIP_JAVAC")) { return true diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt index e96056679ab..3871f0bad29 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.Companion.createForTests import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.parsing.KotlinParserDefinition import org.jetbrains.kotlin.resolve.DescriptorUtils @@ -131,7 +130,7 @@ abstract class KotlinMultiFileTestWithJava): Boolean { - return isJavacSkipTest(wholeFile, files) + return isJavacSkipTest(wholeFile) } override fun setupEnvironment(environment: KotlinCoreEnvironment, testDataFile: File, files: List) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java index a5d4e04e506..f805c240934 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java @@ -57,11 +57,12 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { } @Override + @SuppressWarnings("unchecked") protected void doMultiFileTest( @NotNull File wholeFile, @NotNull List files ) throws Exception { - doMultiFileTest(wholeFile, (List)files, false); + doMultiFileTest(wholeFile, (List) files, false); } private void doBytecodeListingTest(@NotNull File wholeFile) throws Exception { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCheckLocalVariablesTableTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCheckLocalVariablesTableTest.kt index 162585c2afb..baea2dfdeb3 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCheckLocalVariablesTableTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCheckLocalVariablesTableTest.kt @@ -434,7 +434,7 @@ abstract class AbstractCheckLocalVariablesTableTest : CodegenTestCase() { // conflicting types are represented with a CONFLICT type // which will never match a read instruction or a type in // a locals table. - if (!areCompatible(index, it, type)) { + if (!areCompatible(it, type)) { currentLocals[index] = "CONFLICT" } } @@ -450,11 +450,11 @@ abstract class AbstractCheckLocalVariablesTableTest : CodegenTestCase() { // We only check that there is no confusion between object types and basic types. // Therefore, we map all arrays types to type Object when comparing. private fun checkCompatible(index: Int, type0: String, type1: String) { - if (areCompatible(index, type0, type1)) return + if (areCompatible(type0, type1)) return throw Exception("Incompatible types for local $index: $type0 and $type1") } - private fun areCompatible(index: Int, type0: String, type1: String): Boolean { + private fun areCompatible(type0: String, type1: String): Boolean { val t0 = if (type0.startsWith("[")) "Ljava/lang/Object;" else type0 val t1 = if (type1.startsWith("[")) "Ljava/lang/Object;" else type1 if (t0.equals(t1)) return true diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstInlineKotlinTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstInlineKotlinTest.kt index 4d388bb2839..ae071deb409 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstInlineKotlinTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstInlineKotlinTest.kt @@ -28,7 +28,6 @@ abstract class AbstractCompileKotlinAgainstInlineKotlinTest : AbstractCompileKot ) try { val allGeneratedFiles = factory1.asList() + factory2.asList() - val sourceFiles = factory1.inputFiles + factory2.inputFiles InlineTestUtil.checkNoCallsToInline(allGeneratedFiles.filterClassFiles(), files) SMAPTestUtil.checkSMAP(files, allGeneratedFiles.filterClassFiles(), true) } catch (e: Throwable) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java index 6a7577c580f..7ebb1606a02 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCompileKotlinAgainstKotlinTest.java @@ -49,6 +49,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest } @Override + @SuppressWarnings("unchecked") protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List files) { boolean isIgnored = InTextDirectivesUtils.isIgnoredTarget(getBackend(), wholeFile); doTwoFileTest((List) files, !isIgnored); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 453d5fd3060..b3fea0aaf38 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -594,13 +594,14 @@ public abstract class CodegenTestCase extends KotlinBaseTest() { - @NotNull - @Override - public TestFile create(@NotNull String fileName, @NotNull String text, @NotNull Directives directives) { - return new TestFile(fileName, text, directives); - } - }, false, coroutinesPackage, parseDirectivesPerFiles); + List testFiles = + TestFiles.createTestFiles(file.getName(), expectedText, new TestFiles.TestFileFactoryNoModules() { + @NotNull + @Override + public TestFile create(@NotNull String fileName, @NotNull String text, @NotNull Directives directives) { + return new TestFile(fileName, text, directives); + } + }, false, coroutinesPackage, parseDirectivesPerFiles); if (InTextDirectivesUtils.isDirectiveDefined(expectedText, "WITH_HELPERS")) { testFiles.add(new TestFile("CodegenTestHelpers.kt", TestHelperGeneratorKt.createTextForCodegenTestHelpers(backend))); } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/flags/AbstractWriteFlagsTest.java b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/flags/AbstractWriteFlagsTest.java index 0a3ae183245..a980ec434ba 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/flags/AbstractWriteFlagsTest.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/flags/AbstractWriteFlagsTest.java @@ -56,7 +56,9 @@ public abstract class AbstractWriteFlagsTest extends CodegenTestCase { @Override protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List files) throws Exception { - compile((List)files); + @SuppressWarnings("unchecked") + List testFiles = (List) files; + compile(testFiles); String fileText = FileUtil.loadFile(wholeFile, true); diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt index 509422e5152..c83bc77d37f 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirBaseDiagnosticsTest.kt @@ -157,7 +157,7 @@ abstract class AbstractFirBaseDiagnosticsTest : BaseDiagnosticsTest() { val dependencies = ArrayList() dependencies.add(module) for (dependency in testModule.dependencies) { - dependencies.add(modules[dependency]!!) + dependencies.add(modules[dependency as TestModule?]!!) } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt index f9766eeb838..86ce57e37d9 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt @@ -337,9 +337,6 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { for (previousNode in node.previousNodes) { if (previousNode.owner != graph) continue if (!node.incomingEdges.getValue(previousNode).isBack) { - if (previousNode !in visited) { - val x = 1 - } assertTrue(previousNode in visited) } } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsWithLightTreeTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsWithLightTreeTest.kt index 9b0fe13e681..03a40c793f9 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsWithLightTreeTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsWithLightTreeTest.kt @@ -103,7 +103,7 @@ abstract class AbstractFirDiagnosticsWithLightTreeTest : AbstractFirDiagnosticsT return groupBy { it }.mapValues { (_, value) -> value.size } } - private class MissingDiagnostic(val startOffset: Int, val name: String, diff: Int, ktFile: KtFile) { + private class MissingDiagnostic(val startOffset: Int, val name: String, diff: Int, @Suppress("UNUSED_PARAMETER") ktFile: KtFile) { val kind: Kind = if (diff > 0) Kind.WasExpected else Kind.IsActual val count: Int = abs(diff) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt index 014bf5b123a..7f8b2710fb9 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt @@ -221,7 +221,7 @@ class FirResolveBench(val withProgress: Boolean) { ) { fileCount += firFiles.size try { - for ((stage, processor) in processors.withIndex()) { + for ((_, processor) in processors.withIndex()) { //println("Starting stage #$stage. $transformer") val firFileSequence = if (withProgress) firFiles.progress(" ~ ") else firFiles.asSequence() runStage(processor, firFileSequence) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/TableRendering.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/TableRendering.kt index 8d7f9ed6d61..d2939f1843e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/TableRendering.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/TableRendering.kt @@ -140,6 +140,7 @@ inline class TableTimeUnitConversion(val value: Double) { infix fun Long.from(from: TableTimeUnit) = TableTimeUnitConversion(this / from.nsMultiplier) +@Suppress("NOTHING_TO_INLINE") inline fun RTableContext.RTableRowContext.timeCell( time: Long, outputUnit: TableTimeUnit = TableTimeUnit.MS, diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt index a27cce3ba21..0791b7c45b0 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinBaseTest.kt @@ -185,6 +185,7 @@ abstract class KotlinBaseTest : KtUsefulTestCase() } assert(configurationKeyField != null) { "Expected [+|-][namespace.]configurationKey, got: $flag" } try { + @Suppress("UNCHECKED_CAST") val configurationKey = configurationKeyField!![null] as CompilerConfigurationKey configuration.put(configurationKey, flagEnabled) } catch (e: java.lang.Exception) { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java index fd08651fa06..6446618a7fa 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java @@ -716,8 +716,7 @@ public class KotlinTestUtils { runTestImpl(testWithCustomIgnoreDirective(test, TargetBackend.ANY, IGNORE_BACKEND_DIRECTIVE_PREFIX), testCase, testDataFile); } - public static void runTest(@NotNull TestCase testCase, @NotNull Function0 test) { - //noinspection unchecked + public static void runTest(@NotNull TestCase testCase, @NotNull Function0 test) { MuteWithDatabaseKt.runTest(testCase, test); } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java index 44833c97938..e651e41048b 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java @@ -564,10 +564,10 @@ public abstract class KtUsefulTestCase extends TestCase { assertOrderedEquals("", actual, expected); } + @SuppressWarnings("unchecked") public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull Iterable expected) { - //noinspection unchecked assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL); } @@ -1008,8 +1008,8 @@ public abstract class KtUsefulTestCase extends TestCase { * @param exceptionCase Block annotated with some exception type * @param expectedErrorMsg expected error message */ + @SuppressWarnings("unchecked") protected void assertException(@NotNull AbstractExceptionCase exceptionCase, @Nullable String expectedErrorMsg) { - //noinspection unchecked assertExceptionOccurred(true, exceptionCase, expectedErrorMsg); } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.193 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.193 index c3bf76c4b25..29670c6a324 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.193 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.193 @@ -441,10 +441,10 @@ public abstract class KtUsefulTestCase extends TestCase { assertOrderedEquals("", actual, expected); } + @SuppressWarnings("unchecked") public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull Iterable expected) { - //noinspection unchecked assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL); } @@ -851,8 +851,8 @@ public abstract class KtUsefulTestCase extends TestCase { * @param exceptionCase Block annotated with some exception type * @param expectedErrorMsg expected error message */ + @SuppressWarnings("unchecked") protected void assertException(@NotNull AbstractExceptionCase exceptionCase, @Nullable String expectedErrorMsg) { - //noinspection unchecked assertExceptionOccurred(true, exceptionCase, expectedErrorMsg); } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 index f04e03d66d4..21f6510293e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.202 @@ -567,10 +567,10 @@ public abstract class KtUsefulTestCase extends TestCase { assertOrderedEquals("", actual, expected); } + @SuppressWarnings("unchecked") public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull Iterable expected) { - //noinspection unchecked assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL); } @@ -1011,8 +1011,8 @@ public abstract class KtUsefulTestCase extends TestCase { * @param exceptionCase Block annotated with some exception type * @param expectedErrorMsg expected error message */ + @SuppressWarnings("unchecked") protected void assertException(@NotNull AbstractExceptionCase exceptionCase, @Nullable String expectedErrorMsg) { - //noinspection unchecked assertExceptionOccurred(true, exceptionCase, expectedErrorMsg); } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 index 09cfda93222..500d4165d8b 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.203 @@ -556,10 +556,10 @@ public abstract class KtUsefulTestCase extends TestCase { assertOrderedEquals("", actual, expected); } + @SuppressWarnings("unchecked") public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull Iterable expected) { - //noinspection unchecked assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL); } @@ -1000,8 +1000,8 @@ public abstract class KtUsefulTestCase extends TestCase { * @param exceptionCase Block annotated with some exception type * @param expectedErrorMsg expected error message */ + @SuppressWarnings("unchecked") protected void assertException(@NotNull AbstractExceptionCase exceptionCase, @Nullable String expectedErrorMsg) { - //noinspection unchecked assertExceptionOccurred(true, exceptionCase, expectedErrorMsg); } diff --git a/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/Annotator.kt b/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/Annotator.kt index 8ad40654494..4e3e3d303a8 100644 --- a/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/Annotator.kt +++ b/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/Annotator.kt @@ -19,8 +19,7 @@ object Annotator { val levelToOffset = mutableMapOf(0 to 0) for (ann in annotations) { - var lastLevel = 0 - lastLevel = levelToOffset.values.takeWhile { ann.range.startOffset + ann.text.length >= it }.size + val lastLevel = levelToOffset.values.takeWhile { ann.range.startOffset + ann.text.length >= it }.size if (annotationLines.size <= lastLevel) { annotationLines.add(StringBuilder(comment + " ".repeat(lineSize - comment.length))) diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt index 57009e6c3d7..d9478af8c3e 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt @@ -106,7 +106,7 @@ class LazyJavaClassDescriptor( LazyJavaClassMemberScope(c, this, jClass, skipRefinement = additionalSupertypeClassDescriptor != null) private val scopeHolder = - ScopesHolderForClass.create(this, c.storageManager, c.components.kotlinTypeChecker.kotlinTypeRefiner) { kotlinTypeRefiner -> + ScopesHolderForClass.create(this, c.storageManager, c.components.kotlinTypeChecker.kotlinTypeRefiner) { LazyJavaClassMemberScope( c, this, jClass, skipRefinement = additionalSupertypeClassDescriptor != null, diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/ConstantValueFactory.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/ConstantValueFactory.kt index 290f5a681bd..73046b40c28 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/ConstantValueFactory.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/ConstantValueFactory.kt @@ -48,7 +48,7 @@ object ConstantValueFactory { } } - fun createUnsignedValue(constantValue: ConstantValue<*>, type: KotlinType): UnsignedValueConstant<*>? { + fun createUnsignedValue(constantValue: ConstantValue<*>): UnsignedValueConstant<*>? { return when (constantValue) { is ByteValue -> UByteValue(constantValue.value) is ShortValue -> UShortValue(constantValue.value) diff --git a/core/util.runtime/src/org/jetbrains/kotlin/storage/LockBasedStorageManager.java b/core/util.runtime/src/org/jetbrains/kotlin/storage/LockBasedStorageManager.java index b1586900e55..5ae93d8ca57 100644 --- a/core/util.runtime/src/org/jetbrains/kotlin/storage/LockBasedStorageManager.java +++ b/core/util.runtime/src/org/jetbrains/kotlin/storage/LockBasedStorageManager.java @@ -95,7 +95,7 @@ public class LockBasedStorageManager implements StorageManager { } public LockBasedStorageManager(String debugText) { - this(debugText, (Runnable)null, (Function1)null); + this(debugText, (Runnable) null, null); } public LockBasedStorageManager( diff --git a/generators/evaluate/GenerateOperationsMap.kt b/generators/evaluate/GenerateOperationsMap.kt index d533028616c..e2a7646c391 100644 --- a/generators/evaluate/GenerateOperationsMap.kt +++ b/generators/evaluate/GenerateOperationsMap.kt @@ -62,8 +62,8 @@ fun generate(): String { } } - p.println("internal val emptyBinaryFun: Function2 = { a, b -> BigInteger(\"0\") }") - p.println("internal val emptyUnaryFun: Function1 = { a -> 1.toLong() }") + p.println("internal val emptyBinaryFun: Function2 = { _, _ -> BigInteger(\"0\") }") + p.println("internal val emptyUnaryFun: Function1 = { _ -> 1.toLong() }") p.println() p.println("internal val unaryOperations: HashMap, Pair, Function1>>") p.println(" = hashMapOf, Pair, Function1>>(") diff --git a/generators/interpreter/GenerateInterpreterMap.kt b/generators/interpreter/GenerateInterpreterMap.kt index ff31c93517d..1ecc64a7ab5 100644 --- a/generators/interpreter/GenerateInterpreterMap.kt +++ b/generators/interpreter/GenerateInterpreterMap.kt @@ -49,7 +49,7 @@ fun generateMap(): String { val binaryIrOperationsMap = getBinaryIrOperationMap(irBuiltIns) - //save to file + p.println("@Suppress(\"DEPRECATION\")") p.println("val unaryFunctions = mapOf>(") p.println(generateUnaryBody(unaryOperationsMap, irBuiltIns)) p.println(")") diff --git a/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt b/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt index d134e141d19..9f039ba57a2 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt @@ -101,6 +101,8 @@ class GenerateProtoBufCompare { val sb = StringBuilder() val p = Printer(sb) p.println(File("license/COPYRIGHT.txt").readText()) + p.println("@file:Suppress(\"UNUSED_PARAMETER\")") + p.println("") p.println("package org.jetbrains.kotlin.incremental") p.println() diff --git a/idea/ide-common/src/org/jetbrains/kotlin/resolve/lazy/PartialBodyResolveFilter.kt b/idea/ide-common/src/org/jetbrains/kotlin/resolve/lazy/PartialBodyResolveFilter.kt index c821f721263..67baefc75f9 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/resolve/lazy/PartialBodyResolveFilter.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/resolve/lazy/PartialBodyResolveFilter.kt @@ -89,8 +89,9 @@ class PartialBodyResolveFilter( } fun updateNameFilter() { - val level = statementMarks.statementMark(statement) - when (level) { + when (statementMarks.statementMark(statement)) { + MarkLevel.NONE, MarkLevel.TAKE -> { + } MarkLevel.NEED_REFERENCE_RESOLVE -> nameFilter.addUsedNames(statement) MarkLevel.NEED_COMPLETION -> nameFilter.addAllNames() } diff --git a/libraries/tools/kotlin-gradle-statistics/src/org/jetbrains/kotlin/statistics/BuildSessionLogger.kt b/libraries/tools/kotlin-gradle-statistics/src/org/jetbrains/kotlin/statistics/BuildSessionLogger.kt index ac0189194bf..b3356bfb9df 100644 --- a/libraries/tools/kotlin-gradle-statistics/src/org/jetbrains/kotlin/statistics/BuildSessionLogger.kt +++ b/libraries/tools/kotlin-gradle-statistics/src/org/jetbrains/kotlin/statistics/BuildSessionLogger.kt @@ -119,7 +119,7 @@ class BuildSessionLogger( } @Synchronized - fun finishBuildSession(action: String?, failure: Throwable?) { + fun finishBuildSession(@Suppress("UNUSED_PARAMETER") action: String?, failure: Throwable?) { try { // nanotime could not be used as build start time in nanotime is unknown. As result, the measured duration // could be affected by system clock correction