mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Java slicing: support -> this/-> paramN contracts
Fixes IDEA-121571 Feature request: A Contract Annotation that indicates that a method returns its argument
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
class Test {
|
||||
|
||||
private String <flown1>s;
|
||||
private String s2;
|
||||
|
||||
void test(String <flown112111><flown1111>s, String s2) {
|
||||
this.s = <flown11>requireNonNull(<flown11211><flown111>s);
|
||||
this.s2 = requireNonNull(s2);
|
||||
}
|
||||
|
||||
String foo() {
|
||||
return <caret>s;
|
||||
}
|
||||
|
||||
public static <T> T requireNonNull(T <flown1121>obj) {
|
||||
if (obj == null)
|
||||
throw new NullPointerException();
|
||||
return <flown112>obj;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user