[jvm] Add test case for Java API usage inspection

Adds another test case for when a method has a certain since version but its super method has a lower since version.

GitOrigin-RevId: 5962a0f2d4549b6729fe7c303798bc04b575e5c5
This commit is contained in:
Bart van Helvert
2024-01-05 12:30:55 +01:00
committed by intellij-monorepo-bot
parent ab151dd3c9
commit 3a5d36c5f7

View File

@@ -237,4 +237,21 @@ class JavaJavaApiUsageInspectionTest : JavaApiUsageInspectionTestBase() {
}
""".trimIndent())
}
fun `test override with different since version`() {
myFixture.setLanguageLevel(LanguageLevel.JDK_1_8)
myFixture.testHighlighting(JvmLanguage.JAVA, """
import java.io.FilterOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
class Main {
public static void main(String[] args) throws IOException {
byte[] buff = "hello\n".getBytes(StandardCharsets.UTF_8);
System.out.write(buff); // call to PrintStream in JDK 14
((FilterOutputStream) System.out).write(buff); // call to FilterOutputStream in JDK below 14
}
}
""".trimIndent())
}
}