i18n: update bundle for inspections

#KT-37483
This commit is contained in:
Dmitry Gridin
2020-03-27 21:00:52 +07:00
parent ebc255c74d
commit a19d42b81b
34 changed files with 488 additions and 465 deletions
File diff suppressed because it is too large Load Diff
+221 -1
View File
@@ -1955,4 +1955,224 @@ action.AddToProblemApiInspection.text=Report as Incompatible API
action.ShowKotlinBytecode.text=Show Kotlin Bytecode
action.ConfigureKotlinJsInProject.text=Configure Kotlin (JavaScript) in Project
action.ConfigureKotlinInProject.text=Configure Kotlin in Project
action.KotlinConsoleREPL.text=Kotlin REPL
action.KotlinConsoleREPL.text=Kotlin REPL
inspection.unused.unary.operator.display.name=Unused unary operator
inspection.replace.guard.clause.with.function.call.display.name=Replace guard clause with kotlin's function call
inspection.lateinit.var.overrides.lateinit.var.display.name=lateinit var property overrides lateinit var property
inspection.kotlin.equals.between.inconvertible.types.display.name='equals()' between objects of inconvertible types
inspection.redundant.empty.initializer.block.display.name=Redundant empty initializer block
inspection.add.operator.modifier.display.name=Function should have 'operator' modifier
inspection.control.flow.with.empty.body.display.name=Control flow with empty body
inspection.replace.java.static.method.with.kotlin.analog.display.name=Replace Java static method with Kotlin analog
inspection.self.reference.constructor.parameter.display.name=Constructor has non-null self reference parameter
inspection.replace.not.null.assertion.with.elvis.return.display.name=Replace '!!' with '?: return'
inspection.kotlin.covariant.equals.display.name=Covariant 'equals()'
inspection.replace.associate.function.display.name=Replace 'associate' with 'associateBy' or 'associateWith'
inspection.java.map.for.each.display.name=Java Map.forEach method call should be replaced with Kotlin's forEach
inspection.kotlin.throwable.not.thrown.display.name=Throwable not thrown
inspection.redundant.require.not.null.call.display.name=Redundant 'requireNotNull' or 'checkNotNull' call
inspection.replace.range.start.end.inclusive.with.first.last.display.name=Replace Range 'start' or 'endInclusive' with 'first' or 'last'
inspection.redundant.enum.constructor.invocation.display.name=Redundant enum constructor invocation
inspection.replace.negated.is.empty.with.is.not.empty.display.name=Replace negated 'isEmpty' with 'isNotEmpty'
inspection.function.with.lambda.expression.body.display.name=Function with `= { ... }` and inferred return type
inspection.suspend.function.on.coroutine.scope.display.name=Ambiguous coroutineContext due to CoroutineScope receiver of suspend function
inspection.boolean.literal.argument.display.name=Boolean literal argument without parameter name
inspection.suspicious.collection.reassignment.display.name=Augmented assignment creates a new collection under the hood
inspection.redundant.else.in.if.display.name=Redundant 'else' in 'if'
inspection.deferred.is.result.display.name=Function returning Deferred directly
inspection.map.get.with.not.null.assertion.operator.display.name=map.get() with not-null assertion operator (!!)
inspection.delegation.to.var.property.display.name=Delegating to 'var' property
inspection.unused.main.parameter.display.name=Main parameter is not necessary
inspection.suspicious.var.property.display.name=Suspicious 'var' property: its setter does not influence its getter result
inspection.setter.backing.field.assignment.display.name=Existing backing field is not assigned by the setter
inspection.unlabeled.return.inside.lambda.display.name=Unlabeled return inside lambda
inspection.optional.expectation.display.name=Optionally expected annotation has no actual annotation
inspection.remove.empty.parentheses.from.annotation.entry.display.name=Remove unnecessary parentheses
inspection.safe.cast.with.return.display.name=Safe cast with 'return' should be replaced with 'if' type check
inspection.simplifiable.call.display.name=Library function call could be simplified
inspection.redundant.run.catching.display.name=Redundant 'runCatching' call
inspection.direct.use.of.result.type.display.name=Function returning Result directly
inspection.redundant.return.label.display.name=Redundant 'return' label
inspection.replace.assert.boolean.with.assert.equality.display.name=Replace assert boolean with assert equality
inspection.suspicious.as.dynamic.display.name=Suspicious 'asDynamic' member invocation
inspection.convert.call.chain.into.sequence.display.name=Call chain on collection could be converted into 'Sequence' to improve performance
inspection.redundant.with.display.name=Redundant 'with' call
inspection.obsolete.experimental.coroutines.display.name=Experimental coroutines usages are deprecated since 1.3
inspection.warning.on.main.unused.parameter.migration.display.name=Unused `args` on `main` since 1.4
inspection.prohibit.repeated.use.site.target.annotations.migration.display.name=Repeatable annotation without `@Repeatable` are not allowed since 1.4
inspection.prohibit.use.site.target.annotations.on.super.types.migration.display.name=Annotations on superclass are meaningless since 1.4
inspection.redundant.label.migration.display.name=Redundant labels since 1.4
inspection.restrict.return.statement.target.migration.display.name=Target label does not denote a function since 1.4
inspection.prohibit.jvm.overloads.on.constructors.of.annotation.classes.migration.display.name='@JvmOverloads' annotation cannot be used on constructors of annotation classes since 1.4
inspection.prohibit.type.parameters.for.local.variables.migration.display.name=Local variables are not allowed to have type parameters since 1.4
inspection.from.closed.range.migration.display.name=MIN_VALUE step in fromClosedRange() since 1.3
inspection.replace.to.string.with.string.template.display.name=Replace 'toString' with string template
inspection.nested.lambda.shadowed.implicit.parameter.display.name=Nested lambda has shadowed implicit parameter
inspection.for.each.parameter.not.used.display.name=Iterated elements are not used in forEach
inspection.replace.string.format.with.literal.display.name=Replace with string templates
inspection.deferred.result.unused.display.name=Deferred result is never used
inspection.redundant.async.display.name=Redundant 'async' call
inspection.main.function.return.unit.display.name=Entry point function should return Unit
inspection.move.variable.declaration.into.when.display.name=Variable declaration could be moved inside `when`
inspection.move.lambda.outside.parentheses.display.name=Lambda argument inside parentheses
inspection.can.sealed.sub.class.be.object.display.name=Sealed sub-class without state and overridden equals
inspection.public.api.implicit.type.display.name=Public API declaration has implicit return type
inspection.redundant.companion.reference.display.name=Redundant Companion reference
inspection.convert.pair.constructor.to.to.function.display.name=Convert Pair constructor to 'to' function
inspection.redundant.not.null.extension.receiver.of.inline.display.name=Not-null extension receiver of inline function can be made nullable
inspection.platform.extension.receiver.of.inline.display.name=Unsafe call of inline function with nullable extension receiver
inspection.scope.function.conversion.display.name=Scope function can be converted to another one
inspection.redundant.object.type.check.display.name=Redundant type checks for object
inspection.fake.jvm.field.constant.display.name=Kotlin non-const property used as Java constant
inspection.may.be.constant.display.name=Might be 'const'
inspection.sort.modifiers.display.name=Non-canonical modifier order
inspection.redundant.suspend.modifier.display.name=Redundant 'suspend' modifier
inspection.replace.put.with.assignment.display.name=map.put() can be converted to assignment
inspection.replace.to.with.infix.form.display.name=Replace to with infix form
inspection.recursive.equals.call.display.name=Recursive equals call
inspection.java.collections.static.method.on.immutable.list.display.name=Call of Java mutator method on immutable Kotlin collection
inspection.java.collections.static.method.display.name=Java Collections static method call can be replaced with Kotlin stdlib
inspection.simplify.when.with.boolean.constant.condition.display.name=Simplifiable 'when'
inspection.implicit.nullable.nothing.type.display.name=Implicit `Nothing?` type
inspection.self.assignment.display.name=Assignment of variable to itself
inspection.redundant.unit.expression.display.name=Redundant 'Unit'
inspection.implicit.this.display.name=Implicit 'this'
inspection.explicit.this.display.name=Redundant explicit 'this'
inspection.migrate.diagnostic.suppression.display.name=Diagnostic name should be replaced
inspection.redundant.setter.display.name=Redundant property setter
inspection.remove.redundant.qualifier.name.display.name=Remove redundant qualifier name
inspection.remove.redundant.backticks.display.name=Remove redundant backticks
inspection.redundant.getter.display.name=Redundant property getter
inspection.suspicious.equals.combination.display.name=Suspicious combination of == and ===
inspection.kotlin.redundant.override.display.name=Redundant overriding method
inspection.package.name.display.name=Package naming convention
inspection.local.variable.name.display.name=Local variable naming convention
inspection.const.property.name.display.name=Const property naming convention
inspection.private.property.name.display.name=Private property naming convention
inspection.object.property.name.display.name=Object property naming convention
inspection.property.name.display.name=Property naming convention
inspection.test.function.name.display.name=Test function naming convention
inspection.function.name.display.name=Function naming convention
inspection.enum.entry.name.display.name=Enum entry naming convention
inspection.class.name.display.name=Class naming convention
inspection.redundant.lambda.arrow.display.name=Redundant lambda arrow
inspection.when.with.only.else.display.name='when' has only 'else' branch and can be simplified
inspection.kotlin.double.negation.display.name=Redundant double negation
inspection.unnecessary.variable.display.name=Unnecessary local variable
inspection.constant.condition.if.display.name=Condition of 'if' expression is constant
inspection.null.checks.to.safe.call.display.name=Null-checks replaceable with safe-calls
inspection.cascade.if.display.name=Cascade if can be replaced with when
inspection.lift.return.or.assignment.display.name=Return or assignment can be lifted out
inspection.use.expression.body.display.name=Expression body syntax is preferable here
inspection.simplifiable.call.chain.display.name=Call chain on collection type can be simplified
inspection.useless.call.on.collection.display.name=Useless call on collection type
inspection.redundant.explicit.type.display.name=Explicitly given type is redundant here
inspection.useless.call.on.not.null.display.name=Useless call on not-null type
inspection.remove.redundant.spread.operator.display.name=Redundant spread operator
inspection.empty.range.display.name=Range with start greater than endInclusive is empty
inspection.wrap.unary.operator.display.name=Ambiguous unary operator use with number constant
inspection.nullable.boolean.elvis.display.name=Equality check can be used instead of elvis for nullable boolean check
inspection.member.visibility.can.be.private.display.name=Class member can have 'private' visibility
inspection.replace.range.to.with.until.display.name='rangeTo' or the '..' call can be replaced with 'until'
inspection.recursive.property.accessor.display.name=Recursive property accessor
inspection.replace.array.of.with.literal.display.name='arrayOf' call can be replaced with array literal [...]
inspection.copy.without.named.arguments.display.name='copy' method of data class is called without named arguments
inspection.move.suspicious.callable.reference.into.parentheses.display.name=Suspicious callable reference used as lambda result
inspection.kotlin.internal.in.java.display.name=Usage of Kotlin internal declarations from Java
inspection.unused.lambda.expression.body.display.name=Unused return value of a function with lambda expression body
inspection.destructuring.wrong.name.display.name=Variable in destructuring declaration uses name of a wrong data class property
inspection.data.class.private.constructor.display.name=Private data class constructor is exposed via the 'copy' method
inspection.replace.with.enum.map.display.name=Replace with EnumMap
inspection.unused.equals.display.name=Unused equals expression
inspection.convert.na.n.equality.display.name=Convert equality check with 'NaN' to 'isNaN' call
inspection.convert.two.comparisons.to.range.check.display.name=Two comparisons should be converted to a range check
inspection.convert.try.finally.to.use.call.display.name=Convert try / finally to use() call
inspection.join.declaration.and.assignment.display.name=Join declaration and assignment
inspection.remove.empty.secondary.constructor.body.display.name=Remove empty constructor body
inspection.remove.empty.primary.constructor.display.name=Remove empty primary constructor
inspection.remove.redundant.calls.of.conversion.methods.display.name=Remove redundant calls of conversion methods
inspection.remove.empty.class.body.display.name=Replace empty class body
inspection.replace.size.zero.check.with.is.empty.display.name=Replace size zero check with 'isEmpty()'
inspection.replace.size.check.with.is.not.empty.display.name=Replace size check with 'isNotEmpty()'
inspection.convert.secondary.constructor.to.primary.display.name=Convert to primary constructor
inspection.complex.redundant.let.display.name=Redundant argument-based `let` call
inspection.simple.redundant.let.display.name=Redundant receiver-based `let` call
inspection.replace.array.equality.op.with.arrays.equals.display.name=Replace '==' with 'Arrays.equals'
inspection.remove.empty.parentheses.from.lambda.call.display.name=Remove unnecessary parentheses from function call with lambda
inspection.remove.to.string.in.string.template.display.name=Remove redundant call to 'toString()' in string template
inspection.remove.single.expression.string.template.display.name=Remove redundant string template
inspection.replace.call.with.binary.operator.display.name=Can be replaced with binary operator
inspection.remove.setter.parameter.type.display.name=Redundant setter parameter type
inspection.convert.reference.to.lambda.display.name=Can be replaced with lambda
inspection.convert.lambda.to.reference.display.name=Can be replaced with function reference
inspection.can.be.primary.constructor.property.display.name=Property is explicitly assigned to constructor parameter
inspection.has.platform.type.display.name=Function or property has platform type
inspection.leaking.this.display.name=Leaking 'this' in constructor
inspection.redundant.if.display.name=Redundant 'if' statement
inspection.redundant.unit.return.type.display.name=Redundant 'Unit' return type
inspection.redundant.semicolon.display.name=Redundant semicolon
inspection.redundant.modality.modifier.display.name=Redundant modality modifier
inspection.can.be.parameter.display.name=Constructor parameter is never used as a property
inspection.replace.substring.with.substring.before.display.name=Replace 'substring' call with 'substringBefore' call
inspection.replace.substring.with.substring.after.display.name=Replace 'substring' call with 'substringAfter' call
inspection.replace.substring.with.indexing.operation.display.name=Replace 'substring' call with indexing operation call
inspection.replace.substring.with.take.display.name=Replace 'substring' call with 'take' call
inspection.replace.substring.with.drop.last.display.name=Replace 'substring' call with 'dropLast' call
inspection.add.variance.modifier.display.name=Type parameter can have 'in' or 'out' variance
inspection.protected.in.final.display.name='protected' visibility is effectively 'private' in a final class
inspection.array.in.data.class.display.name=Array property in data class
inspection.can.be.val.display.name=Local 'var' is never modified and can be declared as 'val'
inspection.destructure.display.name=Use destructuring declaration
inspection.redundant.visibility.modifier.display.name=Redundant visibility modifier
inspection.equals.or.hash.code.display.name=equals() and hashCode() not paired
inspection.conflicting.extension.property.display.name=Extension property conflicting with synthetic one
inspection.use.with.index.display.name=Manually incremented index variable can be replaced with use of 'withIndex()'
inspection.loop.to.call.chain.display.name=Loop can be replaced with stdlib operations
inspection.remove.for.loop.indices.display.name=Unused loop index
inspection.kotlin.deprecation.display.name=Usage of redundant or deprecated syntax or deprecated symbols
inspection.package.directory.mismatch.display.name=Package name does not match containing directory
inspection.k.doc.missing.documentation.display.name=Missing KDoc comments for public declarations
inspection.k.doc.unresolved.reference.display.name=Unresolved reference in KDoc
inspection.overriding.deprecated.member.display.name=Overriding deprecated member
inspection.unsafe.cast.from.dynamic.display.name=Implicit (unsafe) cast from dynamic type
inspection.redundant.sam.constructor.display.name=Redundant SAM constructor
inspection.kotlin.unused.import.display.name=Unused import directive
inspection.unused.receiver.parameter.display.name=Unused receiver parameter
inspection.unused.symbol.display.name=Unused symbol
inspection.use.property.access.syntax.display.name=Accessor call that can be replaced with property access syntax
inspection.simplify.boolean.with.constants.display.name=Boolean expression that can be simplified
inspection.remove.curly.braces.from.template.display.name=Redundant curly braces in string template
inspection.introduce.when.subject.display.name='when' that can be simplified by introducing an argument
inspection.replace.with.operator.assignment.display.name=Assignment that can be replaced with operator assignment
inspection.simplify.negated.binary.expression.display.name=Negated boolean expression that can be simplified
inspection.remove.explicit.super.qualifier.display.name=Unnecessary supertype qualification
inspection.remove.explicit.type.arguments.display.name=Unnecessary type argument
inspection.fold.initializer.and.if.to.elvis.display.name=If-Null return/break/... foldable to '?:'
inspection.if.then.to.safe.access.display.name=If-Then foldable to '?.'
inspection.if.then.to.elvis.display.name=If-Then foldable to '?:'
inspection.replace.manual.range.with.indices.calls.display.name=Convert manual ranges to indices or iteration over collection
inspection.replace.get.or.set.display.name=Explicit 'get' or 'set' call
inspection.convert.to.string.template.display.name=String concatenation that can be converted to string template
inspection.deprecated.callable.add.replace.with.display.name=@Deprecated annotation without 'replaceWith' argument
inspection.replace.collection.count.with.size.display.name=Collection count can be converted to size
inspection.reformat.display.name=File is not formatted according to project settings
inspection.simplify.assert.not.null.display.name=assert call can be replaced with !! or ?:'
inspection.object.literal.to.lambda.display.name=Object literal can be converted to lambda
remove.redundant.elvis.return.null.text=Remove redundant '?: return null'
inspection.redundant.elvis.return.null.descriptor=Redundant '?: return null'
inspection.redundant.elvis.return.null.display.name=Redundant '?: return null'
inspection.redundant.inner.class.modifier.descriptor=Redundant 'inner' modifier
inspection.redundant.inner.class.modifier.display.name=Redundant 'inner' modifier
fix.remove.annotation.text=Remove annotation
inspection.trailing.comma.display.name=Trailing comma recommendations
inspection.trailing.comma.report.also.a.missing.comma=Report also a missing comma
inspection.trailing.comma.add.line.break=Add line break
inspection.trailing.comma.missing.line.break=Missing line break
inspection.trailing.comma.remove.trailing.comma=Remove trailing comma
inspection.trailing.comma.useless.trailing.comma=Useless trailing comma
inspection.trailing.comma.add.trailing.comma=Add trailing comma
inspection.trailing.comma.missing.trailing.comma=Missing trailing comma
inspection.trailing.comma.fix.comma.position=Fix comma position
inspection.trailing.comma.comma.loses.the.advantages.in.this.position=Comma loses the advantages in this position
inspection.redundant.label.text=Redundant label
@@ -21,7 +21,7 @@ class AddOperatorModifierInspection : AbstractApplicabilityBasedInspection<KtNam
override fun inspectionText(element: KtNamedFunction) = KotlinBundle.message("function.should.have.operator.modifier")
override val defaultFixText = KotlinBundle.message("add.operator.modifier")
override val defaultFixText get() = KotlinBundle.message("add.operator.modifier")
override fun isApplicable(element: KtNamedFunction): Boolean {
if (element.nameIdentifier == null || element.hasModifier(KtTokens.OPERATOR_KEYWORD)) return false
@@ -26,7 +26,7 @@ class ConvertTwoComparisonsToRangeCheckInspection :
AbstractApplicabilityBasedInspection<KtBinaryExpression>(KtBinaryExpression::class.java) {
override fun inspectionText(element: KtBinaryExpression) = KotlinBundle.message("two.comparisons.should.be.converted.to.a.range.check")
override val defaultFixText = KotlinBundle.message("convert.to.a.range.check")
override val defaultFixText get() = KotlinBundle.message("convert.to.a.range.check")
override fun isApplicable(element: KtBinaryExpression) = generateRangeExpressionData(element) != null
@@ -44,7 +44,7 @@ class DeprecatedCallableAddReplaceWithInspection : AbstractApplicabilityBasedIns
it.shortName == DEPRECATED_NAME
}.textRangeIn(element)
override val defaultFixText = KotlinBundle.message("add.replacewith.argument.to.specify.replacement.pattern")
override val defaultFixText get() = KotlinBundle.message("add.replacewith.argument.to.specify.replacement.pattern")
private class ReplaceWith(val expression: String, vararg val imports: String)
@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
class FoldInitializerAndIfToElvisInspection : AbstractApplicabilityBasedInspection<KtIfExpression>(KtIfExpression::class.java) {
override fun inspectionText(element: KtIfExpression): String = KotlinBundle.message("if.null.return.break.foldable.to")
override val defaultFixText: String = KotlinBundle.message("replace.if.with.elvis.operator")
override val defaultFixText: String get() = KotlinBundle.message("replace.if.with.elvis.operator")
override fun inspectionHighlightRangeInElement(element: KtIfExpression) = element.fromIfKeywordToRightParenthesisTextRangeInThis()
@@ -47,7 +47,7 @@ class JavaMapForEachInspection : AbstractApplicabilityBasedInspection<KtDotQuali
override fun inspectionText(element: KtDotQualifiedExpression) =
KotlinBundle.message("java.map.foreach.method.call.should.be.replaced.with.kotlin.s.foreach")
override val defaultFixText = KotlinBundle.message("replace.with.kotlin.s.foreach")
override val defaultFixText get() = KotlinBundle.message("replace.with.kotlin.s.foreach")
override fun applyTo(element: KtDotQualifiedExpression, project: Project, editor: Editor?) {
val call = element.callExpression ?: return
@@ -47,5 +47,5 @@ class MoveLambdaOutsideParenthesesInspection : AbstractApplicabilityBasedInspect
?.getStrictParentOfType<KtValueArgument>()?.asElement()
?.textRangeIn(element)
override val defaultFixText = KotlinBundle.message("move.lambda.argument.out.of.parentheses")
override val defaultFixText get() = KotlinBundle.message("move.lambda.argument.out.of.parentheses")
}
@@ -12,6 +12,7 @@ import com.intellij.codeInspection.ProblemsHolder
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElementVisitor
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
@@ -33,7 +34,7 @@ class RedundantElvisReturnNullInspection : AbstractKotlinInspection() {
holder.registerProblem(
binaryExpression,
"Redundant '?: return null'",
KotlinBundle.message("inspection.redundant.elvis.return.null.descriptor"),
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
TextRange(binaryExpression.operationReference.startOffset, right.endOffset).shiftLeft(binaryExpression.startOffset),
RemoveRedundantElvisReturnNull()
@@ -44,7 +45,7 @@ class RedundantElvisReturnNullInspection : AbstractKotlinInspection() {
private fun KtExpression.deparenthesize() = KtPsiUtil.deparenthesize(this)
private class RemoveRedundantElvisReturnNull : LocalQuickFix {
override fun getName() = "Remove redundant '?: return null'"
override fun getName() = KotlinBundle.message("remove.redundant.elvis.return.null.text")
override fun getFamilyName() = name
@@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemsHolder
import com.intellij.psi.PsiClass
import com.intellij.psi.util.parentsOfType
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
import org.jetbrains.kotlin.idea.caches.resolve.util.getJavaClassDescriptor
@@ -34,7 +35,7 @@ class RedundantInnerClassModifierInspection : AbstractKotlinInspection() {
if (targetClass.hasOuterClassMemberReference(outerClasses)) return
holder.registerProblem(
innerModifier,
"Redundant 'inner' modifier",
KotlinBundle.message("inspection.redundant.inner.class.modifier.descriptor"),
ProblemHighlightType.LIKE_UNUSED_SYMBOL,
IntentionWrapper(
RemoveModifierFix(targetClass, KtTokens.INNER_KEYWORD, isRedundant = true),
@@ -33,7 +33,7 @@ abstract class RedundantLetInspection : AbstractApplicabilityBasedInspection<KtC
final override fun inspectionHighlightRangeInElement(element: KtCallExpression) = element.calleeExpression?.textRangeIn(element)
final override val defaultFixText = KotlinBundle.message("remove.let.call")
final override val defaultFixText get() = KotlinBundle.message("remove.let.call")
final override fun isApplicable(element: KtCallExpression): Boolean {
if (!element.isLetMethodCall()) return false
@@ -35,7 +35,7 @@ class RemoveAnnotationFix(private val text: String, annotationEntry: KtAnnotatio
companion object : KotlinSingleIntentionActionFactory() {
override fun createAction(diagnostic: Diagnostic): RemoveAnnotationFix? {
val annotationEntry = diagnostic.psiElement as? KtAnnotationEntry ?: return null
return RemoveAnnotationFix("Remove annotation", annotationEntry = annotationEntry)
return RemoveAnnotationFix(KotlinBundle.message("fix.remove.annotation.text"), annotationEntry = annotationEntry)
}
}
}
@@ -24,7 +24,7 @@ class RemoveCurlyBracesFromTemplateInspection(@JvmField var reportWithoutWhitesp
if (reportWithoutWhitespace || element.hasWhitespaceAround()) ProblemHighlightType.GENERIC_ERROR_OR_WARNING
else ProblemHighlightType.INFORMATION
override val defaultFixText: String = KotlinBundle.message("remove.curly.braces")
override val defaultFixText: String get() = KotlinBundle.message("remove.curly.braces")
override fun isApplicable(element: KtBlockStringTemplateEntry): Boolean = element.canDropBraces()
@@ -58,8 +58,7 @@ class ReplaceArrayEqualityOpWithArraysEqualsInspection : AbstractApplicabilityBa
override fun inspectionText(element: KtBinaryExpression) = KotlinBundle.message("dangerous.array.comparison")
override val defaultFixText: String
get() = KotlinBundle.message("replace.with.contentequals3")
override val defaultFixText: String get() = KotlinBundle.message("replace.with.contentequals3")
override fun fixText(element: KtBinaryExpression): String = when (element.operationToken) {
KtTokens.EQEQ -> KotlinBundle.message("replace.with.contentequals2")
@@ -28,7 +28,7 @@ class ReplaceAssertBooleanWithAssertEqualityInspection : AbstractApplicabilityBa
) {
override fun inspectionText(element: KtCallExpression) = KotlinBundle.message("replace.assert.boolean.with.assert.equality")
override val defaultFixText = KotlinBundle.message("replace.assert.boolean.with.assert.equality")
override val defaultFixText get() = KotlinBundle.message("replace.assert.boolean.with.assert.equality")
override fun fixText(element: KtCallExpression): String {
val assertion = element.replaceableAssertion() ?: return defaultFixText
@@ -45,7 +45,7 @@ class ReplaceGuardClauseWithFunctionCallInspection : AbstractApplicabilityBasedI
override fun inspectionText(element: KtIfExpression) = KotlinBundle.message("replace.guard.clause.with.kotlin.s.function.call")
override val defaultFixText = KotlinBundle.message("replace.with.kotlin.s.function.call")
override val defaultFixText get() = KotlinBundle.message("replace.with.kotlin.s.function.call")
override fun fixText(element: KtIfExpression) =
element.getKotlinFunction()?.let { KotlinBundle.message("replace.with.0.call", it.functionName) } ?: defaultFixText
@@ -86,7 +86,7 @@ class ReplacePutWithAssignmentInspection : AbstractApplicabilityBasedInspection<
override fun inspectionText(element: KtDotQualifiedExpression): String =
KotlinBundle.message("map.put.should.be.converted.to.assignment")
override val defaultFixText = KotlinBundle.message("convert.put.to.assignment")
override val defaultFixText get() = KotlinBundle.message("convert.put.to.assignment")
companion object {
private val compatibleNames = setOf("put")
@@ -33,5 +33,5 @@ class ReplaceToStringWithStringTemplateInspection : AbstractApplicabilityBasedIn
"call.of.tostring.could.be.replaced.with.string.template"
)
override val defaultFixText = KotlinBundle.message("replace.tostring.with.string.template")
override val defaultFixText get() = KotlinBundle.message("replace.tostring.with.string.template")
}
@@ -58,7 +58,7 @@ class ReplaceWithOperatorAssignmentInspection : AbstractApplicabilityBasedInspec
override fun inspectionText(element: KtBinaryExpression) = KotlinBundle.message("replaceable.with.operator.assignment")
override val defaultFixText = KotlinBundle.message("replace.with.operator.assignment")
override val defaultFixText get() = KotlinBundle.message("replace.with.operator.assignment")
override fun fixText(element: KtBinaryExpression) =
KotlinBundle.message(
@@ -64,14 +64,12 @@ class SimplifyAssertNotNullInspection : AbstractApplicabilityBasedInspection<KtC
override fun inspectionText(element: KtCallExpression) = KotlinBundle.message("assert.should.be.replaced.with.operator")
override val defaultFixText: String = KotlinBundle.message("replace.assert.with.operator")
override val defaultFixText: String get() = KotlinBundle.message("replace.assert.with.operator")
override fun fixText(element: KtCallExpression): String {
return if (element.valueArguments.size == 1) {
KotlinBundle.message("replace.with.0.operator", "!!")
} else {
KotlinBundle.message("replace.with.error")
}
override fun fixText(element: KtCallExpression): String = if (element.valueArguments.size == 1) {
KotlinBundle.message("replace.with.0.operator", "!!")
} else {
KotlinBundle.message("replace.with.error")
}
override fun applyTo(element: KtCallExpression, project: Project, editor: Editor?) {
@@ -31,7 +31,7 @@ class SimplifyNegatedBinaryExpressionInspection : AbstractApplicabilityBasedInsp
override fun inspectionText(element: KtPrefixExpression) = KotlinBundle.message("negated.operation.should.be.simplified")
override val defaultFixText = KotlinBundle.message("simplify.negated.operation")
override val defaultFixText get() = KotlinBundle.message("simplify.negated.operation")
override fun fixText(element: KtPrefixExpression): String {
val expression = KtPsiUtil.deparenthesize(element.baseExpression) as? KtOperationExpression ?: return defaultFixText
@@ -42,7 +42,7 @@ class SortModifiersInspection : AbstractApplicabilityBasedInspection<KtModifierL
override fun inspectionText(element: KtModifierList) =
if (element.modifiersBeforeAnnotations()) KotlinBundle.message("modifiers.should.follow.annotations") else KotlinBundle.message("non.canonical.modifiers.order")
override val defaultFixText = KotlinBundle.message("sort.modifiers")
override val defaultFixText get() = KotlinBundle.message("sort.modifiers")
override fun applyTo(element: KtModifierList, project: Project, editor: Editor?) {
val owner = element.parent as? KtModifierListOwner ?: return
@@ -17,6 +17,7 @@ import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiElementVisitor
import com.intellij.psi.codeStyle.CodeStyleManager
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.formatter.*
import org.jetbrains.kotlin.idea.util.isLineBreak
import org.jetbrains.kotlin.psi.KtElement
@@ -67,7 +68,10 @@ class TrailingCommaInspection(
private fun checkCommaPosition(commaOwner: KtElement) {
for (invalidComma in TrailingCommaHelper.findInvalidCommas(commaOwner)) {
reportProblem(invalidComma, "Comma loses the advantages in this position", "Fix comma position")
reportProblem(invalidComma,
KotlinBundle.message("inspection.trailing.comma.comma.loses.the.advantages.in.this.position"),
KotlinBundle.message("inspection.trailing.comma.fix.comma.position")
)
}
}
@@ -77,8 +81,8 @@ class TrailingCommaInspection(
if (!TrailingCommaHelper.trailingCommaAllowedInModule(commaOwner) || trailingCommaOrLastElement.isComma) return
reportProblem(
trailingCommaOrLastElement,
"Missing trailing comma",
"Add trailing comma",
KotlinBundle.message("inspection.trailing.comma.missing.trailing.comma"),
KotlinBundle.message("inspection.trailing.comma.add.trailing.comma"),
if (addCommaWarning || ApplicationManager.getApplication().isUnitTestMode)
ProblemHighlightType.GENERIC_ERROR_OR_WARNING
else
@@ -86,7 +90,10 @@ class TrailingCommaInspection(
)
} else if (action == TrailingCommaAction.REMOVE) {
if (!trailingCommaOrLastElement.isComma) return
reportProblem(trailingCommaOrLastElement, "Useless trailing comma", "Remove trailing comma")
reportProblem(trailingCommaOrLastElement,
KotlinBundle.message("inspection.trailing.comma.useless.trailing.comma"),
KotlinBundle.message("inspection.trailing.comma.remove.trailing.comma")
)
}
}
@@ -116,10 +123,10 @@ class TrailingCommaInspection(
val problemElement = commaOwner.parent
holder.registerProblem(
problemElement,
"Missing line break",
KotlinBundle.message("inspection.trailing.comma.missing.line.break"),
highlightType,
TextRange.from(elementForTextRange.startOffset, 1).shiftLeft(problemElement.startOffset),
createQuickFix("Add line break", commaOwner),
createQuickFix(KotlinBundle.message("inspection.trailing.comma.add.line.break"), commaOwner),
)
}
@@ -161,7 +168,7 @@ class TrailingCommaInspection(
override fun createOptionsPanel(): JComponent? {
val panel = MultipleCheckboxOptionsPanel(this)
panel.addCheckbox("Report also a missing comma", "addCommaWarning")
panel.addCheckbox(KotlinBundle.message("inspection.trailing.comma.report.also.a.missing.comma"), "addCommaWarning")
return panel
}
}
@@ -51,7 +51,7 @@ class UnnecessaryVariableInspection : AbstractApplicabilityBasedInspection<KtPro
else -> ""
}
override val defaultFixText = KotlinBundle.message("inline.variable")
override val defaultFixText get() = KotlinBundle.message("inline.variable")
override val startFixInWriteAction = false
@@ -30,7 +30,7 @@ class IfThenToElvisInspection(
) : AbstractApplicabilityBasedInspection<KtIfExpression>(KtIfExpression::class.java) {
override fun inspectionText(element: KtIfExpression): String = KotlinBundle.message("if.then.foldable.to")
override val defaultFixText: String = INTENTION_TEXT
override val defaultFixText: String get() = INTENTION_TEXT
override fun isApplicable(element: KtIfExpression): Boolean = isApplicableTo(element, expressionShouldBeStable = true)
@@ -35,7 +35,7 @@ class IfThenToSafeAccessInspection : AbstractApplicabilityBasedInspection<KtIfEx
override fun inspectionHighlightType(element: KtIfExpression): ProblemHighlightType =
if (element.shouldBeTransformed()) ProblemHighlightType.GENERIC_ERROR_OR_WARNING else ProblemHighlightType.INFORMATION
override val defaultFixText = KotlinBundle.message("simplify.foldable.if.then")
override val defaultFixText get() = KotlinBundle.message("simplify.foldable.if.then")
override fun fixText(element: KtIfExpression): String = fixTextFor(element)
@@ -33,7 +33,7 @@ class IntroduceWhenSubjectInspection : AbstractApplicabilityBasedInspection<KtWh
override fun inspectionText(element: KtWhenExpression) = KotlinBundle.message("when.with.subject.should.be.used")
override val defaultFixText = KotlinBundle.message("introduce.when.subject")
override val defaultFixText get() = KotlinBundle.message("introduce.when.subject")
override fun fixText(element: KtWhenExpression): String {
val subject = element.getSubjectToIntroduce() ?: return ""
@@ -107,8 +107,7 @@ class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspec
override fun inspectionText(element: KtDotQualifiedExpression) = KotlinBundle.message("call.replaceable.with.binary.operator")
override val defaultFixText: String
get() = KotlinBundle.message("replace.with.binary.operator")
override val defaultFixText: String get() = KotlinBundle.message("replace.with.binary.operator")
override fun fixText(element: KtDotQualifiedExpression): String {
val calleeExpression = element.callExpression?.calleeExpression as? KtSimpleNameExpression ?: return defaultFixText
@@ -117,7 +116,7 @@ class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspec
}
val operation = operation(calleeExpression) ?: return defaultFixText
return "${KotlinBundle.message("replace.with.0", operation.value)}"
return KotlinBundle.message("replace.with.0", operation.value)
}
override fun applyTo(element: KtDotQualifiedExpression, project: Project, editor: Editor?) {
@@ -72,8 +72,7 @@ class ReplaceGetOrSetInspection : AbstractApplicabilityBasedInspection<KtDotQual
ProblemHighlightType.INFORMATION
}
override val defaultFixText: String
get() = KotlinBundle.message("replace.get.or.set.call.with.indexing.operator")
override val defaultFixText: String get() = KotlinBundle.message("replace.get.or.set.call.with.indexing.operator")
override fun fixText(element: KtDotQualifiedExpression): String {
val callExpression = element.callExpression ?: return defaultFixText
@@ -9,6 +9,7 @@ import com.intellij.codeInspection.CleanupLocalInspectionTool
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.diagnostics.DiagnosticFactoryWithPsiElement
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.configuration.MigrationInfo
import org.jetbrains.kotlin.idea.configuration.isLanguageVersionUpdate
import org.jetbrains.kotlin.idea.quickfix.migration.MigrationFix
@@ -23,7 +24,7 @@ class RedundantLabelMigrationInspection :
return migrationInfo.isLanguageVersionUpdate(LanguageVersion.KOTLIN_1_3, LanguageVersion.KOTLIN_1_4)
}
override fun descriptionMessage(): String = "Redundant label"
override fun descriptionMessage(): String = KotlinBundle.message("inspection.redundant.label.text")
override val diagnosticFactory: DiagnosticFactoryWithPsiElement<KtElement, *>
get() = Errors.REDUNDANT_LABEL_WARNING
@@ -20,7 +20,7 @@ class ReplaceSubstringWithDropLastInspection : ReplaceSubstringInspection() {
override fun inspectionText(element: KtDotQualifiedExpression): String =
KotlinBundle.message("replace.substring.call.with.droplast.call")
override val defaultFixText: String = KotlinBundle.message("replace.substring.call.with.droplast.call")
override val defaultFixText: String get() = KotlinBundle.message("replace.substring.call.with.droplast.call")
override fun applyTo(element: KtDotQualifiedExpression, project: Project, editor: Editor?) {
val argument = element.callExpression?.valueArguments?.elementAtOrNull(1)?.getArgumentExpression() ?: return
@@ -18,7 +18,8 @@ import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluat
class ReplaceSubstringWithIndexingOperationInspection : ReplaceSubstringInspection() {
override fun inspectionText(element: KtDotQualifiedExpression): String =
KotlinBundle.message("replace.substring.call.with.indexing.operation.call")
override val defaultFixText: String = KotlinBundle.message("replace.substring.call.with.indexing.operation.call")
override val defaultFixText: String get() = KotlinBundle.message("replace.substring.call.with.indexing.operation.call")
override val isAlwaysStable: Boolean = true
override fun applyTo(element: KtDotQualifiedExpression, project: Project, editor: Editor?) {
@@ -16,7 +16,7 @@ class ReplaceSubstringWithSubstringAfterInspection : ReplaceSubstringInspection(
override fun inspectionText(element: KtDotQualifiedExpression): String =
KotlinBundle.message("replace.substring.call.with.substringafter.call")
override val defaultFixText: String = KotlinBundle.message("replace.substring.call.with.substringafter.call")
override val defaultFixText: String get() = KotlinBundle.message("replace.substring.call.with.substringafter.call")
override fun applyTo(element: KtDotQualifiedExpression, project: Project, editor: Editor?) {
element.replaceWith(
@@ -35,7 +35,7 @@ class ReplaceSubstringWithSubstringBeforeInspection : ReplaceSubstringInspection
override fun inspectionText(element: KtDotQualifiedExpression): String =
KotlinBundle.message("replace.substring.call.with.substringbefore.call")
override val defaultFixText: String = KotlinBundle.message("replace.substring.call.with.substringbefore.call")
override val defaultFixText: String get() = KotlinBundle.message("replace.substring.call.with.substringbefore.call")
override fun applyTo(element: KtDotQualifiedExpression, project: Project, editor: Editor?) {
element.replaceWith(
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
class ReplaceSubstringWithTakeInspection : ReplaceSubstringInspection() {
override fun inspectionText(element: KtDotQualifiedExpression): String = KotlinBundle.message("replace.substring.call.with.take.call")
override val defaultFixText: String = KotlinBundle.message("replace.substring.call.with.take.call")
override val defaultFixText: String get() = KotlinBundle.message("replace.substring.call.with.take.call")
override fun applyTo(element: KtDotQualifiedExpression, project: Project, editor: Editor?) {
val argument = element.callExpression?.valueArguments?.elementAtOrNull(1)?.getArgumentExpression() ?: return