[jvm] Fix false-positive UrlHashCodeInspection

Previously, this inspection highlighted the cases like `url.equals(null)` or `url == null`. This commit fixes this behavior

^IDEA-332645 fixed

GitOrigin-RevId: 7448489db08e5bbf75dfc1582788bc1f78f923f2
This commit is contained in:
Georgii Ustinov
2023-10-26 15:13:21 +03:00
committed by intellij-monorepo-bot
parent ae2e9b0b34
commit 6233b72cb6
3 changed files with 38 additions and 4 deletions

View File

@@ -83,4 +83,20 @@ class JavaUrlHashCodeInspectionTest : UrlHashCodeInspectionTestBase() {
}
""".trimIndent())
}
fun `test URL doesn't highlight when comparing with null`() {
myFixture.testHighlighting(JvmLanguage.JAVA, """
import java.net.URL;
class Foo {
static {
try {
var url = new URL("");
if (url.equals(null)) {
}
} catch (Exception e) {}
}
}
""".trimIndent())
}
}