i18n: update bundle for idea-analysis

This commit is contained in:
Dmitry Gridin
2020-03-10 14:50:19 +07:00
parent 5bd44b73b2
commit 4a7160b51a
14 changed files with 281 additions and 200 deletions
@@ -1,2 +1,77 @@
found=found:\u0020
html.0.has.no.corresponding.expected.declaration.1.html=<html>'{'0'}' has no corresponding expected declaration'{'1'}'</html>
html.0.is.not.abstract.and.does.not.implement.abstract.base.class.member.br.1.html=<html>'{'0'}' is not abstract and does not implement abstract base class member<br/>'{'1'}'</html>
html.0.is.not.abstract.and.does.not.implement.abstract.member.br.1.html=<html>'{'0'}' is not abstract and does not implement abstract member<br/>'{'1'}'</html>
html.0.method.may.be.missing.none.of.the.following.functions.will.be.called.ul.1.ul.html=<html>'''''{'0'}''''' method may be missing. None of the following functions will be called: <ul>'{'1'}'</ul></html>
html.0.must.override.1.br.because.it.inherits.many.implementations.of.it.html=<html>'{'0'}' must override '{'1'}'<br />because it inherits many implementations of it</html>
html.accidental.override.0.html=<html>Accidental override: '{'0'}'</html>
html.actual.class.0.has.no.corresponding.members.for.expected.class.members.1.html=<html>Actual class '''''{'0'}''''' has no corresponding members for expected class members:'{'1'}'</html>
html.assignment.operators.ambiguity.all.these.functions.match.ul.0.ul.table.html=<html>Assignment operators ambiguity. All these functions match.<ul>'{'0'}'</ul></table></html>
html.cannot.choose.among.the.following.candidates.without.completing.type.inference.ul.0.ul.html=<html>Cannot choose among the following candidates without completing type inference: <ul>'{'0'}'</ul></html>
html.expected.0.has.no.actual.declaration.in.module.1.2.html=<html>Expected '{'0'}' has no actual declaration in module '{'1'}''{'2'}'</html>
html.function.return.type.mismatch.table.tr.td.expected.td.td.1.td.tr.tr.td.found.td.td.2.td.tr.table.html=<html>Function return type mismatch.<table><tr><td>Expected:</td><td>'{'1'}'</td></tr><tr><td>Found:</td><td>'{'2'}'</td></tr></table></html>
html.getter.return.type.must.be.equal.to.the.type.of.the.property.table.tr.td.expected.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html=<html>Getter return type must be equal to the type of the property.<table><tr><td>Expected:</td><td>'{'0'}'</td></tr><tr><td>Found:</td><td>'{'1'}'</td></tr></table></html>
html.internal.error.occurred.while.analyzing.this.expression.br.table.cellspacing.0.cellpadding.0.tr.td.strong.please.use.the.strong.td.td.img.src.0.td.td.strong.icon.in.the.bottom.right.corner.to.report.this.error.strong.td.tr.table.br.pre.0.pre.html=<html>Internal Error occurred while analyzing this expression <br/><table cellspacing="0" cellpadding="0"><tr><td>(<strong>Please use the "</strong></td><td><img src="{0}"/></td><td><strong>" icon in the bottom-right corner to report this error</strong>):</td></tr></table><br/><pre>'{'0'}'</pre></html>
html.javascript.0.html=<html>JavaScript: '{'0'}'</html>
html.loop.parameter.type.mismatch.table.tr.td.iterated.values.td.td.0.td.tr.tr.td.parameter.td.td.1.td.tr.table.html=<html>Loop parameter type mismatch.<table><tr><td>Iterated values:</td><td>'{'0'}'</td></tr><tr><td>Parameter:</td><td>'{'1'}'</td></tr></table></html>
html.method.contains.from.concurrenthashmap.may.have.unexpected.semantics.it.calls.containsvalue.instead.of.containskey.br.use.explicit.form.of.the.call.to.containskey.containsvalue.contains.or.cast.the.value.to.kotlin.collections.map.instead.br.see.https.youtrack.jetbrains.com.issue.kt.18053.for.more.details.html=<html>Method ''contains'' from ConcurrentHashMap may have unexpected semantics: it calls ''containsValue'' instead of ''containsKey''.<br/>Use explicit form of the call to ''containsKey''/''containsValue''/''contains'' or cast the value to kotlin.collections.Map instead.<br/>See https://youtrack.jetbrains.com/issue/KT-18053 for more details</html>
html.method.iterator.is.ambiguous.for.this.expression.ul.0.ul.html=<html>Method ''''iterator()'''' is ambiguous for this expression.<ul>'{'0'}'</ul></html>
html.none.of.the.following.functions.can.be.called.with.the.arguments.supplied.ul.0.ul.html=<html>None of the following functions can be called with the arguments supplied. <ul>'{'0'}'</ul></html>
html.overload.resolution.ambiguity.all.these.functions.match.ul.0.ul.html=<html>Overload resolution ambiguity. All these functions match. <ul>'{'0'}'</ul></html>
html.overload.resolution.ambiguity.on.method.0.all.these.functions.match.ul.1.ul.html=<html>Overload resolution ambiguity on method '''''{'0'}'''''. All these functions match. <ul>'{'1'}'</ul></html>
html.platform.declaration.clash.0.html=<html>Platform declaration clash: '{'0'}'</html>
html.property.delegate.must.have.a.0.method.none.of.the.following.functions.is.suitable.ul.1.ul.html=<html>Property delegate must have a '''''{'0'}''''' method. None of the following functions is suitable. <ul>'{'1'}'</ul></html>
html.property.type.is.0.which.is.not.a.subtype.type.of.overridden.br.1.html=<html>Property type is '''''{'0'}''''', which is not a subtype type of overridden<br/>'{'1'}'</html>
html.return.type.is.0.which.is.not.a.subtype.of.overridden.br.1.html=<html>Return type is '''''{'0'}''''', which is not a subtype of overridden<br/>'{'1'}'</html>
html.return.types.of.inherited.members.are.incompatible.br.0.br.1.html=<html>Return types of inherited members are incompatible:<br/>'{'0'}',<br/>'{'1'}'</html>
html.setter.parameter.type.must.be.equal.to.the.type.of.the.property.table.tr.td.expected.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html=<html>Setter parameter type must be equal to the type of the property.<table><tr><td>Expected:</td><td>'{'0'}'</td></tr><tr><td>Found:</td><td>'{'1'}'</td></tr></table></html>
html.type.argument.is.not.within.its.bounds.table.tr.td.expected.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html=<html>Type argument is not within its bounds.<table><tr><td>Expected:</td><td>'{'0'}'</td></tr><tr><td>Found:</td><td>'{'1'}'</td></tr></table></html>
html.type.inference.failed.0.html=<html>Type inference failed: '{'0'}'</html>
html.type.mismatch.table.tr.td.required.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.br.projected.type.2.restricts.use.of.br.3.html=<html>Type mismatch.<table><tr><td>Required:</td><td>'{'0'}'</td></tr><tr><td>Found:</td><td>'{'1'}'</td></tr></table><br />\nProjected type '{'2'}' restricts use of <br />\n'{'3'}'\n</html>
html.type.mismatch.table.tr.td.required.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html=<html>Type mismatch.<table><tr><td>Required:</td><td>'{'0'}'</td></tr><tr><td>Found:</td><td>'{'1'}'</td></tr></table></html>
html.types.of.inherited.properties.are.incompatible.br.0.br.1.html=<html>Types of inherited properties are incompatible:<br/>'{'0'}',<br/>'{'1'}'</html>
html.types.of.inherited.var.properties.do.not.match.br.0.br.1.html=<html>Types of inherited var-properties do not match:<br/>'{'0'}',<br/>'{'1'}'</html>
html.unresolved.reference.br.none.of.the.following.candidates.is.applicable.because.of.receiver.type.mismatch.ul.0.ul.html=<html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul>'{'0'}'</ul></html>
html.val.property.cannot.override.var.property.br.1.html=<html>Val-property cannot override var-property<br />'{'1'}'</html>
html.val.property.cannot.override.var.property.br.1.html2=<html>Val-property cannot override var-property<br />'{'1'}'</html>
html.var.property.type.is.0.which.is.not.a.type.of.overridden.br.1.html=<html>Var-property type is '''''{'0'}''''', which is not a type of overridden<br/>'{'1'}'</html>
required=required:\u0020
type.inference.failed.expected.type.mismatch=Type inference failed. Expected type mismatch:\u0020
intention.suppress.family=Suppress Warnings
intention.suppress.text=Suppress ''{0}'' for {1} {2}
intention.suppress.text=Suppress ''{0}'' for {1} {2}
special.module.for.files.not.under.source.root=<special module for files not under source root>
sdk.0=<sdk {0}>
sources.for.library.0=<sources for library {0}>
library.0=<library {0}>
test.sources.for.module.0=<test sources for module {0}>
production.sources.for.module.0=<production sources for module {0}>
source.for.script.dependencies=<Source for script dependencies>
script.dependencies=<Script dependencies>
script.0.1=<script {0} {1}>
the.following.declarations.have.the.same.jvm.signature.code.0.1.code.br.ul.2.ul=The following declarations have the same JVM signature (<code>{0}{1}</code>):<br/>\n<ul>\n{2}</ul>
object=object
companion.object=companion object
initializer=initializer
statement=statement
0.of.1={0} of {1}
where=where
cannot.be.inferred=cannot be inferred
i.for.i.br.0=<i> for </i><br/>{0}
defined.in=defined in
root.package=root package
automatically.declared.based.on.the.expected.type=Automatically declared based on the expected type
0.smart.cast.to.1={0} smart cast to {1}
unknown.receiver=Unknown receiver
implicit.receiver=Implicit receiver
extension.implicit.receiver=Extension implicit receiver
always.null=Always null
value.captured.in.a.closure=Value captured in a closure
wrapped.into.a.reference.object.to.be.modified.when.captured.in.a.closure=Wrapped into a reference object to be modified when captured in a closure
smart.cast.to.0.for.1.call=Smart cast to {0} (for {1} call)
smart.cast.to.0=Smart cast to {0}
replace.overloaded.operator.with.function.call=Replace overloaded operator with function call
searching.for.implicit.usages=Searching for implicit usages...
class.initializer=<class initializer>
object.0=object{0}
show.non.public=Show non-public
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.caches.resolve.resolution
import org.jetbrains.kotlin.config.SourceKotlinRootType
import org.jetbrains.kotlin.config.TestSourceKotlinRootType
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.idea.caches.resolve.util.enlargedSearchScope
import org.jetbrains.kotlin.idea.caches.trackers.KotlinModuleOutOfCodeBlockModificationTracker
import org.jetbrains.kotlin.idea.configuration.BuildSystemType
@@ -189,7 +190,7 @@ data class ModuleProductionSourceInfo internal constructor(
override val module: Module
) : ModuleSourceInfoWithExpectedBy(forProduction = true) {
override val name = Name.special("<production sources for module ${module.name}>")
override val name = Name.special(KotlinIdeaAnalysisBundle.message("production.sources.for.module.0", module.name))
override val stableName: Name = module.getStableName()
@@ -203,7 +204,7 @@ data class ModuleProductionSourceInfo internal constructor(
data class ModuleTestSourceInfo internal constructor(override val module: Module) :
ModuleSourceInfoWithExpectedBy(forProduction = false), org.jetbrains.kotlin.idea.caches.resolve.ModuleTestSourceInfo {
override val name = Name.special("<test sources for module ${module.name}>")
override val name = Name.special(KotlinIdeaAnalysisBundle.message("test.sources.for.module.0", module.name))
override val stableName: Name = module.getStableName()
@@ -287,7 +288,7 @@ open class LibraryInfo(val project: Project, val library: Library) : IdeaModuleI
override val moduleOrigin: ModuleOrigin
get() = ModuleOrigin.LIBRARY
override val name: Name = Name.special("<library ${library.name}>")
override val name: Name = Name.special(KotlinIdeaAnalysisBundle.message("library.0", library.name.toString()))
override fun contentScope(): GlobalSearchScope = LibraryWithoutSourceScope(project, library)
@@ -331,7 +332,7 @@ open class LibraryInfo(val project: Project, val library: Library) : IdeaModuleI
data class LibrarySourceInfo(val project: Project, val library: Library, override val binariesModuleInfo: BinaryModuleInfo) :
IdeaModuleInfo, SourceForBinaryModuleInfo {
override val name: Name = Name.special("<sources for library ${library.name}>")
override val name: Name = Name.special(KotlinIdeaAnalysisBundle.message("sources.for.library.0", library.name.toString()))
override fun sourceScope(): GlobalSearchScope = KotlinSourceFilterScope.librarySources(
LibrarySourceScope(
@@ -358,7 +359,7 @@ data class SdkInfo(val project: Project, val sdk: Sdk) : IdeaModuleInfo {
override val moduleOrigin: ModuleOrigin
get() = ModuleOrigin.LIBRARY
override val name: Name = Name.special("<sdk ${sdk.name}>")
override val name: Name = Name.special(KotlinIdeaAnalysisBundle.message("sdk.0", sdk.name))
override fun contentScope(): GlobalSearchScope = SdkScope(project, sdk)
@@ -375,7 +376,7 @@ object NotUnderContentRootModuleInfo : IdeaModuleInfo {
override val moduleOrigin: ModuleOrigin
get() = ModuleOrigin.OTHER
override val name: Name = Name.special("<special module for files not under source root>")
override val name: Name = Name.special(KotlinIdeaAnalysisBundle.message("special.module.for.files.not.under.source.root"))
override fun contentScope() = GlobalSearchScope.EMPTY_SCOPE
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
import org.jetbrains.kotlin.idea.core.script.dependencies.ScriptAdditionalIdeaDependenciesProvider
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
@@ -28,7 +29,7 @@ data class ScriptModuleInfo(
override val moduleOrigin: ModuleOrigin
get() = ModuleOrigin.OTHER
override val name: Name = Name.special("<script ${scriptFile.name} ${scriptDefinition.name}>")
override val name: Name = Name.special(KotlinIdeaAnalysisBundle.message("script.0.1", scriptFile.name, scriptDefinition.name))
override fun contentScope() = GlobalSearchScope.fileScope(project, scriptFile)
@@ -61,7 +62,7 @@ data class ScriptModuleInfo(
sealed class ScriptDependenciesInfo(val project: Project) : IdeaModuleInfo, BinaryModuleInfo {
abstract val sdk: Sdk?
override val name = Name.special("<Script dependencies>")
override val name = Name.special(KotlinIdeaAnalysisBundle.message("script.dependencies"))
override fun dependencies(): List<IdeaModuleInfo> = listOfNotNull(this, sdk?.let { SdkInfo(project, it) })
@@ -118,7 +119,7 @@ sealed class ScriptDependenciesInfo(val project: Project) : IdeaModuleInfo, Bina
}
sealed class ScriptDependenciesSourceInfo(val project: Project) : IdeaModuleInfo, SourceForBinaryModuleInfo {
override val name = Name.special("<Source for script dependencies>")
override val name = Name.special(KotlinIdeaAnalysisBundle.message("source.for.script.dependencies"))
override val binariesModuleInfo: ScriptDependenciesInfo
get() = ScriptDependenciesInfo.ForProject(project)
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.highlighter;
@@ -20,8 +9,8 @@ import com.intellij.icons.AllIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.kotlin.diagnostics.Diagnostic;
import org.jetbrains.kotlin.diagnostics.TypeMismatchDueToTypeProjectionsData;
import org.jetbrains.kotlin.diagnostics.rendering.*;
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle;
import org.jetbrains.kotlin.js.resolve.diagnostics.ErrorsJs;
import org.jetbrains.kotlin.js.resolve.diagnostics.JsCallDataHtmlRenderer;
@@ -32,11 +21,7 @@ import static org.jetbrains.kotlin.diagnostics.rendering.Renderers.*;
import static org.jetbrains.kotlin.diagnostics.rendering.TabledDescriptorRenderer.TextElementType;
import static org.jetbrains.kotlin.idea.highlighter.HtmlTabledDescriptorRenderer.tableForTypes;
import static org.jetbrains.kotlin.idea.highlighter.IdeRenderers.*;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.ACCIDENTAL_OVERRIDE;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.CONFLICTING_JVM_DECLARATIONS;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.CONCURRENT_HASH_MAP_CONTAINS_OPERATOR;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.CONCURRENT_HASH_MAP_CONTAINS_OPERATOR_ERROR;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.*;
/**
@@ -63,136 +48,151 @@ public class IdeErrorMessages {
}
static {
MAP.put(TYPE_MISMATCH, "<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table></html>",
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(TYPE_MISMATCH, KotlinIdeaAnalysisBundle
.message("html.type.mismatch.table.tr.td.required.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html"), HTML_RENDER_TYPE,
HTML_RENDER_TYPE);
MAP.put(NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, "<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table></html>",
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS, KotlinIdeaAnalysisBundle
.message("html.type.mismatch.table.tr.td.required.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html"), HTML_RENDER_TYPE,
HTML_RENDER_TYPE);
MAP.put(TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS,
"<html>Type mismatch.<table><tr><td>Required:</td><td>{0}</td></tr><tr><td>Found:</td><td>{1}</td></tr></table><br />\n" +
"Projected type {2} restricts use of <br />\n{3}\n</html>",
new MultiRenderer<TypeMismatchDueToTypeProjectionsData>() {
@NotNull
@Override
public String[] render(@NotNull TypeMismatchDueToTypeProjectionsData object) {
RenderingContext context = RenderingContext
.of(object.getExpectedType(), object.getExpressionType(), object.getReceiverType(), object.getCallableDescriptor());
return new String[] {
HTML_RENDER_TYPE.render(object.getExpectedType(), context),
HTML_RENDER_TYPE.render(object.getExpressionType(), context),
HTML_RENDER_TYPE.render(object.getReceiverType(), context),
HTML.render(object.getCallableDescriptor(), context)
};
}
MAP.put(TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS, KotlinIdeaAnalysisBundle.message(
"html.type.mismatch.table.tr.td.required.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.br.projected.type.2.restricts.use.of.br.3.html"),
object -> {
RenderingContext context = RenderingContext
.of(object.getExpectedType(), object.getExpressionType(), object.getReceiverType(),
object.getCallableDescriptor());
return new String[] {
HTML_RENDER_TYPE.render(object.getExpectedType(), context),
HTML_RENDER_TYPE.render(object.getExpressionType(), context),
HTML_RENDER_TYPE.render(object.getReceiverType(), context),
HTML.render(object.getCallableDescriptor(), context)
};
});
MAP.put(ASSIGN_OPERATOR_AMBIGUITY, "<html>Assignment operators ambiguity. All these functions match.<ul>{0}</ul></table></html>",
MAP.put(ASSIGN_OPERATOR_AMBIGUITY,
KotlinIdeaAnalysisBundle.message("html.assignment.operators.ambiguity.all.these.functions.match.ul.0.ul.table.html"),
HTML_AMBIGUOUS_CALLS);
MAP.put(TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS, "<html>Type inference failed: {0}</html>", HTML_TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS_RENDERER);
MAP.put(TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER, "<html>Type inference failed: {0}</html>", HTML_TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER_RENDERER);
MAP.put(TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR, "<html>Type inference failed: {0}</html>", HTML_TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR_RENDERER);
MAP.put(TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH, tableForTypes("Type inference failed. Expected type mismatch: ",
"required: ", TextElementType.STRONG,
"found: ", TextElementType.ERROR), HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS, KotlinIdeaAnalysisBundle.message("html.type.inference.failed.0.html"),
HTML_TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS_RENDERER);
MAP.put(TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER, KotlinIdeaAnalysisBundle.message("html.type.inference.failed.0.html"),
HTML_TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER_RENDERER);
MAP.put(TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR, KotlinIdeaAnalysisBundle.message("html.type.inference.failed.0.html"),
HTML_TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR_RENDERER);
MAP.put(TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH,
tableForTypes(KotlinIdeaAnalysisBundle.message("type.inference.failed.expected.type.mismatch"),
KotlinIdeaAnalysisBundle.message("required"), TextElementType.STRONG,
KotlinIdeaAnalysisBundle.message("found"), TextElementType.ERROR), HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(TYPE_INFERENCE_UPPER_BOUND_VIOLATED, "<html>{0}</html>", HTML_TYPE_INFERENCE_UPPER_BOUND_VIOLATED_RENDERER);
MAP.put(WRONG_SETTER_PARAMETER_TYPE, "<html>Setter parameter type must be equal to the type of the property." +
"<table><tr><td>Expected:</td><td>{0}</td></tr>" +
"<tr><td>Found:</td><td>{1}</td></tr></table></html>", HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(WRONG_GETTER_RETURN_TYPE, "<html>Getter return type must be equal to the type of the property." +
"<table><tr><td>Expected:</td><td>{0}</td></tr>" +
"<tr><td>Found:</td><td>{1}</td></tr></table></html>", HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(WRONG_SETTER_PARAMETER_TYPE, KotlinIdeaAnalysisBundle.message(
"html.setter.parameter.type.must.be.equal.to.the.type.of.the.property.table.tr.td.expected.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html"),
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(WRONG_GETTER_RETURN_TYPE, KotlinIdeaAnalysisBundle.message(
"html.getter.return.type.must.be.equal.to.the.type.of.the.property.table.tr.td.expected.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html"),
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(ITERATOR_AMBIGUITY, "<html>Method ''iterator()'' is ambiguous for this expression.<ul>{0}</ul></html>", HTML_AMBIGUOUS_CALLS);
MAP.put(ITERATOR_AMBIGUITY, KotlinIdeaAnalysisBundle.message("html.method.iterator.is.ambiguous.for.this.expression.ul.0.ul.html"),
HTML_AMBIGUOUS_CALLS);
MAP.put(UPPER_BOUND_VIOLATED, "<html>Type argument is not within its bounds." +
"<table><tr><td>Expected:</td><td>{0}</td></tr>" +
"<tr><td>Found:</td><td>{1}</td></tr></table></html>", HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(UPPER_BOUND_VIOLATED, KotlinIdeaAnalysisBundle.message(
"html.type.argument.is.not.within.its.bounds.table.tr.td.expected.td.td.0.td.tr.tr.td.found.td.td.1.td.tr.table.html"),
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(TYPE_MISMATCH_IN_FOR_LOOP, "<html>Loop parameter type mismatch." +
"<table><tr><td>Iterated values:</td><td>{0}</td></tr>" +
"<tr><td>Parameter:</td><td>{1}</td></tr></table></html>", HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(TYPE_MISMATCH_IN_FOR_LOOP, KotlinIdeaAnalysisBundle.message(
"html.loop.parameter.type.mismatch.table.tr.td.iterated.values.td.td.0.td.tr.tr.td.parameter.td.td.1.td.tr.table.html"),
HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(RETURN_TYPE_MISMATCH_ON_OVERRIDE, "<html>Return type is ''{0}'', which is not a subtype of overridden<br/>" +
"{1}</html>", HTML_RENDER_RETURN_TYPE, HTML_WITH_ANNOTATIONS_WHITELIST);
MAP.put(RETURN_TYPE_MISMATCH_ON_INHERITANCE, "<html>Return types of inherited members are incompatible:<br/>{0},<br/>{1}</html>",
HTML, HTML);
MAP.put(RETURN_TYPE_MISMATCH_ON_OVERRIDE,
KotlinIdeaAnalysisBundle.message("html.return.type.is.0.which.is.not.a.subtype.of.overridden.br.1.html"),
HTML_RENDER_RETURN_TYPE, HTML_WITH_ANNOTATIONS_WHITELIST);
MAP.put(RETURN_TYPE_MISMATCH_ON_INHERITANCE,
KotlinIdeaAnalysisBundle.message("html.return.types.of.inherited.members.are.incompatible.br.0.br.1.html"), HTML, HTML);
MAP.put(PROPERTY_TYPE_MISMATCH_ON_OVERRIDE, "<html>Property type is ''{0}'', which is not a subtype type of overridden<br/>" +
"{1}</html>", HTML_RENDER_RETURN_TYPE, HTML);
MAP.put(VAR_TYPE_MISMATCH_ON_OVERRIDE, "<html>Var-property type is ''{0}'', which is not a type of overridden<br/>" +
"{1}</html>", HTML_RENDER_RETURN_TYPE, HTML);
MAP.put(PROPERTY_TYPE_MISMATCH_ON_INHERITANCE, "<html>Types of inherited properties are incompatible:<br/>{0},<br/>{1}</html>",
HTML, HTML);
MAP.put(VAR_TYPE_MISMATCH_ON_INHERITANCE, "<html>Types of inherited var-properties do not match:<br/>{0},<br/>{1}</html>",
HTML, HTML);
MAP.put(PROPERTY_TYPE_MISMATCH_ON_OVERRIDE,
KotlinIdeaAnalysisBundle.message("html.property.type.is.0.which.is.not.a.subtype.type.of.overridden.br.1.html"),
HTML_RENDER_RETURN_TYPE, HTML);
MAP.put(VAR_TYPE_MISMATCH_ON_OVERRIDE,
KotlinIdeaAnalysisBundle.message("html.var.property.type.is.0.which.is.not.a.type.of.overridden.br.1.html"),
HTML_RENDER_RETURN_TYPE, HTML);
MAP.put(PROPERTY_TYPE_MISMATCH_ON_INHERITANCE,
KotlinIdeaAnalysisBundle.message("html.types.of.inherited.properties.are.incompatible.br.0.br.1.html"), HTML, HTML);
MAP.put(VAR_TYPE_MISMATCH_ON_INHERITANCE,
KotlinIdeaAnalysisBundle.message("html.types.of.inherited.var.properties.do.not.match.br.0.br.1.html"), HTML, HTML);
MAP.put(VAR_OVERRIDDEN_BY_VAL, "<html>Val-property cannot override var-property<br />" +
"{1}</html>", HTML, HTML);
MAP.put(VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION, "<html>Val-property cannot override var-property<br />" +
"{1}</html>", HTML, HTML);
MAP.put(VAR_OVERRIDDEN_BY_VAL, KotlinIdeaAnalysisBundle.message("html.val.property.cannot.override.var.property.br.1.html2"), HTML,
HTML);
MAP.put(VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION,
KotlinIdeaAnalysisBundle.message("html.val.property.cannot.override.var.property.br.1.html"), HTML, HTML);
MAP.put(ABSTRACT_MEMBER_NOT_IMPLEMENTED, "<html>{0} is not abstract and does not implement abstract member<br/>" +
"{1}</html>", RENDER_CLASS_OR_OBJECT, HTML);
MAP.put(ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED, "<html>{0} is not abstract and does not implement abstract base class member<br/>" +
"{1}</html>", RENDER_CLASS_OR_OBJECT, HTML);
MAP.put(MANY_IMPL_MEMBER_NOT_IMPLEMENTED, "<html>{0} must override {1}<br />because it inherits many implementations of it</html>",
MAP.put(ABSTRACT_MEMBER_NOT_IMPLEMENTED,
KotlinIdeaAnalysisBundle.message("html.0.is.not.abstract.and.does.not.implement.abstract.member.br.1.html"),
RENDER_CLASS_OR_OBJECT, HTML);
MAP.put(ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED,
KotlinIdeaAnalysisBundle.message("html.0.is.not.abstract.and.does.not.implement.abstract.base.class.member.br.1.html"),
RENDER_CLASS_OR_OBJECT, HTML);
MAP.put(RESULT_TYPE_MISMATCH, "<html>Function return type mismatch." +
"<table><tr><td>Expected:</td><td>{1}</td></tr>" +
"<tr><td>Found:</td><td>{2}</td></tr></table></html>", STRING, HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(MANY_IMPL_MEMBER_NOT_IMPLEMENTED,
KotlinIdeaAnalysisBundle.message("html.0.must.override.1.br.because.it.inherits.many.implementations.of.it.html"),
RENDER_CLASS_OR_OBJECT, HTML);
MAP.put(OVERLOAD_RESOLUTION_AMBIGUITY, "<html>Overload resolution ambiguity. All these functions match. <ul>{0}</ul></html>", HTML_AMBIGUOUS_CALLS);
MAP.put(NONE_APPLICABLE, "<html>None of the following functions can be called with the arguments supplied. <ul>{0}</ul></html>",
MAP.put(RESULT_TYPE_MISMATCH, KotlinIdeaAnalysisBundle
.message("html.function.return.type.mismatch.table.tr.td.expected.td.td.1.td.tr.tr.td.found.td.td.2.td.tr.table.html"),
STRING, HTML_RENDER_TYPE, HTML_RENDER_TYPE);
MAP.put(OVERLOAD_RESOLUTION_AMBIGUITY,
KotlinIdeaAnalysisBundle.message("html.overload.resolution.ambiguity.all.these.functions.match.ul.0.ul.html"),
HTML_AMBIGUOUS_CALLS);
MAP.put(NONE_APPLICABLE, KotlinIdeaAnalysisBundle
.message("html.none.of.the.following.functions.can.be.called.with.the.arguments.supplied.ul.0.ul.html"),
HTML_NONE_APPLICABLE_CALLS);
MAP.put(CANNOT_COMPLETE_RESOLVE, KotlinIdeaAnalysisBundle
.message("html.cannot.choose.among.the.following.candidates.without.completing.type.inference.ul.0.ul.html"),
HTML_AMBIGUOUS_CALLS);
MAP.put(UNRESOLVED_REFERENCE_WRONG_RECEIVER, KotlinIdeaAnalysisBundle.message(
"html.unresolved.reference.br.none.of.the.following.candidates.is.applicable.because.of.receiver.type.mismatch.ul.0.ul.html"),
HTML_AMBIGUOUS_CALLS);
MAP.put(DELEGATE_SPECIAL_FUNCTION_AMBIGUITY,
KotlinIdeaAnalysisBundle.message("html.overload.resolution.ambiguity.on.method.0.all.these.functions.match.ul.1.ul.html"),
STRING, HTML_AMBIGUOUS_CALLS);
MAP.put(DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, KotlinIdeaAnalysisBundle
.message("html.property.delegate.must.have.a.0.method.none.of.the.following.functions.is.suitable.ul.1.ul.html"), STRING,
HTML_NONE_APPLICABLE_CALLS);
MAP.put(DELEGATE_PD_METHOD_NONE_APPLICABLE, KotlinIdeaAnalysisBundle
.message("html.0.method.may.be.missing.none.of.the.following.functions.will.be.called.ul.1.ul.html"), STRING,
HTML_NONE_APPLICABLE_CALLS);
MAP.put(CANNOT_COMPLETE_RESOLVE, "<html>Cannot choose among the following candidates without completing type inference: <ul>{0}</ul></html>", HTML_AMBIGUOUS_CALLS);
MAP.put(UNRESOLVED_REFERENCE_WRONG_RECEIVER, "<html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul>{0}</ul></html>", HTML_AMBIGUOUS_CALLS);
MAP.put(DELEGATE_SPECIAL_FUNCTION_AMBIGUITY, "<html>Overload resolution ambiguity on method ''{0}''. All these functions match. <ul>{1}</ul></html>", STRING, HTML_AMBIGUOUS_CALLS);
MAP.put(DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, "<html>Property delegate must have a ''{0}'' method. None of the following functions is suitable. <ul>{1}</ul></html>",
STRING, HTML_NONE_APPLICABLE_CALLS);
MAP.put(DELEGATE_PD_METHOD_NONE_APPLICABLE, "<html>''{0}'' method may be missing. None of the following functions will be called: <ul>{1}</ul></html>",
STRING, HTML_NONE_APPLICABLE_CALLS);
MAP.put(CONFLICTING_JVM_DECLARATIONS, "<html>Platform declaration clash: {0}</html>", HTML_CONFLICTING_JVM_DECLARATIONS_DATA);
MAP.put(ACCIDENTAL_OVERRIDE, "<html>Accidental override: {0}</html>", HTML_CONFLICTING_JVM_DECLARATIONS_DATA);
MAP.put(CONFLICTING_JVM_DECLARATIONS, KotlinIdeaAnalysisBundle.message("html.platform.declaration.clash.0.html"),
HTML_CONFLICTING_JVM_DECLARATIONS_DATA);
MAP.put(ACCIDENTAL_OVERRIDE, KotlinIdeaAnalysisBundle.message("html.accidental.override.0.html"),
HTML_CONFLICTING_JVM_DECLARATIONS_DATA);
URL errorIconUrl = AllIcons.class.getResource(ErrorIconUtil.getErrorIconUrl());
MAP.put(EXCEPTION_FROM_ANALYZER, "<html>Internal Error occurred while analyzing this expression <br/>" +
"<table cellspacing=\"0\" cellpadding=\"0\">" +
"<tr>" +
"<td>(<strong>Please use the \"</strong></td>" +
"<td><img src=\"" + errorIconUrl + "\"/></td>" +
"<td><strong>\" icon in the bottom-right corner to report this error</strong>):</td>" +
"</tr>" +
"</table>" +
"<br/>" +
"<pre>{0}</pre>" +
"</html>",
HTML_THROWABLE);
MAP.put(EXCEPTION_FROM_ANALYZER, KotlinIdeaAnalysisBundle.message(
"html.internal.error.occurred.while.analyzing.this.expression.br.table.cellspacing.0.cellpadding.0.tr.td.strong.please.use.the.strong.td.td.img.src.0.td.td.strong.icon.in.the.bottom.right.corner.to.report.this.error.strong.td.tr.table.br.pre.0.pre.html",
errorIconUrl), HTML_THROWABLE);
MAP.put(ErrorsJs.JSCODE_ERROR, "<html>JavaScript: {0}</html>", JsCallDataHtmlRenderer.INSTANCE);
MAP.put(ErrorsJs.JSCODE_WARNING, "<html>JavaScript: {0}</html>", JsCallDataHtmlRenderer.INSTANCE);
MAP.put(UNSUPPORTED_FEATURE, "<html>{0}</html>", new LanguageFeatureMessageRenderer(LanguageFeatureMessageRenderer.Type.UNSUPPORTED, true));
MAP.put(EXPERIMENTAL_FEATURE_WARNING, "<html>{0}</html>", new LanguageFeatureMessageRenderer(LanguageFeatureMessageRenderer.Type.WARNING, true));
MAP.put(EXPERIMENTAL_FEATURE_ERROR, "<html>{0}</html>", new LanguageFeatureMessageRenderer(LanguageFeatureMessageRenderer.Type.ERROR, true));
MAP.put(ErrorsJs.JSCODE_ERROR, KotlinIdeaAnalysisBundle.message("html.javascript.0.html"), JsCallDataHtmlRenderer.INSTANCE);
MAP.put(ErrorsJs.JSCODE_WARNING, KotlinIdeaAnalysisBundle.message("html.javascript.0.html"), JsCallDataHtmlRenderer.INSTANCE);
MAP.put(UNSUPPORTED_FEATURE, "<html>{0}</html>",
new LanguageFeatureMessageRenderer(LanguageFeatureMessageRenderer.Type.UNSUPPORTED, true));
MAP.put(EXPERIMENTAL_FEATURE_WARNING, "<html>{0}</html>",
new LanguageFeatureMessageRenderer(LanguageFeatureMessageRenderer.Type.WARNING, true));
MAP.put(EXPERIMENTAL_FEATURE_ERROR, "<html>{0}</html>",
new LanguageFeatureMessageRenderer(LanguageFeatureMessageRenderer.Type.ERROR, true));
MAP.put(NO_ACTUAL_FOR_EXPECT, "<html>Expected {0} has no actual declaration in module {1}{2}</html>", DECLARATION_NAME_WITH_KIND,
MODULE_WITH_PLATFORM, new PlatformIncompatibilityDiagnosticRenderer(IdeMultiplatformDiagnosticRenderingMode.INSTANCE));
MAP.put(ACTUAL_WITHOUT_EXPECT, "<html>{0} has no corresponding expected declaration{1}</html>", CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM,
MAP.put(NO_ACTUAL_FOR_EXPECT, KotlinIdeaAnalysisBundle.message("html.expected.0.has.no.actual.declaration.in.module.1.2.html"),
DECLARATION_NAME_WITH_KIND, MODULE_WITH_PLATFORM,
new PlatformIncompatibilityDiagnosticRenderer(IdeMultiplatformDiagnosticRenderingMode.INSTANCE));
MAP.put(NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS, "<html>Actual class ''{0}'' has no corresponding members for expected class members:{1}</html>",
MAP.put(ACTUAL_WITHOUT_EXPECT, KotlinIdeaAnalysisBundle.message("html.0.has.no.corresponding.expected.declaration.1.html"),
CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM,
new PlatformIncompatibilityDiagnosticRenderer(IdeMultiplatformDiagnosticRenderingMode.INSTANCE));
MAP.put(NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS,
KotlinIdeaAnalysisBundle.message("html.actual.class.0.has.no.corresponding.members.for.expected.class.members.1.html"),
NAME, new IncompatibleExpectedActualClassScopesRenderer(IdeMultiplatformDiagnosticRenderingMode.INSTANCE));
String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS =
"<html>Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'.<br/>" +
"Use explicit form of the call to 'containsKey'/'containsValue'/'contains' or cast the value to kotlin.collections.Map instead.<br/>" +
"See https://youtrack.jetbrains.com/issue/KT-18053 for more details</html>";
String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = KotlinIdeaAnalysisBundle.message(
"html.method.contains.from.concurrenthashmap.may.have.unexpected.semantics.it.calls.containsvalue.instead.of.containskey.br.use.explicit.form.of.the.call.to.containskey.containsvalue.contains.or.cast.the.value.to.kotlin.collections.map.instead.br.see.https.youtrack.jetbrains.com.issue.kt.18053.for.more.details.html");
MAP.put(CONCURRENT_HASH_MAP_CONTAINS_OPERATOR, MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS);
MAP.put(CONCURRENT_HASH_MAP_CONTAINS_OPERATOR_ERROR, MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS);
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.highlighter
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.diagnostics.rendering.*
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.idea.highlighter.renderersUtil.renderResolvedCall
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.renderer.DescriptorRendererModifier
@@ -75,8 +76,12 @@ object IdeRenderers {
val context = RenderingContext.of(descriptors)
val conflicts = descriptors.joinToString("") { "<li>" + HTML.render(it, context) + "</li>\n" }
"The following declarations have the same JVM signature (<code>${data.signature.name}${data.signature
.desc}</code>):<br/>\n<ul>\n$conflicts</ul>"
KotlinIdeaAnalysisBundle.message(
"the.following.declarations.have.the.same.jvm.signature.code.0.1.code.br.ul.2.ul",
data.signature.name,
data.signature.desc,
conflicts
)
}
@JvmField
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -10,6 +10,7 @@ import com.intellij.codeInspection.SuppressableProblemGroup
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.idea.quickfix.AnnotationHostKind
import org.jetbrains.kotlin.idea.quickfix.KotlinSuppressIntentionAction
import org.jetbrains.kotlin.psi.*
@@ -59,7 +60,10 @@ fun createSuppressWarningActions(element: PsiElement, severity: Severity, suppre
current is KtExpression && suppressAtStatementAllowed -> {
// Add suppress action at first statement
if (current.parent is KtBlockExpression || current.parent is KtDestructuringDeclaration) {
val kind = if (current.parent is KtBlockExpression) "statement" else "initializer"
val kind = if (current.parent is KtBlockExpression)
KotlinIdeaAnalysisBundle.message("statement")
else
KotlinIdeaAnalysisBundle.message("initializer")
actions.add(
KotlinSuppressIntentionAction(current, suppressionKey, AnnotationHostKind(kind, "", true))
)
@@ -105,9 +109,13 @@ private object DeclarationKindDetector : KtVisitor<AnnotationHostKind?, Unit?>()
detect(constructor, "secondary constructor of")
override fun visitObjectDeclaration(d: KtObjectDeclaration, data: Unit?): AnnotationHostKind? {
if (d.isCompanion()) return detect(d, "companion object", name = "${d.name} of ${d.getStrictParentOfType<KtClass>()?.name}")
if (d.isCompanion()) return detect(
d,
KotlinIdeaAnalysisBundle.message("companion.object"),
name = KotlinIdeaAnalysisBundle.message("0.of.1", d.name.toString(), d.getStrictParentOfType<KtClass>()?.name.toString())
)
if (d.parent is KtObjectLiteralExpression) return null
return detect(d, "object")
return detect(d, KotlinIdeaAnalysisBundle.message("object"))
}
private fun detect(
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.descriptors.VariableDescriptor
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingColors.*
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.renderer.DescriptorRenderer
@@ -32,7 +33,9 @@ internal class VariablesHighlightingVisitor(holder: AnnotationHolder, bindingCon
override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) {
val target = bindingContext.get(REFERENCE_TARGET, expression) ?: return
if (target is ValueParameterDescriptor && bindingContext.get(AUTO_CREATED_IT, target) == true) {
createInfoAnnotation(expression, FUNCTION_LITERAL_DEFAULT_PARAMETER, "Automatically declared based on the expected type")
createInfoAnnotation(expression, FUNCTION_LITERAL_DEFAULT_PARAMETER,
KotlinIdeaAnalysisBundle.message("automatically.declared.based.on.the.expected.type")
)
} else if (expression.parent !is KtValueArgumentName) { // highlighted separately
highlightVariable(expression, target)
}
@@ -76,20 +79,24 @@ internal class VariablesHighlightingVisitor(holder: AnnotationHolder, bindingCon
if (implicitSmartCast != null) {
for ((receiver, type) in implicitSmartCast.receiverTypes) {
val receiverName = when (receiver) {
is ExtensionReceiver -> "Extension implicit receiver"
is ImplicitClassReceiver -> "Implicit receiver"
else -> "Unknown receiver"
is ExtensionReceiver -> KotlinIdeaAnalysisBundle.message("extension.implicit.receiver")
is ImplicitClassReceiver -> KotlinIdeaAnalysisBundle.message("implicit.receiver")
else -> KotlinIdeaAnalysisBundle.message("unknown.receiver")
}
createInfoAnnotation(
expression,
"$receiverName smart cast to " + DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(type)
KotlinIdeaAnalysisBundle.message(
"0.smart.cast.to.1",
receiverName,
DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(type)
)
).textAttributes = SMART_CAST_RECEIVER
}
}
val nullSmartCast = bindingContext.get(SMARTCAST_NULL, expression) == true
if (nullSmartCast) {
createInfoAnnotation(expression, "Always null").textAttributes = SMART_CONSTANT
createInfoAnnotation(expression, KotlinIdeaAnalysisBundle.message("always.null")).textAttributes = SMART_CONSTANT
}
val smartCast = bindingContext.get(SMARTCAST, expression)
@@ -98,13 +105,17 @@ internal class VariablesHighlightingVisitor(holder: AnnotationHolder, bindingCon
if (defaultType != null) {
createInfoAnnotation(
getSmartCastTarget(expression),
"Smart cast to " + DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(defaultType)
KotlinIdeaAnalysisBundle.message("smart.cast.to.0", DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(defaultType))
).textAttributes = SMART_CAST_VALUE
} else if (smartCast is MultipleSmartCasts) {
for ((call, type) in smartCast.map) {
createInfoAnnotation(
getSmartCastTarget(expression),
"Smart cast to ${DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(type)} (for $call call)"
KotlinIdeaAnalysisBundle.message(
"smart.cast.to.0.for.1.call",
DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(type),
call.toString()
)
).textAttributes = SMART_CAST_VALUE
}
}
@@ -135,9 +146,9 @@ internal class VariablesHighlightingVisitor(holder: AnnotationHolder, bindingCon
if (bindingContext.get(CAPTURED_IN_CLOSURE, descriptor) == CaptureKind.NOT_INLINE) {
val msg = if (descriptor.isVar)
"Wrapped into a reference object to be modified when captured in a closure"
KotlinIdeaAnalysisBundle.message("wrapped.into.a.reference.object.to.be.modified.when.captured.in.a.closure")
else
"Value captured in a closure"
KotlinIdeaAnalysisBundle.message("value.captured.in.a.closure")
val parent = elementToHighlight.parent
if (!(parent is PsiNameIdentifierOwner && parent.nameIdentifier == elementToHighlight)) {
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.diagnostics.rendering.RenderingContext
import org.jetbrains.kotlin.diagnostics.rendering.SmartTypeRenderer
import org.jetbrains.kotlin.diagnostics.rendering.asRenderer
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.renderer.ClassifierNamePolicy
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.renderer.RenderingFormat
@@ -67,10 +68,10 @@ fun renderResolvedCall(resolvedCall: ResolvedCall<*>, context: RenderingContext)
val typeParameters = resolvedCall.candidateDescriptor.typeParameters
val (inferredTypeParameters, notInferredTypeParameters) = typeParameters.partition(TypeParameterDescriptor::isInferred)
append("<br/>$indent<i>where</i> ")
append("<br/>$indent<i>${KotlinIdeaAnalysisBundle.message("where")}</i> ")
if (notInferredTypeParameters.isNotEmpty()) {
append(notInferredTypeParameters.joinToString { typeParameter -> renderError(typeParameter.name) })
append("<i> cannot be inferred</i>")
append("<i> ${KotlinIdeaAnalysisBundle.message("cannot.be.inferred")}</i>")
if (inferredTypeParameters.isNotEmpty()) {
append("; ")
}
@@ -95,14 +96,14 @@ fun renderResolvedCall(resolvedCall: ResolvedCall<*>, context: RenderingContext)
if (resolvedCall.candidateDescriptor.typeParameters.isNotEmpty()) {
appendTypeParametersSubstitution()
append("<i> for </i><br/>$indent")
append(KotlinIdeaAnalysisBundle.message("i.for.i.br.0", indent))
// candidate descriptor is not in context of the rest of the message
append(descriptorRenderer.render(resolvedCall.candidateDescriptor, RenderingContext.of(resolvedCall.candidateDescriptor)))
} else {
append(" <i>defined in</i> ")
append(" <i>${KotlinIdeaAnalysisBundle.message("defined.in")}</i> ")
val containingDeclaration = resultingDescriptor.containingDeclaration
val fqName = DescriptorUtils.getFqName(containingDeclaration)
append(if (fqName.isRoot) "root package" else fqName.asString())
append(if (fqName.isRoot) KotlinIdeaAnalysisBundle.message("root.package") else fqName.asString())
}
return stringBuilder.toString()
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -7,9 +7,11 @@ package org.jetbrains.kotlin.idea.intentions
import com.intellij.openapi.editor.Editor
import com.intellij.psi.PsiElement
import org.jetbrains.annotations.NonNls
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
import org.jetbrains.kotlin.idea.project.languageVersionSettings
@@ -27,7 +29,9 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.util.OperatorNameConventions
class OperatorToFunctionIntention :
SelfTargetingIntention<KtExpression>(KtExpression::class.java, "Replace overloaded operator with function call") {
SelfTargetingIntention<KtExpression>(KtExpression::class.java,
KotlinIdeaAnalysisBundle.message("replace.overloaded.operator.with.function.call")
) {
companion object {
private fun isApplicableUnary(element: KtUnaryExpression, caretOffset: Int): Boolean {
if (element.baseExpression == null) return false
@@ -136,6 +140,7 @@ class OperatorToFunctionIntention :
val functionName = functionCandidate?.candidateDescriptor?.name.toString()
val elemType = context.getType(left)
@NonNls
val pattern = when (op) {
KtTokens.PLUS -> "$0.plus($1)"
KtTokens.MINUS -> "$0.minus($1)"
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -8,10 +8,7 @@ package org.jetbrains.kotlin.idea.project
import com.intellij.ide.util.PropertiesComponent
import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.registry.Registry
import com.intellij.util.text.nullize
import org.jetbrains.kotlin.caches.project.cacheByClassInvalidatingOnRootModifications
import org.jetbrains.kotlin.cli.common.toBooleanLenient
import org.jetbrains.kotlin.config.isHmpp
import org.jetbrains.kotlin.idea.facet.KotlinFacet
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -7,10 +7,6 @@ package org.jetbrains.kotlin.idea.project
import com.intellij.ide.util.PropertiesComponent
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.idea.util.isDev
import org.jetbrains.kotlin.idea.util.isEap
import org.jetbrains.kotlin.idea.util.isSnapshot
object NewInferenceForIDEAnalysisComponent {
private const val inferenceOptionV1 = "kotlin.use.new.inference.for.ide.analysis"
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.asJava.toLightClass
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
import org.jetbrains.kotlin.idea.caches.resolve.util.getJavaOrKotlinMemberDescriptor
@@ -316,7 +317,7 @@ abstract class OperatorReferenceSearcher<TReferenceElement : KtElement>(
// we must unwrap progress indicator because ProgressWrapper does not do anything on changing text and fraction
val progress = ProgressWrapper.unwrap(ProgressIndicatorProvider.getGlobalProgressIndicator())
progress?.pushState()
progress?.text = "Searching for implicit usages..."
progress?.text = KotlinIdeaAnalysisBundle.message("searching.for.implicit.usages")
try {
val files = runReadAction { FileTypeIndex.getFiles(KotlinFileType.INSTANCE, scope) }
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.structureView
@@ -27,6 +16,7 @@ import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.idea.KotlinDescriptorIconProvider
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.psi.KtAnonymousInitializer
import org.jetbrains.kotlin.psi.KtModifierListOwner
import org.jetbrains.kotlin.psi.KtObjectDeclaration
@@ -88,7 +78,7 @@ internal class KotlinStructureElementPresentation(
private fun getElementText(navigatablePsiElement: NavigatablePsiElement, descriptor: DeclarationDescriptor?): String? {
if (navigatablePsiElement is KtObjectDeclaration && navigatablePsiElement.isObjectLiteral()) {
return "object" + (navigatablePsiElement.getSuperTypeList()?.text?.let { " : $it" } ?: "")
return KotlinIdeaAnalysisBundle.message("object.0", (navigatablePsiElement.getSuperTypeList()?.text?.let { " : $it" } ?: ""))
}
if (descriptor != null) {
@@ -101,7 +91,7 @@ internal class KotlinStructureElementPresentation(
}
if (navigatablePsiElement is KtAnonymousInitializer) {
return "<class initializer>"
return KotlinIdeaAnalysisBundle.message("class.initializer")
}
return null
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.structureView
@@ -22,6 +11,7 @@ import com.intellij.ide.structureView.StructureViewTreeElement
import com.intellij.ide.util.treeView.smartTree.*
import com.intellij.openapi.editor.Editor
import com.intellij.util.PlatformIcons
import org.jetbrains.kotlin.idea.KotlinIdeaAnalysisBundle
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtEnumEntry
@@ -62,7 +52,7 @@ object PublicElementsFilter : Filter {
}
override fun getPresentation(): ActionPresentation {
return ActionPresentationData("Show non-public", null, PlatformIcons.PRIVATE_ICON)
return ActionPresentationData(KotlinIdeaAnalysisBundle.message("show.non.public"), null, PlatformIcons.PRIVATE_ICON)
}
override fun getName() = ID