mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
Fix simple "Constant conditions" warnings in Kotlin
GitOrigin-RevId: 0996f9afd1586efc7fd6cc25ee207e26be126a20
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4ffa83e385
commit
80f9c9f8d0
@@ -107,7 +107,7 @@ open class FileBasedStorage(file: Path,
|
||||
when {
|
||||
dataWriter == null -> {
|
||||
if (isUseVfs && virtualFile == null) {
|
||||
LOG.warn("Cannot find virtual file $virtualFile")
|
||||
LOG.warn("Cannot find virtual file")
|
||||
}
|
||||
|
||||
deleteFile(storage.file, this, virtualFile)
|
||||
|
||||
@@ -118,7 +118,7 @@ class SchemeManagerImpl<T: Scheme, MUTABLE_SCHEME : T>(
|
||||
|
||||
override fun loadBundledScheme(resourceName: String, requestor: Any?, pluginDescriptor: PluginDescriptor?) {
|
||||
try {
|
||||
val bytes: ByteArray
|
||||
val bytes: ByteArray?
|
||||
if (pluginDescriptor == null) {
|
||||
when (requestor) {
|
||||
is TempUIThemeBasedLookAndFeelInfo -> {
|
||||
|
||||
@@ -18,7 +18,7 @@ class ToggleDiffAligningModeAction : DumbAwareToggleAction() {
|
||||
&& viewer is SimpleDiffViewer
|
||||
&& !DiffUtil.isUserDataFlagSet(ALIGNED_TWO_SIDED_DIFF, viewer.request)
|
||||
if (!available) {
|
||||
e.presentation.isEnabledAndVisible = available
|
||||
e.presentation.isEnabledAndVisible = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ class JdkCommandLineSetup(private val request: TargetEnvironmentRequest) {
|
||||
}
|
||||
else {
|
||||
dynamicParameters = false
|
||||
dynamicClasspath = dynamicParameters
|
||||
dynamicClasspath = false
|
||||
}
|
||||
}
|
||||
if (!dynamicClasspath) {
|
||||
|
||||
@@ -156,9 +156,9 @@ private class MyControlPainter : Control.Painter {
|
||||
override fun getRendererOffset(control: Control, depth: Int, leaf: Boolean): Int {
|
||||
return if (depth == 1) {
|
||||
if (leaf) {
|
||||
delegate.getRendererOffset(control, 0, leaf)
|
||||
delegate.getRendererOffset(control, 0, true)
|
||||
}
|
||||
else delegate.getRendererOffset(control, 1, leaf)
|
||||
else delegate.getRendererOffset(control, 1, false)
|
||||
}
|
||||
else delegate.getRendererOffset(control, depth - 1, leaf)
|
||||
}
|
||||
@@ -166,9 +166,9 @@ private class MyControlPainter : Control.Painter {
|
||||
override fun getControlOffset(control: Control, depth: Int, leaf: Boolean): Int {
|
||||
return if (depth == 1) {
|
||||
if (leaf) {
|
||||
delegate.getControlOffset(control, 0, leaf)
|
||||
delegate.getControlOffset(control, 0, true)
|
||||
}
|
||||
else delegate.getControlOffset(control, 1, leaf)
|
||||
else delegate.getControlOffset(control, 1, false)
|
||||
}
|
||||
else delegate.getControlOffset(control, depth - 1, leaf)
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ internal class TypeDescriptor(val type: BoxableType, private val descriptor: Ite
|
||||
|
||||
if (asRawString) {
|
||||
out.append("@org.jetbrains.jsonProtocol.JsonField(")
|
||||
if (asRawString) {
|
||||
out.append("allowAnyPrimitiveValue=true")
|
||||
}
|
||||
out.append("allowAnyPrimitiveValue=true")
|
||||
out.append(")").newLine()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class RunTestsBeforeCheckinHandler(private val project: Project) : CheckinHandle
|
||||
val configurationBean = settings.myState.configuration ?: return null
|
||||
val configurationSettings = RunManager.getInstance(project).findConfigurationByTypeAndName(configurationBean.configurationId, configurationBean.name)
|
||||
if (configurationSettings == null) {
|
||||
return createCommitProblem(listOf(FailureDescription("", 0, 0, configurationSettings, configurationBean.name)))
|
||||
return createCommitProblem(listOf(FailureDescription("", 0, 0, configuration = null, configurationBean.name)))
|
||||
}
|
||||
coroutineContext.progressSink?.text(SmRunnerBundle.message("progress.text.running.tests", configurationSettings.name))
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ object LogEventSerializer {
|
||||
obj.addProperty("product", request.product)
|
||||
obj.addProperty("device", request.device)
|
||||
if (request.internal) {
|
||||
obj.addProperty("internal", request.internal)
|
||||
obj.addProperty("internal", true)
|
||||
}
|
||||
|
||||
val records = JsonArray()
|
||||
@@ -117,9 +117,9 @@ class LogEventJsonDeserializer : JsonDeserializer<LogEvent> {
|
||||
private fun transformNumbers(value: Any): Any {
|
||||
return when {
|
||||
value is Double && value % 1 == 0.0 -> value.roundToLong()
|
||||
value is List<*> -> value.map { if (it != null) transformNumbers(it) else it }
|
||||
value is List<*> -> value.map { if (it != null) transformNumbers(it) else null }
|
||||
value is Map<*, *> -> value.entries.associate { (entryKey, entryValue) ->
|
||||
val newValue = if (entryValue != null) transformNumbers(entryValue) else entryValue
|
||||
val newValue = if (entryValue != null) transformNumbers(entryValue) else null
|
||||
entryKey to newValue
|
||||
}
|
||||
else -> value
|
||||
|
||||
@@ -163,8 +163,8 @@ abstract class HoverChangesTree(project: Project, showCheckboxesBoolean: Boolean
|
||||
|
||||
companion object {
|
||||
fun Tree.getBackground(row: Int, selected: Boolean): Color {
|
||||
if (selected) return RenderingUtil.getBackground(this, selected)
|
||||
return getPathForRow(row)?.let { path -> getPathBackground(path, row) } ?: RenderingUtil.getBackground(this, selected)
|
||||
if (selected) return RenderingUtil.getBackground(this, true)
|
||||
return getPathForRow(row)?.let { path -> getPathBackground(path, row) } ?: RenderingUtil.getBackground(this, false)
|
||||
}
|
||||
|
||||
fun ChangesTree.getRowHeight(renderer: ChangesTreeCellRenderer): Int {
|
||||
|
||||
@@ -94,7 +94,7 @@ internal class FacetsSerializer(private val imlFileUrl: VirtualFileUrl, private
|
||||
if (externalStorage && FileUtil.extensionEquals(fileUrl, "iml")) {
|
||||
// Trying to catch https://ea.jetbrains.com/browser/ea_problems/239676
|
||||
logger<FacetsSerializer>().error("""Incorrect file for the serializer
|
||||
|externalStorage: $externalStorage
|
||||
|externalStorage: true
|
||||
|file path: $fileUrl
|
||||
|componentName: $componentName
|
||||
""".trimMargin())
|
||||
|
||||
@@ -91,7 +91,7 @@ class FilePredictionNextCandidatesAction : AnAction() {
|
||||
private fun calculatePresentation(project: Project, candidate: FilePredictionCandidate): FileCandidatePresentation {
|
||||
val file = findSelectedFile(candidate)
|
||||
if (file == null) {
|
||||
return FileCandidatePresentation(file, null, candidate.path, candidate)
|
||||
return FileCandidatePresentation(file = null, icon = null, candidate.path, candidate)
|
||||
}
|
||||
|
||||
val psiFile = PsiManager.getInstance(project).findFile(file)
|
||||
|
||||
@@ -27,7 +27,7 @@ object GHEServerVersionChecker {
|
||||
majorVersion < REQUIRED_VERSION_MAJOR ->
|
||||
throwUnsupportedVersion(majorVersion, minorVersion)
|
||||
|
||||
majorVersion == REQUIRED_VERSION_MAJOR ->
|
||||
else ->
|
||||
if (minorVersion < REQUIRED_VERSION_MINOR) throwUnsupportedVersion(majorVersion, minorVersion)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class GroovyScriptBuilder(indent: Int = 0) : AbstractScriptBuilder(indent) {
|
||||
add(element.value, indent, false)
|
||||
}
|
||||
element is CallElement && isNewLine && element.arguments.isNotEmpty() && !hasTrailingBlock(element.arguments) -> {
|
||||
add(element.name, indent, isNewLine)
|
||||
add(element.name, indent, isNewLine = true)
|
||||
add(" ", indent, false)
|
||||
add(element.arguments, indent)
|
||||
}
|
||||
|
||||
@@ -147,8 +147,7 @@ private fun GrReferenceElement<*>.canResolveToTypeParameter(): Boolean {
|
||||
is GrAnnotation,
|
||||
is GrImportStatement,
|
||||
is GrNewExpression,
|
||||
is GrAnonymousClassDefinition,
|
||||
is GrCodeReferenceElement -> false
|
||||
is GrAnonymousClassDefinition -> false
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,8 +681,6 @@ fun ExtractionGeneratorConfiguration.generateDeclaration(
|
||||
ShortenReferences.DEFAULT.process(declaration)
|
||||
}
|
||||
|
||||
if (generatorOptions.inTempFile) return ExtractionResult(this, declaration, emptyMap())
|
||||
|
||||
val duplicateReplacers = HashMap<KotlinPsiRange, () -> Unit>().apply {
|
||||
if (generatorOptions.delayInitialOccurrenceReplacement) {
|
||||
put(descriptor.extractionData.originalRange, replaceInitialOccurrence)
|
||||
|
||||
@@ -100,7 +100,7 @@ constructor(private val process: Process, hostname: String?, port: Int) : IPydev
|
||||
progress.checkCanceled()
|
||||
val exitValue = process.waitFor(10, TimeUnit.MILLISECONDS)
|
||||
if (exitValue) {
|
||||
result[0] = makeError(String.format("Console already exited with value: %s while waiting for an answer.\n", exitValue))
|
||||
result[0] = makeError(String.format("Console already exited with value: %s while waiting for an answer.\n", true))
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class PyTypedDictTypeProvider : PyTypeProviderBase() {
|
||||
parameters.add(PyCallableParameterImpl.nonPsi(TYPED_DICT_FIELDS_PARAMETER,
|
||||
if (dictClassType != null) PyCollectionTypeImpl(dictClassType.pyClass, false,
|
||||
listOf(builtinCache.strType, null))
|
||||
else dictClassType))
|
||||
else null))
|
||||
parameters.add(
|
||||
PyCallableParameterImpl.nonPsi(TYPED_DICT_TOTAL_PARAMETER,
|
||||
builtinCache.boolType,
|
||||
|
||||
Reference in New Issue
Block a user