IJ-CR-142510 [java-highlighting] IDEA-357310 highlight soft-keywords in compiled files

- more tests

GitOrigin-RevId: d10c07df9ca188e669972a182f1616e811c6aa9e
This commit is contained in:
Mikhail Pyltsin
2024-08-27 12:02:40 +02:00
committed by intellij-monorepo-bot
parent 8d566906e0
commit d33ab330f0
6 changed files with 40 additions and 0 deletions

View File

@@ -126,7 +126,31 @@ class IdeaDecompilerTest : LightJavaCodeInsightFixtureTestCase() {
myFixture.openFileInEditor(getTestFile("module-info.class"))
IdentifierHighlighterPassFactory.doWithHighlightingEnabled(project, testRootDisposable, Runnable {
val infos = myFixture.doHighlighting()
.filter { it.severity === HighlightInfoType.SYMBOL_TYPE_SEVERITY }
assertEquals(5, infos.size)
val texts = infos.map { it.text }.toSet()
assertContainsElements(texts,
"module",
"requires",
"exports",
)
})
}
fun testNameHighlightingInsideCompiledFileWithRecords() {
myFixture.setReadEditorMarkupModel(true)
val testFile = getTestFile("RecordHighlighting.class")
testFile.parent.children ; testFile.parent.refresh(false, true) // inner classes
myFixture.openFileInEditor(testFile)
IdentifierHighlighterPassFactory.doWithHighlightingEnabled(project, testRootDisposable, Runnable {
val infos = myFixture.doHighlighting()
.filter { it.severity === HighlightInfoType.SYMBOL_TYPE_SEVERITY }
val texts = infos.map { it.text }.toSet()
assertContainsElements(texts,
"sealed",
"record",
"permits",
)
})
}

View File

@@ -0,0 +1,16 @@
public class RecordHighlighting {
public static void main(String[] args) {
}
sealed interface A {
}
record B() implements A {
}
record C() implements A {
}
}