diff --git a/compiler/testData/loadJava/compiledJava/annotations/AnnotationInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/AnnotationInParam.txt index 44effe288a5..3976db561e3 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/AnnotationInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/AnnotationInParam.txt @@ -6,7 +6,7 @@ public trait AnnotationInParam : java.lang.Object { public constructor A() } - test.AnnotationInParam.MyAnnotationWithParam2(value = test.AnnotationInParam.MyAnnotation2(value = {"test", "test2"}: jet.Array?): test.AnnotationInParam.MyAnnotation2) public open class B : java.lang.Object { + test.AnnotationInParam.MyAnnotationWithParam2(value = test.AnnotationInParam.MyAnnotation2(value = {"test", "test2"}: jet.Array): test.AnnotationInParam.MyAnnotation2) public open class B : java.lang.Object { public constructor B() } @@ -15,33 +15,33 @@ public trait AnnotationInParam : java.lang.Object { } public final annotation class MyAnnotation : jet.Annotation { - public constructor MyAnnotation(/*0*/ value: jet.String?) + public constructor MyAnnotation(/*0*/ value: jet.String) public abstract fun value(): jet.String? } public final annotation class MyAnnotation2 : jet.Annotation { - public constructor MyAnnotation2(/*0*/ vararg value: jet.String? /*jet.Array?*/) + public constructor MyAnnotation2(/*0*/ vararg value: jet.String /*jet.Array*/) public abstract fun value(): jet.Array? } public final annotation class MyAnnotation3 : jet.Annotation { - public constructor MyAnnotation3(/*0*/ first: jet.String?, /*1*/ second: jet.String?) + public constructor MyAnnotation3(/*0*/ first: jet.String, /*1*/ second: jet.String) public abstract fun first(): jet.String? public abstract fun second(): jet.String? } public final annotation class MyAnnotationWithParam : jet.Annotation { - public constructor MyAnnotationWithParam(/*0*/ value: test.AnnotationInParam.MyAnnotation?) + public constructor MyAnnotationWithParam(/*0*/ value: test.AnnotationInParam.MyAnnotation) public abstract fun value(): test.AnnotationInParam.MyAnnotation? } public final annotation class MyAnnotationWithParam2 : jet.Annotation { - public constructor MyAnnotationWithParam2(/*0*/ value: test.AnnotationInParam.MyAnnotation2?) + public constructor MyAnnotationWithParam2(/*0*/ value: test.AnnotationInParam.MyAnnotation2) public abstract fun value(): test.AnnotationInParam.MyAnnotation2? } public final annotation class MyAnnotationWithParam3 : jet.Annotation { - public constructor MyAnnotationWithParam3(/*0*/ value: test.AnnotationInParam.MyAnnotation3?) + public constructor MyAnnotationWithParam3(/*0*/ value: test.AnnotationInParam.MyAnnotation3) public abstract fun value(): test.AnnotationInParam.MyAnnotation3? } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/ArrayOfEnumInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/ArrayOfEnumInParam.txt index 8b6dc54b433..35e8becb4bf 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ArrayOfEnumInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ArrayOfEnumInParam.txt @@ -2,8 +2,8 @@ package test public trait ArrayOfEnumInParam : java.lang.Object { - java.lang.annotation.Target(value = {ElementType.FIELD, ElementType.CONSTRUCTOR}: jet.Array?) public final annotation class targetAnnotation : jet.Annotation { - public constructor targetAnnotation(/*0*/ value: jet.String?) + java.lang.annotation.Target(value = {ElementType.FIELD, ElementType.CONSTRUCTOR}: jet.Array) public final annotation class targetAnnotation : jet.Annotation { + public constructor targetAnnotation(/*0*/ value: jet.String) public abstract fun value(): jet.String? } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/ArrayOfStringInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/ArrayOfStringInParam.txt index d50a1f0ac57..e0f9c77df10 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ArrayOfStringInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ArrayOfStringInParam.txt @@ -2,12 +2,12 @@ package test public trait ArrayOfStringInParam : java.lang.Object { - test.ArrayOfStringInParam.MyAnnotation(value = {"a", "b", "c"}: jet.Array?) public open class A : java.lang.Object { + test.ArrayOfStringInParam.MyAnnotation(value = {"a", "b", "c"}: jet.Array) public open class A : java.lang.Object { public constructor A() } public final annotation class MyAnnotation : jet.Annotation { - public constructor MyAnnotation(/*0*/ vararg value: jet.String? /*jet.Array?*/) + public constructor MyAnnotation(/*0*/ vararg value: jet.String /*jet.Array*/) public abstract fun value(): jet.Array? } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.txt index eba69ed1e98..c2f946e5914 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.txt @@ -4,11 +4,11 @@ public open class ClassObjectArrayInParam : java.lang.Object { public constructor ClassObjectArrayInParam() public final annotation class Anno : jet.Annotation { - public constructor Anno(/*0*/ vararg value: java.lang.Class? /*jet.Array>?*/) + public constructor Anno(/*0*/ vararg value: java.lang.Class /*jet.Array>*/) public abstract fun value(): jet.Array>? } - test.ClassObjectArrayInParam.Anno(value = {test.ClassObjectArrayInParam?.class, test.ClassObjectArrayInParam.Nested?.class, jet.String?.class}: jet.Array>?) public open class Nested : java.lang.Object { + test.ClassObjectArrayInParam.Anno(value = {test.ClassObjectArrayInParam?.class, test.ClassObjectArrayInParam.Nested?.class, jet.String?.class}: jet.Array>) public open class Nested : java.lang.Object { public constructor Nested() } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectInParam.txt index a01a7e9f9f6..dcf86fa8676 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectInParam.txt @@ -4,7 +4,7 @@ public open class ClassObjectInParam : java.lang.Object { public constructor ClassObjectInParam() public final annotation class Anno : jet.Annotation { - public constructor Anno(/*0*/ value: java.lang.Class?) + public constructor Anno(/*0*/ value: java.lang.Class) public abstract fun value(): java.lang.Class? } diff --git a/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.txt b/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.txt index b0417b33b7b..d38a1d55cdc 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.txt @@ -3,7 +3,7 @@ package test public trait CustomAnnotation : java.lang.Object { public final annotation class MyAnnotation : jet.Annotation { - public constructor MyAnnotation(/*0*/ value: test.CustomAnnotation.MyEnum?) + public constructor MyAnnotation(/*0*/ value: test.CustomAnnotation.MyEnum) public abstract fun value(): test.CustomAnnotation.MyEnum? } diff --git a/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotationWithDefaultParameter.txt b/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotationWithDefaultParameter.txt index b32b11af70d..ac2c0738291 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotationWithDefaultParameter.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotationWithDefaultParameter.txt @@ -3,7 +3,7 @@ package test public trait CustomAnnotationWithDefaultParameter : java.lang.Object { public final annotation class MyAnnotation : jet.Annotation { - public constructor MyAnnotation(/*0*/ first: jet.String?, /*1*/ second: jet.String? = ...) + public constructor MyAnnotation(/*0*/ first: jet.String, /*1*/ second: jet.String = ...) public abstract fun first(): jet.String? public abstract fun second(): jet.String? } diff --git a/compiler/testData/loadJava/compiledJava/annotations/EmptyArrayInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/EmptyArrayInParam.txt index 47c6165af2a..a9000014ab8 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/EmptyArrayInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/EmptyArrayInParam.txt @@ -2,12 +2,12 @@ package test public trait EmptyArrayInParam : java.lang.Object { - test.EmptyArrayInParam.MyAnnotation(value = {}: jet.Array?) public open class A : java.lang.Object { + test.EmptyArrayInParam.MyAnnotation(value = {}: jet.Array) public open class A : java.lang.Object { public constructor A() } public final annotation class MyAnnotation : jet.Annotation { - public constructor MyAnnotation(/*0*/ vararg value: jet.String? /*jet.Array?*/) + public constructor MyAnnotation(/*0*/ vararg value: jet.String /*jet.Array*/) public abstract fun value(): jet.Array? } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/EnumInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/EnumInParam.txt index 3f39ab7cacb..d5bd15c9dce 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/EnumInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/EnumInParam.txt @@ -3,7 +3,7 @@ package test public trait EnumInParam : java.lang.Object { java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) public final annotation class RetentionAnnotation : jet.Annotation { - public constructor RetentionAnnotation(/*0*/ value: jet.String?) + public constructor RetentionAnnotation(/*0*/ value: jet.String) public abstract fun value(): jet.String? } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/PrimitiveValueInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/PrimitiveValueInParam.txt index f0c5964e2a1..4baa3a0751e 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/PrimitiveValueInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/PrimitiveValueInParam.txt @@ -7,7 +7,7 @@ public trait PrimitiveValueInParam : java.lang.Object { } public final annotation class Ann : jet.Annotation { - public constructor Ann(/*0*/ i: jet.Int, /*1*/ l: jet.Long, /*2*/ d: jet.Double, /*3*/ f: jet.Float, /*4*/ bool: jet.Boolean, /*5*/ str: jet.String?) + public constructor Ann(/*0*/ i: jet.Int, /*1*/ l: jet.Long, /*2*/ d: jet.Double, /*3*/ f: jet.Float, /*4*/ bool: jet.Boolean, /*5*/ str: jet.String) public abstract fun bool(): jet.Boolean public abstract fun d(): jet.Double public abstract fun f(): jet.Float diff --git a/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation.txt b/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation.txt index a53e5e7d39b..29bc5d2fe31 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation.txt @@ -3,12 +3,12 @@ package test public trait RecursiveAnnotation : java.lang.Object { test.RecursiveAnnotation.B(value = test.RecursiveAnnotation.A(value = "test": jet.String): test.RecursiveAnnotation.A) public final annotation class A : jet.Annotation { - public constructor A(/*0*/ value: jet.String?) + public constructor A(/*0*/ value: jet.String) public abstract fun value(): jet.String? } test.RecursiveAnnotation.B(value = test.RecursiveAnnotation.A(value = "test": jet.String): test.RecursiveAnnotation.A) public final annotation class B : jet.Annotation { - public constructor B(/*0*/ value: test.RecursiveAnnotation.A?) + public constructor B(/*0*/ value: test.RecursiveAnnotation.A) public abstract fun value(): test.RecursiveAnnotation.A? } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation2.txt b/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation2.txt index 9545547d1f9..bdf8b44cf50 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation2.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation2.txt @@ -3,12 +3,12 @@ package test public trait RecursiveAnnotation2 : java.lang.Object { public final annotation class A : jet.Annotation { - public constructor A(/*0*/ value: test.RecursiveAnnotation2.B?) + public constructor A(/*0*/ value: test.RecursiveAnnotation2.B) public abstract fun value(): test.RecursiveAnnotation2.B? } test.RecursiveAnnotation2.A(value = test.RecursiveAnnotation2.B(value = "test": jet.String): test.RecursiveAnnotation2.B) public final annotation class B : jet.Annotation { - public constructor B(/*0*/ value: jet.String?) + public constructor B(/*0*/ value: jet.String) public abstract fun value(): jet.String? } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/StringConcatenationInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/StringConcatenationInParam.txt index 10b7fbe9ca3..abb61d28c7b 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/StringConcatenationInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/StringConcatenationInParam.txt @@ -3,7 +3,7 @@ package test public trait StringConcatenationInParam : java.lang.Object { public final annotation class Anno : jet.Annotation { - public constructor Anno(/*0*/ value: jet.String?) + public constructor Anno(/*0*/ value: jet.String) public abstract fun value(): jet.String? } diff --git a/compiler/testData/loadJava/compiledJava/annotations/StringConstantInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/StringConstantInParam.txt index ed12cd2228b..3678a910f72 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/StringConstantInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/StringConstantInParam.txt @@ -3,7 +3,7 @@ package test public trait StringConstantInParam : java.lang.Object { public final annotation class Anno : jet.Annotation { - public constructor Anno(/*0*/ value: jet.String?) + public constructor Anno(/*0*/ value: jet.String) public abstract fun value(): jet.String? } diff --git a/compiler/testData/loadJava/compiledJava/annotations/StringInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/StringInParam.txt index 95687c3c18c..fb561e152b2 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/StringInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/StringInParam.txt @@ -3,7 +3,7 @@ package test public trait StringInParam : java.lang.Object { public final annotation class Anno : jet.Annotation { - public constructor Anno(/*0*/ value: jet.String?) + public constructor Anno(/*0*/ value: jet.String) public abstract fun value(): jet.String? } diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaConstructorResolver.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaConstructorResolver.java index 64eb66f4244..376055c6020 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaConstructorResolver.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaConstructorResolver.java @@ -28,6 +28,7 @@ import org.jetbrains.jet.lang.resolve.java.structure.JavaClass; import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod; import org.jetbrains.jet.lang.resolve.java.structure.JavaType; import org.jetbrains.jet.lang.types.JetType; +import org.jetbrains.jet.lang.types.TypeUtils; import javax.inject.Inject; import java.util.*; @@ -159,9 +160,10 @@ public final class JavaConstructorResolver { index, Collections.emptyList(), method.getName(), - typeTransformer.transformToType(returnType, typeVariableResolver), + // Parameters of annotation constructors in Java are never nullable + TypeUtils.makeNotNullable(typeTransformer.transformToType(returnType, typeVariableResolver)), method.hasAnnotationParameterDefaultValue(), - varargElementType)); + varargElementType == null ? null : TypeUtils.makeNotNullable(varargElementType))); index++; }