From abc33e8fe546a2a7aa130726343be11ce6175477 Mon Sep 17 00:00:00 2001 From: Anna Antonova Date: Fri, 14 Nov 2025 20:33:05 +0000 Subject: [PATCH] [kotlin] KTIJ-17913 do not include equals and hashCode methods in possible duplicates [kotlin] KTIJ-30722 create intellij.kotlin.duplicate.scope module, move KotlinDuplicateScope there, create tests [kotlin] KTIJ-30722 ExpectedHighlightingData minor refactoring Merge-request: IJ-MR-176041 Merged-by: Anna Antonova GitOrigin-RevId: f2e3b0d35c0b6ddd83bd521af986f95d10e50078 --- .../intellij/build/kotlin/KotlinPluginBuilder.kt | 2 +- .../testFramework/ExpectedHighlightingData.java | 12 ++++++------ plugins/kotlin/plugin/plugin-content.yaml | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinPluginBuilder.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinPluginBuilder.kt index db38d2c71f71..bf7196404d5e 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinPluginBuilder.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinPluginBuilder.kt @@ -213,7 +213,7 @@ abstract class KotlinPluginBuilder(val kind : KotlinPluginKind = System.getPrope "kotlin.bundled-compiler-plugins-support", "kotlin.jsr223", "intellij.kotlin.internal", - "intellij.kotlin.base.serialization", + "intellij.kotlin.base.serialization" ) private val KOTLIN_SCRIPTING_LIBRARIES = java.util.List.of( diff --git a/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java b/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java index 3c424610484d..6d265c27f14f 100644 --- a/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java +++ b/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java @@ -565,7 +565,7 @@ public class ExpectedHighlightingData { @Override public boolean equals(HighlightInfo o1, HighlightInfo o2) { - return o1==null || o2 == null ? o1 == o2 : matchesPattern(o1, o2, false); + return o1==null || o2 == null ? o1 == o2 : matchesPattern(o1, o2); } }); index.addAll(infos); @@ -739,15 +739,15 @@ public class ExpectedHighlightingData { return ThreeState.NO; } - private static boolean matchesPattern(@NotNull HighlightInfo expectedInfo, @NotNull HighlightInfo info, boolean strictMatch) { + private static boolean matchesPattern(@NotNull HighlightInfo expectedInfo, @NotNull HighlightInfo info) { if (expectedInfo == info) return true; - boolean typeMatches = expectedInfo.type.equals(info.type) || !strictMatch && (expectedInfo.type == Holder.WHATEVER || info.type == Holder.WHATEVER); + boolean typeMatches = expectedInfo.type.equals(info.type) || (expectedInfo.type == Holder.WHATEVER || info.type == Holder.WHATEVER); boolean textAttributesMatches = sameTextAttributesByValue(expectedInfo.getTextAttributes(null, null), info.getTextAttributes(null, null)) || - !strictMatch && (expectedInfo.forcedTextAttributes == null || info.forcedTextAttributes == null); - boolean attributesKeyMatches = !strictMatch && (expectedInfo.forcedTextAttributesKey == null || info.forcedTextAttributesKey == null) || + (expectedInfo.forcedTextAttributes == null || info.forcedTextAttributes == null); + boolean attributesKeyMatches = (expectedInfo.forcedTextAttributesKey == null || info.forcedTextAttributesKey == null) || Objects.equals(expectedInfo.forcedTextAttributesKey, info.forcedTextAttributesKey); return - haveSamePresentation(info, expectedInfo, strictMatch) && + haveSamePresentation(info, expectedInfo, false) && info.getSeverity() == expectedInfo.getSeverity() && typeMatches && textAttributesMatches && diff --git a/plugins/kotlin/plugin/plugin-content.yaml b/plugins/kotlin/plugin/plugin-content.yaml index 6be8bb59a8ed..195ddfbc6f16 100644 --- a/plugins/kotlin/plugin/plugin-content.yaml +++ b/plugins/kotlin/plugin/plugin-content.yaml @@ -399,6 +399,7 @@ - name: kotlin-ultimate.profiler - name: kotlin-ultimate.ultimate-plugin - name: intellij.kotlin-ultimate.j2k-llm + - name: intellij.kotlin.duplicate.scope - name: kotlin.plugin - name: lib/kotlinc.allopen-compiler-plugin.jar library: kotlinc.allopen-compiler-plugin