[java-inspections] ReplaceWithConstantValueFix: substitute parameter types when necessary

Fixes IDEA-276811 Replace-with-null refactoring is incorrect when generics are involved

GitOrigin-RevId: 5783d19c4c5458ecb3c1e97ed11ff1d78a756793
This commit is contained in:
Tagir Valeev
2022-04-07 13:40:25 +07:00
committed by intellij-monorepo-bot
parent 83e613fa2f
commit 5f0fd1d8e1
5 changed files with 63 additions and 6 deletions

View File

@@ -0,0 +1,9 @@
// "Replace with 'null'" "true"
import java.util.stream.*;
class Test {
public static void method() {
Object obj = null;
Stream<Object> stream = Stream.of((Object) null);
}
}

View File

@@ -0,0 +1,9 @@
// "Replace with 'null'" "true"
import java.util.stream.*;
class Test {
public static void method() {
Object obj = null;
Stream<Object> stream = Stream.of(<caret>obj);
}
}