J2K: Detect @NotNull references in call chains

This commit is contained in:
Andrey Ponomarev
2013-02-21 01:46:09 +01:00
parent 514c7b553f
commit e4df4059d1
4 changed files with 51 additions and 2 deletions
@@ -0,0 +1,22 @@
package test;
import org.jetbrains.annotations.NotNull;
class Foo {
void execute() {}
}
class Bar {
@NotNull
Foo fooNotNull = Foo();
Foo fooNullable = null;
}
class Test {
public void test(@NotNull Bar barNotNull, Bar barNullable) {
barNotNull.fooNotNull.execute();
barNotNull.fooNullable.execute();
barNullable.fooNotNull.execute();
barNullable.fooNullable.execute();
}
}
@@ -0,0 +1,17 @@
package test
open class Foo() {
open fun execute() : Unit {
}
}
open class Bar() {
var fooNotNull : Foo = Foo()
var fooNullable : Foo? = null
}
open class Test() {
public open fun test(barNotNull : Bar, barNullable : Bar?) : Unit {
barNotNull.fooNotNull.execute()
barNotNull.fooNullable?.execute()
barNullable?.fooNotNull?.execute()
barNullable?.fooNullable?.execute()
}
}