IJPL-797 intellij.platform.inspect hide internal API

GitOrigin-RevId: f2323e0884e63ed3b6944820fc34e238538ed276
This commit is contained in:
Max Medvedev
2024-09-04 13:33:24 +02:00
committed by intellij-monorepo-bot
parent 685ea95a08
commit 8957a051b3
19 changed files with 60 additions and 111 deletions

View File

@@ -65,25 +65,17 @@ c:com.intellij.codeInspection.InspectionApplicationBase
- setVerboseLevel(I):V
- setupSecondAnalysisHandler(com.intellij.openapi.project.Project,com.intellij.codeInspection.ex.GlobalInspectionContextEx):V
- startup():V
c:com.intellij.codeInspection.InspectionApplicationException
f:com.intellij.codeInspection.InspectionApplicationException
- java.lang.RuntimeException
- <init>(java.lang.String):V
f:com.intellij.codeInspection.InspectionDiff
- <init>():V
- s:main(java.lang.String[]):V
f:com.intellij.codeInspection.InspectionMain
- com.intellij.openapi.application.ApplicationStarter
- <init>():V
- premain(java.util.List):V
- start(java.util.List,kotlin.coroutines.Continuation):java.lang.Object
com.intellij.codeInspection.InspectionProfileLoader
- a:loadProfileByName(java.lang.String):com.intellij.codeInspection.ex.InspectionProfileImpl
- a:loadProfileByPath(java.lang.String):com.intellij.codeInspection.ex.InspectionProfileImpl
- tryLoadProfileByNameOrPath(java.lang.String,java.lang.String,java.lang.String,java.util.function.Consumer):com.intellij.codeInspection.ex.InspectionProfileImpl
a:com.intellij.codeInspection.InspectionProfileLoaderBase
- com.intellij.codeInspection.InspectionProfileLoader
- p:project:com.intellij.openapi.project.Project
- <init>(com.intellij.openapi.project.Project):V
- p:getProject():com.intellij.openapi.project.Project
- p:tryLoadProfileFromYaml(java.lang.String,com.intellij.codeInspection.ex.InspectionToolsSupplier,com.intellij.profile.codeInspection.BaseInspectionProfileManager):com.intellij.codeInspection.ex.InspectionProfileImpl
com.intellij.codeInspection.InspectionToolCmdlineOptionHelpProvider
- a:printHelpAndExit():V
@@ -94,36 +86,14 @@ com.intellij.codeInspection.InspectionToolCmdlineOptions
- a:initApplication(com.intellij.codeInspection.InspectionApplicationBase):V
- a:suppressHelp():Z
- a:validate():V
c:com.intellij.codeInspection.InspectionToolCmdlineOptions$CmdlineArgsValidationException
f:com.intellij.codeInspection.InspectionToolCmdlineOptions$CmdlineArgsValidationException
- java.lang.Exception
- <init>(java.lang.String):V
f:com.intellij.codeInspection.inspectionProfile.DefaultSeverityGroupProvider
- com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider
- <init>():V
- findGroup(java.lang.String):com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup
f:com.intellij.codeInspection.inspectionProfile.InspectionBasicGroupProvider
- com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider
- <init>():V
- findGroup(java.lang.String):com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup
f:com.intellij.codeInspection.inspectionProfile.InspectionCategoryGroupProvider
- com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider
- <init>():V
- findGroup(java.lang.String):com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup
f:com.intellij.codeInspection.inspectionProfile.InspectionCategoryGroupProviderKt
- sf:escapeToolGroupPathElement(java.lang.String):java.lang.String
- sf:makeCategoryId(java.lang.String[]):java.lang.String
com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider
- sf:Companion:com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider$Companion
- s:createDynamicGroupProvider():com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider
- a:findGroup(java.lang.String):com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup
- s:getEP():com.intellij.openapi.extensions.ExtensionPointName
f:com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider$Companion
- f:createDynamicGroupProvider():com.intellij.codeInspection.inspectionProfile.InspectionGroupProvider
- f:getEP():com.intellij.openapi.extensions.ExtensionPointName
f:com.intellij.codeInspection.inspectionProfile.LoadDefaultYamlProfile
- com.intellij.openapi.actionSystem.AnAction
- <init>():V
- actionPerformed(com.intellij.openapi.actionSystem.AnActionEvent):V
com.intellij.codeInspection.inspectionProfile.YamlBaseConfig
- a:getEnabled():java.lang.Boolean
- a:getIgnore():java.util.List
@@ -146,11 +116,3 @@ 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.YmlInspectionProfileKt
- sf:includesInspection(com.intellij.codeInspection.inspectionProfile.YamlInspectionGroup,com.intellij.codeInspection.ex.InspectionToolWrapper):Z
f:com.intellij.inspectopedia.extractor.data.Utils
- <init>():V
- s:safeId(java.lang.String):java.lang.String
f:com.intellij.inspectopedia.extractor.utils.HtmlUtils
- <init>():V
- s:cleanupHtml(java.lang.String,java.lang.String):java.lang.String

View File

@@ -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;
import com.intellij.codeInspection.ex.Tools;
@@ -13,12 +13,14 @@ import java.util.Map;
@ApiStatus.Internal
public interface InspectResultsConsumer {
ExtensionPointName<InspectResultsConsumer> EP_NAME =
ExtensionPointName.create("com.intellij.inspectResultsConsumer");
void consume(@NotNull Map<String, ? extends Tools> tools,
@NotNull List<? extends File> inspectionsResults,
@NotNull Project project);
}
final class InspectResultsConsumerEP {
private static final ExtensionPointName<InspectResultsConsumer> EP_NAME =
ExtensionPointName.create("com.intellij.inspectResultsConsumer");
static void runConsumers(@NotNull Map<String, ? extends Tools> tools,
@NotNull List<? extends File> inspectionsResults,
@@ -27,4 +29,6 @@ public interface InspectResultsConsumer {
extension.consume(tools, inspectionsResults, project);
}
}
private InspectResultsConsumerEP() { }
}

View File

@@ -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;
import com.intellij.analysis.AnalysisScope;
@@ -497,7 +497,7 @@ public class InspectionApplicationBase implements CommandLineInspectionProgressR
List<File> results = ContainerUtil.map(inspectionsResults, Path::toFile);
reportConverter.convert(resultsDataPath.toString(), myOutPath, context.getTools(),
results);
InspectResultsConsumer.runConsumers(context.getTools(), results, project);
InspectResultsConsumerEP.runConsumers(context.getTools(), results, project);
if (myOutPath != null) {
reportConverter.projectData(project, Paths.get(myOutPath).resolve(PROJECT_STRUCTURE_DIR));
}

View File

@@ -1,8 +1,8 @@
// 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;
/** Terminates the process with the given message, without a stack trace. */
public class InspectionApplicationException extends RuntimeException {
public final class InspectionApplicationException extends RuntimeException {
/** Terminates the process with the given message, without a stack trace. */
public InspectionApplicationException(String message) {
super(message);

View File

@@ -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;
@@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Objects;
public final class InspectionDiff {
final class InspectionDiff {
private static HashMap<String, ArrayList<Element>> ourFileToProblem;
@NonNls
private static final String FILE_ELEMENT = "file";

View File

@@ -1,11 +1,11 @@
// 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
import com.intellij.openapi.application.ModernApplicationStarter
import java.util.concurrent.CompletableFuture
import kotlin.system.exitProcess
class InspectionMain : ModernApplicationStarter() {
internal class InspectionMain : ModernApplicationStarter() {
private lateinit var application: InspectionApplicationBase
override fun premain(args: List<String>) {

View File

@@ -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;
import com.intellij.codeInspection.ex.InspectionProfileImpl;
@@ -11,12 +11,16 @@ import org.jetbrains.annotations.Nullable;
import org.yaml.snakeyaml.parser.ParserException;
public abstract class InspectionProfileLoaderBase<T extends InspectionProfileImpl> implements InspectionProfileLoader<T> {
protected Project project;
private final Project project;
public InspectionProfileLoaderBase(Project project) {
this.project = project;
}
protected Project getProject() {
return project;
}
@Nullable
protected InspectionProfileImpl tryLoadProfileFromYaml(@NotNull String profilePath,
@NotNull InspectionToolsSupplier inspectionToolsSupplier,

View File

@@ -1,23 +1,12 @@
/*
* Copyright 2000-2011 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 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;
import org.jetbrains.annotations.ApiStatus;
/**
* @author Roman.Chernyatchik
*/
@ApiStatus.OverrideOnly
public interface InspectionToolCmdlineOptionHelpProvider {
void printHelpAndExit();
}

View File

@@ -1,8 +1,12 @@
// 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;
import org.jetbrains.annotations.ApiStatus;
/**
* @author Roman.Chernyatchik
*/
@ApiStatus.OverrideOnly
public interface InspectionToolCmdlineOptions extends InspectionToolCmdlineOptionHelpProvider {
/**
* @param app Inspection Application
@@ -27,7 +31,7 @@ public interface InspectionToolCmdlineOptions extends InspectionToolCmdlineOptio
*/
void beforeStartup();
class CmdlineArgsValidationException extends Exception {
final class CmdlineArgsValidationException extends Exception {
public CmdlineArgsValidationException(String message) {
super(message);
}

View File

@@ -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
@@ -6,7 +6,7 @@ import com.intellij.codeInspection.ex.InspectionToolWrapper
private const val PROVIDER_PREFIX = "severity:"
class DefaultSeverityGroupProvider : InspectionGroupProvider {
internal class DefaultSeverityGroupProvider : InspectionGroupProvider {
override fun findGroup(groupId: String): YamlInspectionGroup? {
if (!groupId.startsWith(PROVIDER_PREFIX)) return null

View File

@@ -26,7 +26,7 @@ private object LocalGroup : YamlInspectionGroup {
}
}
class InspectionBasicGroupProvider : InspectionGroupProvider {
internal class InspectionBasicGroupProvider : InspectionGroupProvider {
private val commonGroups: Map<String, YamlInspectionGroup> by lazy {
listOf(LocalGroup, GlobalGroup, AllGroup).associateBy(YamlInspectionGroup::groupId)
}

View File

@@ -1,10 +1,11 @@
// 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.InspectionToolWrapper
private const val CATEGORY_PROVIDER_PREFIX = "category:"
class InspectionCategoryGroupProvider : InspectionGroupProvider {
internal class InspectionCategoryGroupProvider : InspectionGroupProvider {
override fun findGroup(groupId: String): YamlInspectionGroup? {
if (!groupId.startsWith(CATEGORY_PROVIDER_PREFIX)) return null

View File

@@ -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.openapi.extensions.ExtensionPointName
@@ -9,19 +9,17 @@ import com.intellij.openapi.extensions.ExtensionPointName
* @see YamlInspectionProfile
*/
fun interface InspectionGroupProvider {
companion object {
@JvmStatic
val EP: ExtensionPointName<InspectionGroupProvider> = ExtensionPointName.create("com.intellij.inspectionGroupProvider")
fun findGroup(groupId: String): YamlInspectionGroup?
}
private fun createYamlInspectionGroup(groupId: String): YamlInspectionGroup? {
return EP.extensionList.firstNotNullOfOrNull { extension -> extension.findGroup(groupId) }
}
internal object InspectionGroupProviderEP {
private val EP: ExtensionPointName<InspectionGroupProvider> = ExtensionPointName.create("com.intellij.inspectionGroupProvider")
@JvmStatic
fun createDynamicGroupProvider(): InspectionGroupProvider {
return InspectionGroupProvider { groupId -> createYamlInspectionGroup(groupId) }
}
private fun createYamlInspectionGroup(groupId: String): YamlInspectionGroup? {
return EP.extensionList.firstNotNullOfOrNull { extension -> extension.findGroup(groupId) }
}
fun findGroup(groupId: String): YamlInspectionGroup?
}
fun createDynamicGroupProvider(): InspectionGroupProvider {
return InspectionGroupProvider { groupId -> createYamlInspectionGroup(groupId) }
}
}

View File

@@ -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.openapi.actionSystem.AnAction
@@ -10,7 +10,7 @@ import com.intellij.profile.codeInspection.ProjectInspectionProfileManager
* Internal action for debug purposes.
* Action loads default yaml inspection profile from '.idea/inspectionProfile/profile.yml' file and sets loaded profile as a current one.
*/
class LoadDefaultYamlProfile : AnAction() {
internal class LoadDefaultYamlProfile : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
val project = e.project ?: return
val yamlProfile = YamlInspectionProfileImpl.loadFrom(project)

View File

@@ -104,7 +104,7 @@ class YamlInspectionProfileImpl private constructor(override val profileName: St
val baseProfile = findBaseProfile(profileManager, profile.baseProfile)
val configurations = profile.inspections.map(::createInspectionConfig)
val groupProvider = CompositeGroupProvider()
groupProvider.addProvider(InspectionGroupProvider.createDynamicGroupProvider())
groupProvider.addProvider(InspectionGroupProviderEP.createDynamicGroupProvider())
val groups = profile.groups.map { group -> createGroup(groupProvider, group) }
val customGroupProvider = object : InspectionGroupProvider {

View File

@@ -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.InspectionProfileImpl
@@ -48,4 +48,4 @@ interface YamlInspectionGroup {
fun includesInspection(tool: InspectionToolWrapper<*, *>): Boolean
}
fun YamlInspectionGroup?.includesInspection(tool: InspectionToolWrapper<*, *>): Boolean = this?.includesInspection(tool) ?: false
internal fun YamlInspectionGroup?.includesInspection(tool: InspectionToolWrapper<*, *>): Boolean = this?.includesInspection(tool) ?: false

View File

@@ -1,5 +1,5 @@
// 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.inspectopedia.extractor.utils;
package com.intellij.inspectopedia.extractor;
import com.intellij.openapi.util.Pair;
import org.jetbrains.annotations.NotNull;
@@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public final class HtmlUtils {
final class HtmlUtils {
private static final Safelist SAFELIST = new Safelist();
static {
@@ -46,6 +46,8 @@ public final class HtmlUtils {
"code[style=block] > *"
);
private HtmlUtils() {}
public static @NotNull String cleanupHtml(@NotNull String source, @Nullable String languageForCodeBlocks) {
final Document document = Jsoup.parse(source);

View File

@@ -12,7 +12,6 @@ import com.intellij.codeInspection.options.*
import com.intellij.ide.plugins.PluginManagerCore.getPluginSet
import com.intellij.inspectopedia.extractor.data.Inspection
import com.intellij.inspectopedia.extractor.data.OptionsPanelInfo
import com.intellij.inspectopedia.extractor.utils.HtmlUtils
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.application.ModernApplicationStarter
import com.intellij.openapi.application.ex.ApplicationManagerEx

View File

@@ -1,14 +0,0 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.inspectopedia.extractor.data;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
public final class Utils {
@Contract(pure = true)
public static @NotNull String safeId(@NotNull String id) {
return id.replaceAll("[^\\w\\d]", "-")
.replaceAll("-{2,}", "-");
}
}