Generate @Nullable/@NotNull annotations on Kotlin declarations (for IDEA interop)

This commit is contained in:
Andrey Breslav
2013-11-08 18:39:43 +04:00
parent 4268d8aa27
commit 2873f74932
13 changed files with 405 additions and 11 deletions
@@ -0,0 +1,74 @@
public final class Class implements jet.JetObject {
@org.jetbrains.annotations.Nullable
private final java.lang.String nullableVal = "";
@org.jetbrains.annotations.Nullable
private java.lang.String nullableVar;
@org.jetbrains.annotations.NotNull
private final java.lang.String notNullVal = "";
@org.jetbrains.annotations.NotNull
private java.lang.String notNullVar;
@org.jetbrains.annotations.NotNull
public final java.lang.String notNull(@org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "a") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public final java.lang.String nullable(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "a", type = "?") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final java.lang.String notNullWithNN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public final java.lang.String notNullWithN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public final java.lang.String nullableWithN() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public final java.lang.String nullableWithNN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public final java.lang.String getNullableVal() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public final java.lang.String getNullableVar() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final void setNullableVar(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "<set-?>", type = "?") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final java.lang.String getNotNullVal() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final java.lang.String getNotNullVar() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final void setNotNullVar(@org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "<set-?>") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public final java.lang.String getNotNullValWithGet() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public final java.lang.String getNotNullVarWithGetSet() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public final void setNotNullVarWithGetSet(@org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "v") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public final java.lang.String getNullableValWithGet() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public final java.lang.String getNullableVarWithGetSet() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final void setNullableVarWithGetSet(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "v", type = "?") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public Class() { /* compiled code */ }
}
@@ -0,0 +1,32 @@
import org.jetbrains.annotations.NotNull
import org.jetbrains.annotations.Nullable
class Class {
fun notNull(a: String): String = ""
fun nullable(a: String?): String? = ""
NotNull fun notNullWithNN(): String = ""
Nullable fun notNullWithN(): String = ""
Nullable fun nullableWithN(): String? = ""
NotNull fun nullableWithNN(): String? = ""
val nullableVal: String? = ""
var nullableVar: String? = ""
val notNullVal: String = ""
var notNullVar: String = ""
val notNullValWithGet: String
[Nullable] get() = ""
var notNullVarWithGetSet: String
[Nullable] get() = ""
[Nullable] set(v) {}
val nullableValWithGet: String?
[NotNull] get() = ""
var nullableVarWithGetSet: String?
[NotNull] get() = ""
[NotNull] set(v) {}
}
@@ -0,0 +1,4 @@
public final class ClassWithConstructor implements jet.JetObject {
@org.jetbrains.annotations.NotNull
public ClassWithConstructor(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "nullable", type = "?") java.lang.String p, @org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "notNull") java.lang.String p1) { /* compiled code */ }
}
@@ -0,0 +1,4 @@
class ClassWithConstructor(
nullable: String?,
notNull: String
)
@@ -0,0 +1,15 @@
public final class ClassWithConstructorAndProperties implements jet.JetObject {
@org.jetbrains.annotations.Nullable
private final java.lang.String nullable;
@org.jetbrains.annotations.NotNull
private final java.lang.String notNull;
@org.jetbrains.annotations.Nullable
public final java.lang.String getNullable() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public final java.lang.String getNotNull() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public ClassWithConstructorAndProperties(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "nullable", type = "?") java.lang.String p, @org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "notNull") java.lang.String p1) { /* compiled code */ }
}
@@ -0,0 +1,4 @@
class ClassWithConstructorAndProperties(
val nullable: String?,
val notNull: String
)
@@ -0,0 +1,39 @@
public interface Trait extends jet.JetObject {
@org.jetbrains.annotations.NotNull
java.lang.String notNull(@org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "a") java.lang.String p);
@org.jetbrains.annotations.Nullable
java.lang.String nullable(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "a", type = "?") java.lang.String p);
@org.jetbrains.annotations.NotNull
java.lang.String notNullWithNN();
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
java.lang.String notNullWithN();
@org.jetbrains.annotations.Nullable
java.lang.String nullableWithN();
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
java.lang.String nullableWithNN();
@org.jetbrains.annotations.Nullable
java.lang.String getNullableVal();
@org.jetbrains.annotations.Nullable
java.lang.String getNullableVar();
@org.jetbrains.annotations.NotNull
void setNullableVar(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "<set-?>", type = "?") java.lang.String p);
@org.jetbrains.annotations.NotNull
java.lang.String getNotNullVal();
@org.jetbrains.annotations.NotNull
java.lang.String getNotNullVar();
@org.jetbrains.annotations.NotNull
void setNotNullVar(@org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "<set-?>") java.lang.String p);
}
@@ -0,0 +1,18 @@
import org.jetbrains.annotations.NotNull
import org.jetbrains.annotations.Nullable
trait Trait {
fun notNull(a: String): String
fun nullable(a: String?): String?
NotNull fun notNullWithNN(): String
Nullable fun notNullWithN(): String
Nullable fun nullableWithN(): String?
NotNull fun nullableWithNN(): String?
val nullableVal: String?
var nullableVar: String?
val notNullVal: String
var notNullVar: String
}
@@ -0,0 +1,62 @@
public final class _DefaultPackage {
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNull(@org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "a") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullable(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "a", type = "?") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNullWithNN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNullWithN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullableWithN() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public static final java.lang.String nullableWithNN() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableVal() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableVar() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static final void setNullableVar(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "<set-?>", type = "?") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullVal() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullVar() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static final void setNotNullVar(@org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "<set-?>") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullValWithGet() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public static final java.lang.String getNotNullVarWithGetSet() { /* compiled code */ }
@org.jetbrains.annotations.Nullable
@org.jetbrains.annotations.NotNull
public static final void setNotNullVarWithGetSet(@org.jetbrains.annotations.NotNull @jet.runtime.typeinfo.JetValueParameter(name = "v") java.lang.String p) { /* compiled code */ }
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableValWithGet() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
@org.jetbrains.annotations.Nullable
public static final java.lang.String getNullableVarWithGetSet() { /* compiled code */ }
@org.jetbrains.annotations.NotNull
public static final void setNullableVarWithGetSet(@org.jetbrains.annotations.Nullable @jet.runtime.typeinfo.JetValueParameter(name = "v", type = "?") java.lang.String p) { /* compiled code */ }
}
@@ -0,0 +1,30 @@
import org.jetbrains.annotations.NotNull
import org.jetbrains.annotations.Nullable
fun notNull(a: String): String = ""
fun nullable(a: String?): String? = ""
NotNull fun notNullWithNN(): String = ""
Nullable fun notNullWithN(): String = ""
Nullable fun nullableWithN(): String? = ""
NotNull fun nullableWithNN(): String? = ""
val nullableVal: String? = ""
var nullableVar: String? = ""
val notNullVal: String = ""
var notNullVar: String = ""
val notNullValWithGet: String
[Nullable] get() = ""
var notNullVarWithGetSet: String
[Nullable] get() = ""
[Nullable] set(v) {}
val nullableValWithGet: String?
[NotNull] get() = ""
var nullableVarWithGetSet: String?
[NotNull] get() = ""
[NotNull] set(v) {}