[java-inspections] IDEA-377301 improve jspecify nullability tests

- conformance tests, update to the last jspecify tests

GitOrigin-RevId: 4c743ceb61fe0bdd9ff90867163a37555c25c2cf
This commit is contained in:
Mikhail Pyltsin
2025-09-24 13:24:27 +00:00
committed by intellij-monorepo-bot
parent fe36cbe99f
commit 732b17bc67
4 changed files with 3 additions and 12 deletions
@@ -87,7 +87,7 @@ public class Other {
try (@Nullable AutoCloseable a = () -> {}) {}
// test:name:NonNull try-with-resources
// test:irrelevant-annotation:NonNull
try (@Nullable AutoCloseable a = () -> {}) {}
try (@NonNull AutoCloseable a = () -> {}) {}
}
/**
@@ -87,7 +87,7 @@ public class Other {
try (@Nullable AutoCloseable a = () -> {}) {}
// test:name:NonNull try-with-resources
// test:irrelevant-annotation:NonNull
try (@Nullable AutoCloseable a = () -> {}) {}
try (@NonNull AutoCloseable a = () -> {}) {}
}
/**
@@ -89,7 +89,7 @@ public class Other {
try (@Nullable AutoCloseable a = () -> {}) {}
// test:name:NonNull try-with-resources
// test:irrelevant-annotation:NonNull
try (@Nullable AutoCloseable a = () -> {}) {}
try (@NonNull AutoCloseable a = () -> {}) {}
}
/**
@@ -178,15 +178,6 @@ public class JSpecifyConformanceAnnotationTest extends LightJavaCodeInsightFixtu
Pattern.compile("// test:irrelevant[^\\r\\n]*\n *// test:irrelevant.*\n");
private static @NotNull String clean(@NotNull String text, String fileName) {
//it is a bug in tests
text = text.replaceAll(Pattern.quote("""
// test:irrelevant-annotation:NonNull
try (@Nullable AutoCloseable a = () -> {}) {}
"""),
"""
// test:irrelevant-annotation:NonNull
try (@NonNull AutoCloseable a = () -> {}) {}
""");
text = JOIN_TEST_IRRELEVANT_ANNOTATIONS.matcher(text)
.replaceAll("// test:irrelevant-annotation:Nullable & test:irrelevant-annotation:NonNull\n");
text = CANNOT_CONVERT.matcher(text).replaceAll("// jspecify_nullness_mismatch\n");