mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[java, highlighting] Fix module conflict highlighting for exported packages IDEA-352819
GitOrigin-RevId: d4479fb863280674ae8960c930e6e8b1628b7321
This commit is contained in:
committed by
intellij-monorepo-bot
parent
25cb51da31
commit
f590114d83
@@ -80,9 +80,14 @@ final class ModuleHighlightUtil {
|
||||
if (rootForFile != null && JavaCompilerConfigurationProxy.isPatchedModuleRoot(anotherJavaModule.getName(), module, rootForFile)) {
|
||||
return null;
|
||||
}
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
|
||||
.range(reference)
|
||||
.descriptionAndTooltip(JavaErrorBundle.message("module.conflicting.packages", pack.getName(), anotherJavaModule.getName()));
|
||||
for (PsiPackageAccessibilityStatement export : anotherJavaModule.getExports()) {
|
||||
String exportPackageName = export.getPackageName();
|
||||
if (exportPackageName != null && exportPackageName.equals(pack.getQualifiedName())) {
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
|
||||
.range(reference)
|
||||
.descriptionAndTooltip(JavaErrorBundle.message("module.conflicting.packages", pack.getQualifiedName(), anotherJavaModule.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package <error descr="Package 'stream' exists in another module: java.base">java.util.stream</error>;
|
||||
package <error descr="Package 'java.util.stream' exists in another module: java.base">java.util.stream</error>;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -481,7 +481,7 @@ class ModuleHighlightingTest : LightJava9ModulesCodeInsightFixtureTestCase() {
|
||||
|
||||
fun testPatchingJavaBase() {
|
||||
highlight("Main.java", """
|
||||
package <error descr="Package 'lang' exists in another module: java.base">java.lang</error>;
|
||||
package <error descr="Package 'java.lang' exists in another module: java.base">java.lang</error>;
|
||||
public class Main {}
|
||||
""".trimIndent())
|
||||
withCompileArguments(module, "--patch-module=java.base=/src") {
|
||||
@@ -490,6 +490,17 @@ class ModuleHighlightingTest : LightJava9ModulesCodeInsightFixtureTestCase() {
|
||||
public class Main {}
|
||||
""".trimIndent())
|
||||
}
|
||||
|
||||
highlight("Main.java", """
|
||||
package java;
|
||||
public class Main {}
|
||||
""".trimIndent())
|
||||
|
||||
highlight("Main.java", """
|
||||
package java.lang.my;
|
||||
public class Main {}
|
||||
""".trimIndent())
|
||||
|
||||
}
|
||||
|
||||
fun testAddReadsDependingOnSourceModule() {
|
||||
|
||||
Reference in New Issue
Block a user