mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[devKit] IDEA-326862 GoodCodeRedVisitor moved to intellij.dev.codeInsight
all the implementations moved accordingly GitOrigin-RevId: d8f87fc59df6ba322f1bfed864bd756dd226b530
This commit is contained in:
committed by
intellij-monorepo-bot
parent
27d55753c9
commit
d6e577c808
3
.idea/modules.xml
generated
3
.idea/modules.xml
generated
@@ -668,7 +668,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/grazie/yaml/intellij.grazie.yaml.iml" filepath="$PROJECT_DIR$/plugins/grazie/yaml/intellij.grazie.yaml.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/intellij.groovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/intellij.groovy.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt-constants/intellij.groovy.constants.rt.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt-constants/intellij.groovy.constants.rt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/intellij.groovy.devkit/intellij.groovy.devkit.iml" filepath="$PROJECT_DIR$/plugins/devkit/intellij.groovy.devkit/intellij.groovy.devkit.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/dev/intellij.groovy.dev/intellij.groovy.dev.iml" filepath="$PROJECT_DIR$/plugins/dev/intellij.groovy.dev/intellij.groovy.dev.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/git/intellij.groovy.git.iml" filepath="$PROJECT_DIR$/plugins/groovy/git/intellij.groovy.git.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jps-plugin/intellij.groovy.jps.iml" filepath="$PROJECT_DIR$/plugins/groovy/jps-plugin/intellij.groovy.jps.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jps-plugin/intellij.groovy.jps.tests.iml" filepath="$PROJECT_DIR$/plugins/groovy/jps-plugin/intellij.groovy.jps.tests.iml" />
|
||||
@@ -790,6 +790,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/keymaps/visual-studio-for-mac-keymap/intellij.keymap.visualStudioForMac.iml" filepath="$PROJECT_DIR$/plugins/keymaps/visual-studio-for-mac-keymap/intellij.keymap.visualStudioForMac.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/keymaps/vscode-keymap/intellij.keymap.vscode.iml" filepath="$PROJECT_DIR$/plugins/keymaps/vscode-keymap/intellij.keymap.vscode.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/keymaps/xcode-keymap/intellij.keymap.xcode.iml" filepath="$PROJECT_DIR$/plugins/keymaps/xcode-keymap/intellij.keymap.xcode.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/dev/intellij.kotlin.dev/intellij.kotlin.dev.iml" filepath="$PROJECT_DIR$/plugins/dev/intellij.kotlin.dev/intellij.kotlin.dev.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/intellij.kotlin.devkit/intellij.kotlin.devkit.iml" filepath="$PROJECT_DIR$/plugins/devkit/intellij.kotlin.devkit/intellij.kotlin.devkit.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/gradle/multiplatform-tests/intellij.kotlin.gradle.multiplatformTests.iml" filepath="$PROJECT_DIR$/plugins/kotlin/gradle/multiplatform-tests/intellij.kotlin.gradle.multiplatformTests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/intellij.kotlin.plugin.community.main.iml" filepath="$PROJECT_DIR$/plugins/kotlin/intellij.kotlin.plugin.community.main.iml" />
|
||||
|
||||
@@ -179,6 +179,8 @@ object CommunityRepositoryModules {
|
||||
spec.withModule("intellij.dev.psiViewer")
|
||||
spec.withModule("intellij.dev.codeInsight")
|
||||
spec.withModule("intellij.java.dev")
|
||||
spec.withModule("intellij.groovy.dev")
|
||||
spec.withModule("intellij.kotlin.dev")
|
||||
spec.withModule("intellij.platform.statistics.devkit")
|
||||
},
|
||||
pluginAuto(listOf("intellij.devkit")) { spec ->
|
||||
@@ -191,7 +193,6 @@ object CommunityRepositoryModules {
|
||||
spec.withModule("intellij.devkit.intelliLang")
|
||||
spec.withModule("intellij.devkit.uiDesigner")
|
||||
spec.withModule("intellij.devkit.workspaceModel")
|
||||
spec.withModule("intellij.groovy.devkit")
|
||||
spec.withModule("intellij.kotlin.devkit")
|
||||
spec.withModule("intellij.devkit.jps")
|
||||
spec.withModule("intellij.devkit.runtimeModuleRepository.jps")
|
||||
|
||||
@@ -9,5 +9,7 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.java.analysis" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,4 +1,11 @@
|
||||
<idea-plugin package="com.intellij.dev.codeInsight">
|
||||
<resource-bundle>messages.DevCodeInsightBundle</resource-bundle>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="com.intellij.dev.lang.goodCodeRedVisitor"
|
||||
beanClass="com.intellij.lang.LanguageExtensionPoint"
|
||||
dynamic="true">
|
||||
<with attribute="implementationClass" implements="com.intellij.dev.codeInsight.internal.GoodCodeRedVisitor"/>
|
||||
</extensionPoint>
|
||||
</extensionPoints>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.devkit.inspections.internal;
|
||||
package com.intellij.dev.codeInsight.internal;
|
||||
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface GoodCodeRedVisitor {
|
||||
|
||||
@NotNull
|
||||
PsiElementVisitor createVisitor(ProblemsHolder holder);
|
||||
|
||||
@NotNull PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder);
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.devkit.inspections.internal;
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.dev.codeInsight.internal;
|
||||
|
||||
import com.intellij.lang.LanguageExtension;
|
||||
|
||||
public final class LanguageGoodCodeRedVisitors extends LanguageExtension<GoodCodeRedVisitor> {
|
||||
|
||||
public static final LanguageGoodCodeRedVisitors INSTANCE = new LanguageGoodCodeRedVisitors();
|
||||
|
||||
private LanguageGoodCodeRedVisitors() {
|
||||
super("DevKit.lang.goodCodeRedVisitor");
|
||||
super("com.intellij.dev.lang.goodCodeRedVisitor");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,5 +6,7 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.dev.plugin.noJava" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.java.dev" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.groovy.dev" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.kotlin.dev" scope="RUNTIME" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -7,6 +7,8 @@
|
||||
<module name="intellij.dev.psiViewer"/>
|
||||
<module name="intellij.dev.codeInsight"/>
|
||||
<module name="intellij.java.dev"/>
|
||||
<module name="intellij.groovy.dev"/>
|
||||
<module name="intellij.kotlin.dev"/>
|
||||
<module name="intellij.platform.statistics.devkit"/>
|
||||
</content>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="org.jetbrains.idea.devkit.groovy" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="org.jetbrains.idea.dev.groovy" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.core" />
|
||||
<orderEntry type="module" module-name="intellij.dev.codeInsight" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.groovy.psi" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis.impl" />
|
||||
<orderEntry type="module" module-name="intellij.groovy.psi" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,11 +1,15 @@
|
||||
<idea-plugin package="org.jetbrains.idea.devkit.groovy">
|
||||
<idea-plugin package="org.jetbrains.idea.dev.groovy">
|
||||
|
||||
<dependencies>
|
||||
<module name="intellij.devkit.core"/>
|
||||
<module name="intellij.dev.codeInsight"/>
|
||||
<plugin id="org.intellij.groovy"/>
|
||||
</dependencies>
|
||||
<extensions defaultExtensionNs="DevKit.lang">
|
||||
<goodCodeRedVisitor language="Groovy" implementationClass="org.jetbrains.idea.devkit.groovy.GroovyGoodCodeRedVisitor"/>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.dev">
|
||||
<lang.goodCodeRedVisitor language="Groovy"
|
||||
implementationClass="org.jetbrains.idea.dev.groovy.internal.GroovyGoodCodeRedVisitor"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<registryKey key="groovy.good.code.is.red" defaultValue="false"
|
||||
description="When enabled, groovy code would be checked for resolving symbols, accessibility and type checks"/>
|
||||
@@ -1,19 +1,19 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.devkit.groovy;
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.dev.groovy.internal;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.codeInspection.util.InspectionMessage;
|
||||
import com.intellij.dev.codeInsight.internal.GoodCodeRedVisitor;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.registry.RegistryManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.devkit.inspections.internal.GoodCodeRedVisitor;
|
||||
import org.jetbrains.plugins.groovy.codeInspection.bugs.GrAccessibilityChecker;
|
||||
import org.jetbrains.plugins.groovy.codeInspection.type.GroovyStaticTypeCheckVisitorBase;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
@@ -23,14 +23,14 @@ import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementVisitor;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
|
||||
|
||||
public class GroovyGoodCodeRedVisitor implements GoodCodeRedVisitor {
|
||||
final class GroovyGoodCodeRedVisitor implements GoodCodeRedVisitor {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElementVisitor createVisitor(ProblemsHolder holder) {
|
||||
if (!Registry.is("groovy.good.code.is.red", false)) {
|
||||
public @NotNull PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder) {
|
||||
if (!RegistryManager.getInstance().is("groovy.good.code.is.red")) {
|
||||
return PsiElementVisitor.EMPTY_VISITOR;
|
||||
}
|
||||
|
||||
GroovyFileBase file = (GroovyFileBase)holder.getFile();
|
||||
Project project = holder.getProject();
|
||||
GrAccessibilityChecker accessibilityChecker = new GrAccessibilityChecker(file, project);
|
||||
@@ -9,15 +9,18 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="jetbrains-annotations" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi.impl" />
|
||||
<orderEntry type="module" module-name="intellij.dev.psiViewer" />
|
||||
<orderEntry type="module" module-name="intellij.dev.codeInsight" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.editor" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" />
|
||||
<orderEntry type="module" module-name="intellij.java.debugger.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.debugger.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.ui" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.debugger.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.analysis.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.compiler" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<dependencies>
|
||||
<module name="intellij.dev.psiViewer"/>
|
||||
<module name="intellij.dev.codeInsight"/>
|
||||
<plugin id="com.intellij.java"/>
|
||||
</dependencies>
|
||||
|
||||
@@ -10,6 +11,16 @@
|
||||
<psiViewer.extension implementation="com.intellij.java.dev.psiViewer.PsiViewerExpressionExtension"/>
|
||||
<psiViewer.extension implementation="com.intellij.java.dev.psiViewer.PsiViewerCodeFragmentExtension"/>
|
||||
<psiViewer.extension implementation="com.intellij.java.dev.psiViewer.PsiViewerMethodExtension"/>
|
||||
|
||||
<lang.goodCodeRedVisitor language="JAVA" implementationClass="com.intellij.java.dev.codeInsight.internal.JavaGoodCodeRedVisitor"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<localInspection language="" shortName="HighlightVisitorInternal"
|
||||
groupPathKey="inspections.group.path" groupKey="inspections.group.code"
|
||||
enabledByDefault="false" isInternal="true"
|
||||
level="ERROR" implementationClass="com.intellij.java.dev.codeInsight.internal.HighlightVisitorInternalInspection"
|
||||
key="inspections.highlight.visitor.internal.display.name"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
|
||||
@@ -2,6 +2,10 @@ java.code.block=Java Code Block
|
||||
java.expression=Java Expression
|
||||
java.method=Java Method
|
||||
|
||||
inspections.group.code=Code
|
||||
inspections.group.path=Plugin Dev
|
||||
inspections.highlight.visitor.internal.display.name=Good code is red
|
||||
|
||||
#PSI Viewer Debugger
|
||||
action.Debug.PsiViewer.text=Show PSI Structure...
|
||||
action.Debug.PsiViewer.Toggle.UI.text=Use Dialog For PSI Debugger
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.devkit.inspections.internal;
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.dev.codeInsight.internal;
|
||||
|
||||
import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.dev.codeInsight.internal.GoodCodeRedVisitor;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
@@ -12,11 +13,10 @@ import com.intellij.psi.util.PsiUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
abstract public class GoodCodeRedInspectionTool extends AbstractBaseJavaLocalInspectionTool {
|
||||
public abstract class GoodCodeRedInspectionTool extends AbstractBaseJavaLocalInspectionTool {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
|
||||
public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
|
||||
if (isOnTheFly) {
|
||||
//disable good code red in the editor as there general highlighting pass already does the job and the inspection just mess things
|
||||
return PsiElementVisitor.EMPTY_VISITOR;
|
||||
@@ -39,6 +39,5 @@ abstract public class GoodCodeRedInspectionTool extends AbstractBaseJavaLocalIns
|
||||
return visitor.createVisitor(holder);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract GoodCodeRedVisitor getGoodCodeRedVisitor(@NotNull PsiFile file);
|
||||
protected abstract @Nullable GoodCodeRedVisitor getGoodCodeRedVisitor(@NotNull PsiFile file);
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.devkit.inspections.internal;
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.dev.codeInsight.internal;
|
||||
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.dev.codeInsight.internal.GoodCodeRedVisitor;
|
||||
import com.intellij.dev.codeInsight.internal.LanguageGoodCodeRedVisitors;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class HighlightVisitorInternalInspection extends GoodCodeRedInspectionTool {
|
||||
final class HighlightVisitorInternalInspection extends GoodCodeRedInspectionTool {
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -15,8 +18,8 @@ public class HighlightVisitorInternalInspection extends GoodCodeRedInspectionToo
|
||||
return InspectionsBundle.message("group.names.probable.bugs");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@Override
|
||||
public GoodCodeRedVisitor getGoodCodeRedVisitor(@NotNull PsiFile file) {
|
||||
return LanguageGoodCodeRedVisitors.INSTANCE.forLanguage(file.getLanguage());
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.devkit.inspections.internal;
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.dev.codeInsight.internal;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.dev.codeInsight.internal.GoodCodeRedVisitor;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
@@ -15,17 +16,20 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
final class JavaGoodCodeRedVisitor implements GoodCodeRedVisitor {
|
||||
@NotNull
|
||||
|
||||
@Override
|
||||
public PsiElementVisitor createVisitor(ProblemsHolder holder) {
|
||||
public @NotNull PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder) {
|
||||
PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(holder.getProject()).getResolveHelper();
|
||||
return new MyHighlightVisitorImpl(holder, resolveHelper);
|
||||
}
|
||||
|
||||
private static final class MyHighlightVisitorImpl extends HighlightVisitorImpl {
|
||||
private final PsiResolveHelper myResolveHelper;
|
||||
|
||||
private MyHighlightVisitorImpl(ProblemsHolder holder, PsiResolveHelper resolveHelper) {
|
||||
private final @NotNull PsiResolveHelper myResolveHelper;
|
||||
|
||||
private MyHighlightVisitorImpl(@NotNull ProblemsHolder holder,
|
||||
@NotNull PsiResolveHelper resolveHelper) {
|
||||
|
||||
myResolveHelper = resolveHelper;
|
||||
prepareToRunAsInspection(new HighlightInfoHolder(holder.getFile()) {
|
||||
@Override
|
||||
@@ -51,9 +55,8 @@ final class JavaGoodCodeRedVisitor implements GoodCodeRedVisitor {
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected PsiResolveHelper getResolveHelper(@NotNull Project project) {
|
||||
protected @NotNull PsiResolveHelper getResolveHelper(@NotNull Project project) {
|
||||
return myResolveHelper;
|
||||
}
|
||||
}
|
||||
19
plugins/dev/intellij.kotlin.dev/intellij.kotlin.dev.iml
Normal file
19
plugins/dev/intellij.kotlin.dev/intellij.kotlin.dev.iml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="org.jetbrains.idea.dev.kotlin" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.dev.codeInsight" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.psi" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="kotlinc.high-level-api" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="kotlinc.kotlin-compiler-common" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,11 @@
|
||||
<idea-plugin package="org.jetbrains.idea.dev.kotlin">
|
||||
|
||||
<dependencies>
|
||||
<module name="intellij.dev.codeInsight"/>
|
||||
<plugin id="org.jetbrains.kotlin"/>
|
||||
</dependencies>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.dev">
|
||||
<lang.goodCodeRedVisitor language="kotlin" implementationClass="org.jetbrains.idea.dev.kotlin.internal.KotlinGoodCodeRedVisitor"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,17 +1,18 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.devkit.kotlin.inspections
|
||||
package org.jetbrains.idea.dev.kotlin.internal
|
||||
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import com.intellij.dev.codeInsight.internal.GoodCodeRedVisitor
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.idea.devkit.inspections.internal.GoodCodeRedVisitor
|
||||
import org.jetbrains.kotlin.analysis.api.analyze
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtDiagnosticCheckerFilter
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtVisitor
|
||||
|
||||
class KotlinGoodCodeRedVisitor : GoodCodeRedVisitor {
|
||||
internal class KotlinGoodCodeRedVisitor : GoodCodeRedVisitor {
|
||||
|
||||
override fun createVisitor(holder: ProblemsHolder): PsiElementVisitor {
|
||||
|
||||
return object : KtVisitor<Unit, Unit>() {
|
||||
@@ -242,12 +242,6 @@
|
||||
enabledByDefault="true" level="WARNING" cleanupTool="true"
|
||||
implementationClass="org.jetbrains.idea.devkit.inspections.internal.UsePrimitiveTypesEqualsInspection"
|
||||
key="inspection.use.primitive.types.equals.display.name"/>
|
||||
<!--suppress PluginXmlCapitalization -->
|
||||
<localInspection language="" shortName="HighlightVisitorInternal"
|
||||
groupPathKey="inspections.group.path" groupKey="inspections.group.code"
|
||||
enabledByDefault="false" isInternal="true"
|
||||
level="ERROR" implementationClass="org.jetbrains.idea.devkit.inspections.internal.HighlightVisitorInternalInspection"
|
||||
key="inspection.highlight.visitor.internal.display.name"/>
|
||||
<localInspection language="UAST" shortName="QuickFixGetFamilyNameViolation"
|
||||
projectType="INTELLIJ_PLUGIN"
|
||||
groupPathKey="inspections.group.path" groupKey="inspections.group.code"
|
||||
@@ -568,7 +562,7 @@
|
||||
<extensions defaultExtensionNs="DevKit.lang">
|
||||
<goodCodeRedVisitor
|
||||
language="JAVA"
|
||||
implementationClass="org.jetbrains.idea.devkit.inspections.internal.JavaGoodCodeRedVisitor"/>
|
||||
implementationClass="com.intellij.java.dev.JavaGoodCodeRedVisitor"/>
|
||||
<cancellationCheckProvider
|
||||
language="JAVA"
|
||||
implementationClass="org.jetbrains.idea.devkit.inspections.JavaCancellationCheckProvider"/>
|
||||
@@ -601,11 +595,6 @@
|
||||
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="DevKit.lang.goodCodeRedVisitor"
|
||||
beanClass="com.intellij.lang.LanguageExtensionPoint"
|
||||
dynamic="true">
|
||||
<with attribute="implementationClass" implements="org.jetbrains.idea.devkit.inspections.internal.GoodCodeRedVisitor"/>
|
||||
</extensionPoint>
|
||||
<extensionPoint qualifiedName="DevKit.lang.cancellationCheckProvider"
|
||||
beanClass="com.intellij.lang.LanguageExtensionPoint"
|
||||
dynamic="true">
|
||||
|
||||
@@ -590,7 +590,6 @@ inspection.unsafe.return.statement.visitor.display.name=Unsafe return statements
|
||||
inspection.stateful.ep.display.name=Stateful extension
|
||||
inspection.u.element.as.psi.display.name=UElement as PsiElement usage
|
||||
inspection.use.primitive.types.equals.display.name=Use 'PsiType#equals(Object)' with primitive types
|
||||
inspection.highlight.visitor.internal.display.name=Good code is red
|
||||
inspection.quick.fix.get.family.name.violation.display.name=QuickFix's getFamilyName() implementation must not depend on a specific context
|
||||
inspection.psi.element.concatenation.display.name=Using PsiElement string representation to generate new expression is incorrect
|
||||
inspection.migrate.to.opt.control.display.name=Migrate to getOptionPane()
|
||||
|
||||
@@ -17,7 +17,6 @@ public class DevkitInspectionsRegistrationCheckTest extends BasePlatformTestCase
|
||||
private static final List<String> DISABLED_INSPECTIONS =
|
||||
List.of("StatisticsCollectorNotRegistered",
|
||||
"UseCouple",
|
||||
"HighlightVisitorInternal",
|
||||
"PluginXmlI18n",
|
||||
"SerializableCtor");
|
||||
|
||||
@@ -44,7 +43,7 @@ public class DevkitInspectionsRegistrationCheckTest extends BasePlatformTestCase
|
||||
List<LocalInspectionEP> devkitInspections = ContainerUtil.filter(LocalInspectionEP.LOCAL_INSPECTION.getExtensionList(), ep -> {
|
||||
return "DevKit".equals(ep.getPluginDescriptor().getPluginId().getIdString());
|
||||
});
|
||||
assertEquals("Mismatch in total inspections, check classpath in test run configuration (intellij.devkit.plugin)", 68,
|
||||
assertEquals("Mismatch in total inspections, check classpath in test run configuration (intellij.devkit.plugin)", 67,
|
||||
devkitInspections.size());
|
||||
|
||||
List<LocalInspectionEP> disabledInspections = ContainerUtil.filter(devkitInspections, ep -> !ep.enabledByDefault);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<orderEntry type="module" module-name="intellij.devkit.themes" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.uiDesigner" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.workspaceModel" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.groovy.devkit" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.jps" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.runtimeModuleRepository.jps" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.java.tests" scope="TEST" />
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
<module name="intellij.devkit.themes"/>
|
||||
<module name="intellij.devkit.uiDesigner"/>
|
||||
<module name="intellij.devkit.workspaceModel"/>
|
||||
<module name="intellij.groovy.devkit"/>
|
||||
<module name="intellij.kotlin.devkit"/>
|
||||
</content>
|
||||
|
||||
|
||||
@@ -80,7 +80,4 @@
|
||||
<staticInitializationInExtensionsVisitorProvider language="kotlin"
|
||||
implementationClass="org.jetbrains.idea.devkit.kotlin.inspections.KtStaticInitializationInExtensionsVisitorProvider"/>
|
||||
</extensions>
|
||||
<extensions defaultExtensionNs="DevKit.lang">
|
||||
<goodCodeRedVisitor language="kotlin" implementationClass="org.jetbrains.idea.devkit.kotlin.inspections.KotlinGoodCodeRedVisitor"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
|
||||
Reference in New Issue
Block a user