mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +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,6 @@
|
||||
class Test {
|
||||
StringBuilder <flown111111>builder(StringBuilder <caret>sb) {
|
||||
StringBuilder <flown1111>foo = <flown111><flown11><flown1>sb.append("foo").append(1);
|
||||
return <flown11111>foo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
private String <flown111>s;
|
||||
private String s2;
|
||||
|
||||
void test(String <caret>s, String s2) {
|
||||
this.s = <flown11>requireNonNull(<flown1>s);
|
||||
this.s2 = requireNonNull(s2);
|
||||
}
|
||||
|
||||
String <flown11111>foo() {
|
||||
return <flown1111>s;
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.Contract("null -> fail; !null -> param1")
|
||||
public static native <T> T requireNonNull(T <flown12>obj);
|
||||
}
|
||||
Reference in New Issue
Block a user