diff --git a/platform/inspect/api-dump-unreviewed.txt b/platform/inspect/api-dump-unreviewed.txt index e8d965bfa0e2..c304427af7d8 100644 --- a/platform/inspect/api-dump-unreviewed.txt +++ b/platform/inspect/api-dump-unreviewed.txt @@ -97,11 +97,6 @@ com.intellij.codeInspection.InspectionToolCmdlineOptions c:com.intellij.codeInspection.InspectionToolCmdlineOptions$CmdlineArgsValidationException - java.lang.Exception - (java.lang.String):V -f:com.intellij.codeInspection.inspectionProfile.CompositeGroupProvider -- com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider -- ():V -- f:addProvider(com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider):V -- findGroup(java.lang.String):com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup f:com.intellij.codeInspection.inspectionProfile.DefaultSeverityGroupProvider - com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider - ():V @@ -133,59 +128,16 @@ com.intellij.codeInspection.inspectionProfile.YamlBaseConfig - a:getEnabled():java.lang.Boolean - a:getIgnore():java.util.List - a:getSeverity():java.lang.String -f:com.intellij.codeInspection.inspectionProfile.YamlCompositeGroupImpl -- com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup -- (java.lang.String,com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider,java.util.List):V -- getGroupId():java.lang.String -- includesInspection(com.intellij.codeInspection.ex.InspectionToolWrapper):Z com.intellij.codeInspection.inspectionProfile.YamlGroupConfig - com.intellij.codeInspection.inspectionProfile.YamlBaseConfig - a:getGroup():java.lang.String -f:com.intellij.codeInspection.inspectionProfile.YamlGroupConfigImpl -- com.intellij.codeInspection.inspectionProfile.YamlGroupConfig -- (java.lang.String,java.lang.Boolean,java.lang.String,java.util.List):V -- getEnabled():java.lang.Boolean -- getGroup():java.lang.String -- getIgnore():java.util.List -- getSeverity():java.lang.String com.intellij.codeInspection.inspectionProfile.YamlInspectionConfig - com.intellij.codeInspection.inspectionProfile.YamlBaseConfig - a:getInspection():java.lang.String - a:getOptions():java.util.Map -f:com.intellij.codeInspection.inspectionProfile.YamlInspectionConfigImpl -- com.intellij.codeInspection.inspectionProfile.YamlInspectionConfig -- (java.lang.String,java.lang.Boolean,java.lang.String,java.util.List,java.util.Map):V -- getEnabled():java.lang.Boolean -- getIgnore():java.util.List -- getInspection():java.lang.String -- getOptions():java.util.Map -- getSeverity():java.lang.String -f:com.intellij.codeInspection.inspectionProfile.YamlInspectionConfigRaw -- ():V -- (java.lang.String,java.lang.String,java.lang.Boolean,java.lang.String,java.util.List,java.util.Map):V -- b:(java.lang.String,java.lang.String,java.lang.Boolean,java.lang.String,java.util.List,java.util.Map,I,kotlin.jvm.internal.DefaultConstructorMarker):V -- f:getEnabled():java.lang.Boolean -- f:getGroup():java.lang.String -- f:getIgnore():java.util.List -- f:getInspection():java.lang.String -- f:getOptions():java.util.Map -- f:getSeverity():java.lang.String com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup - a:getGroupId():java.lang.String - a:includesInspection(com.intellij.codeInspection.ex.InspectionToolWrapper):Z -f:com.intellij.codeInspection.inspectionProfile.YamlInspectionGroupImpl -- com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup -- (java.lang.String,java.util.Set):V -- getGroupId():java.lang.String -- f:getInspections():java.util.Set -- includesInspection(com.intellij.codeInspection.ex.InspectionToolWrapper):Z -f:com.intellij.codeInspection.inspectionProfile.YamlInspectionGroupRaw -- ():V -- (java.lang.String,java.util.List,java.util.List):V -- b:(java.lang.String,java.util.List,java.util.List,I,kotlin.jvm.internal.DefaultConstructorMarker):V -- f:getGroupId():java.lang.String -- f:getGroups():java.util.List -- f:getInspections():java.util.List com.intellij.codeInspection.inspectionProfile.YamlInspectionProfile - com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider - a:getBaseProfile():com.intellij.codeInspection.ex.InspectionProfileImpl @@ -194,42 +146,6 @@ com.intellij.codeInspection.inspectionProfile.YamlInspectionProfile - a:getInspectionProfileManager():com.intellij.profile.codeInspection.BaseInspectionProfileManager - a:getInspectionToolsSupplier():com.intellij.codeInspection.ex.InspectionToolsSupplier - a:getProfileName():java.lang.String -f:com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl -- com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider -- com.intellij.codeInspection.inspectionProfile.YamlInspectionProfile -- sf:Companion:com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl$Companion -- f:buildEffectiveProfile():com.intellij.codeInspection.ex.InspectionProfileImpl -- findGroup(java.lang.String):com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup -- getBaseProfile():com.intellij.codeInspection.ex.InspectionProfileImpl -- getConfigurations():java.util.List -- getGroups():java.util.List -- getInspectionProfileManager():com.intellij.profile.codeInspection.BaseInspectionProfileManager -- getInspectionToolsSupplier():com.intellij.codeInspection.ex.InspectionToolsSupplier -- getProfileName():java.lang.String -- sf:isYamlFile(java.lang.String):Z -- sf:loadFrom(com.intellij.openapi.project.Project,java.lang.String,com.intellij.codeInspection.ex.InspectionToolsSupplier,com.intellij.profile.codeInspection.BaseInspectionProfileManager):com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl -- sf:loadFrom(java.io.Reader,kotlin.jvm.functions.Function1,com.intellij.codeInspection.ex.InspectionToolsSupplier,com.intellij.profile.codeInspection.BaseInspectionProfileManager):com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl -f:com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl$Companion -- f:isYamlFile(java.lang.String):Z -- f:loadFrom(com.intellij.openapi.project.Project,java.lang.String,com.intellij.codeInspection.ex.InspectionToolsSupplier,com.intellij.profile.codeInspection.BaseInspectionProfileManager):com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl -- f:loadFrom(java.io.Reader,kotlin.jvm.functions.Function1,com.intellij.codeInspection.ex.InspectionToolsSupplier,com.intellij.profile.codeInspection.BaseInspectionProfileManager):com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl -- bs:loadFrom$default(com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl$Companion,com.intellij.openapi.project.Project,java.lang.String,com.intellij.codeInspection.ex.InspectionToolsSupplier,com.intellij.profile.codeInspection.BaseInspectionProfileManager,I,java.lang.Object):com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileImpl -f:com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileRaw -- ():V -- (java.lang.String,java.lang.String,java.util.List,java.util.List):V -- b:(java.lang.String,java.lang.String,java.util.List,java.util.List,I,kotlin.jvm.internal.DefaultConstructorMarker):V -- f:dump():java.lang.String -- f:getBaseProfile():java.lang.String -- f:getGroups():java.util.List -- f:getInspections():java.util.List -- f:getName():java.lang.String -f:com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileRawKt -- sf:readConfig(java.io.Reader,kotlin.jvm.functions.Function1):com.intellij.codeInspection.inspectionProfile.YamlInspectionProfileRaw -f:com.intellij.codeInspection.inspectionProfile.YamlProfileUtils -- sf:INSTANCE:com.intellij.codeInspection.inspectionProfile.YamlProfileUtils -- f:createProfileCopy(com.intellij.codeInspection.ex.InspectionProfileImpl,com.intellij.codeInspection.ex.InspectionToolsSupplier,com.intellij.profile.codeInspection.BaseInspectionProfileManager):com.intellij.codeInspection.ex.InspectionProfileImpl -- f:makeYaml():org.yaml.snakeyaml.Yaml -- f:writeXmlOptions(org.jdom.Element,java.util.Map):V f:com.intellij.codeInspection.inspectionProfile.YmlInspectionProfileKt - sf:includesInspection(com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup,com.intellij.codeInspection.ex.InspectionToolWrapper):Z f:com.intellij.inspectopedia.extractor.Plugin diff --git a/platform/inspect/exposed-third-party-api.txt b/platform/inspect/exposed-third-party-api.txt index ddfb991e7023..1ff3abdfef32 100644 --- a/platform/inspect/exposed-third-party-api.txt +++ b/platform/inspect/exposed-third-party-api.txt @@ -1,2 +1 @@ kotlin/jvm/internal/DefaultConstructorMarker -org/yaml/snakeyaml/Yaml diff --git a/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileImpl.kt b/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileImpl.kt index 185940ac8ee3..e86176520ae8 100644 --- a/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileImpl.kt +++ b/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileImpl.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInspection.inspectionProfile import com.intellij.codeHighlighting.HighlightDisplayLevel @@ -18,6 +18,7 @@ import com.intellij.profile.codeInspection.ProjectInspectionProfileManager import com.intellij.psi.PsiElement import com.intellij.psi.search.scope.packageSet.* import org.jdom.Element +import org.jetbrains.annotations.ApiStatus.Internal import java.io.File import java.io.Reader import java.nio.file.FileSystems @@ -30,26 +31,35 @@ private const val SCOPE_PREFIX = "scope#" private val LOG = logger() -class YamlInspectionConfigImpl(override val inspection: String, - override val enabled: Boolean?, - override val severity: String?, - override val ignore: List, - override val options: Map) : YamlInspectionConfig +private class YamlInspectionConfigImpl( + override val inspection: String, + override val enabled: Boolean?, + override val severity: String?, + override val ignore: List, + override val options: Map, +) : YamlInspectionConfig -class YamlGroupConfigImpl(override val group: String, - override val enabled: Boolean?, - override val severity: String?, - override val ignore: List) : YamlGroupConfig +private class YamlGroupConfigImpl( + override val group: String, + override val enabled: Boolean?, + override val severity: String?, + override val ignore: List, +) : YamlGroupConfig -class YamlInspectionGroupImpl(override val groupId: String, val inspections: Set) : YamlInspectionGroup { +private class YamlInspectionGroupImpl( + override val groupId: String, + val inspections: Set +) : YamlInspectionGroup { override fun includesInspection(tool: InspectionToolWrapper<*, *>): Boolean { return tool.shortName in inspections } } -class YamlCompositeGroupImpl(override val groupId: String, - private val groupProvider: InspectionGroupProvider, - private val groupRules: List) : YamlInspectionGroup { +private class YamlCompositeGroupImpl( + override val groupId: String, + private val groupProvider: InspectionGroupProvider, + private val groupRules: List, +) : YamlInspectionGroup { override fun includesInspection(tool: InspectionToolWrapper<*, *>): Boolean { for (groupRule in groupRules.asReversed().filter { it.isNotEmpty() }) { val groupId = groupRule.removePrefix("!") @@ -61,7 +71,7 @@ class YamlCompositeGroupImpl(override val groupId: String, } } -class CompositeGroupProvider : InspectionGroupProvider { +private class CompositeGroupProvider : InspectionGroupProvider { private val providers = mutableListOf() @@ -74,6 +84,7 @@ class CompositeGroupProvider : InspectionGroupProvider { } } +@Internal class YamlInspectionProfileImpl private constructor(override val profileName: String?, override val inspectionToolsSupplier: InspectionToolsSupplier, override val inspectionProfileManager: BaseInspectionProfileManager, diff --git a/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileRaw.kt b/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileRaw.kt index 4633c142a765..3da32a4fab50 100644 --- a/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileRaw.kt +++ b/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlInspectionProfileRaw.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInspection.inspectionProfile import com.intellij.codeInspection.inspectionProfile.YamlProfileUtils.makeYaml @@ -7,7 +7,7 @@ import java.io.Reader import java.nio.file.Path import java.nio.file.Paths -class YamlInspectionProfileRaw( +internal class YamlInspectionProfileRaw( val baseProfile: String? = null, val name: String? = null, val groups: List = emptyList(), @@ -17,17 +17,15 @@ class YamlInspectionProfileRaw( val yaml = makeYaml() return yaml.dump(this) } - - } -class YamlInspectionGroupRaw( +internal class YamlInspectionGroupRaw( val groupId: String = "Unknown", val inspections: List = emptyList(), val groups: List = emptyList() ) -class YamlInspectionConfigRaw( +internal class YamlInspectionConfigRaw( val inspection: String? = null, val group: String? = null, val enabled: Boolean? = null, @@ -36,8 +34,7 @@ class YamlInspectionConfigRaw( val options: Map? = null ) - -fun readConfig(reader: Reader, includeReaders: (Path) -> Reader): YamlInspectionProfileRaw { +internal fun readConfig(reader: Reader, includeReaders: (Path) -> Reader): YamlInspectionProfileRaw { val merged = readRaw(reader, includeReaders) val yaml = makeYaml() diff --git a/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlProfileUtils.kt b/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlProfileUtils.kt index 4bf4881b71f0..42701ba3f902 100644 --- a/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlProfileUtils.kt +++ b/platform/inspect/src/com/intellij/codeInspection/inspectionProfile/YamlProfileUtils.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInspection.inspectionProfile import com.intellij.codeInspection.ex.DynamicGroupTool @@ -17,8 +17,7 @@ import org.yaml.snakeyaml.nodes.NodeTuple import org.yaml.snakeyaml.nodes.Tag import org.yaml.snakeyaml.representer.Representer - -object YamlProfileUtils { +internal object YamlProfileUtils { private fun copyFrom(source: ToolsImpl, target: ToolsImpl) { val defaultState = source.defaultState