mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
extract method: use target class context to check nullability
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
public static String main(String[] args) {
|
||||
<selection>System.out.println();
|
||||
return f();
|
||||
</selection>
|
||||
}
|
||||
|
||||
@NotNull
|
||||
String f() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
public static String main(String[] args) {
|
||||
return newMethod();
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String newMethod() {
|
||||
System.out.println();
|
||||
return f();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
String f() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -698,6 +698,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testInferredNotNull() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testCantPassFieldAsParameter() throws Exception {
|
||||
try {
|
||||
doTestPassFieldsAsParams();
|
||||
|
||||
Reference in New Issue
Block a user