diff --git a/compiler/testData/loadJava/compiledJava/annotations/AnnotationInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/AnnotationInParam.txt index 3976db561e3..bced3df6e83 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/AnnotationInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/AnnotationInParam.txt @@ -16,32 +16,32 @@ public trait AnnotationInParam : java.lang.Object { public final annotation class MyAnnotation : jet.Annotation { public constructor MyAnnotation(/*0*/ value: jet.String) - public abstract fun 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 abstract fun value(): 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 abstract fun first(): jet.String? - public abstract fun 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 abstract fun 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 abstract fun 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 abstract fun 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 35e8becb4bf..d184d08ed13 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ArrayOfEnumInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ArrayOfEnumInParam.txt @@ -4,6 +4,6 @@ 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) - public abstract fun 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 e0f9c77df10..150934d9142 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ArrayOfStringInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ArrayOfStringInParam.txt @@ -8,6 +8,6 @@ public trait ArrayOfStringInParam : java.lang.Object { public final annotation class MyAnnotation : jet.Annotation { public constructor MyAnnotation(/*0*/ vararg value: jet.String /*jet.Array*/) - public abstract fun value(): 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 c2f946e5914..119797bd856 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectArrayInParam.txt @@ -5,7 +5,7 @@ public open class ClassObjectArrayInParam : java.lang.Object { public final annotation class Anno : jet.Annotation { public constructor Anno(/*0*/ vararg value: java.lang.Class /*jet.Array>*/) - public abstract fun value(): 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 { diff --git a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectInParam.txt index dcf86fa8676..594c0460ef1 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/ClassObjectInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/ClassObjectInParam.txt @@ -5,7 +5,7 @@ public open class ClassObjectInParam : java.lang.Object { public final annotation class Anno : jet.Annotation { public constructor Anno(/*0*/ value: java.lang.Class) - public abstract fun value(): java.lang.Class? + public abstract fun value(): java.lang.Class } test.ClassObjectInParam.Anno(value = test.ClassObjectInParam?.class: java.lang.Class) public open class Nested : java.lang.Object { diff --git a/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.txt b/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.txt index d38a1d55cdc..2b77c5cea21 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.txt @@ -4,7 +4,7 @@ public trait CustomAnnotation : java.lang.Object { public final annotation class MyAnnotation : jet.Annotation { public constructor MyAnnotation(/*0*/ value: test.CustomAnnotation.MyEnum) - public abstract fun value(): test.CustomAnnotation.MyEnum? + public abstract fun value(): test.CustomAnnotation.MyEnum } public final enum class MyEnum : jet.Enum { diff --git a/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotationWithDefaultParameter.txt b/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotationWithDefaultParameter.txt index ac2c0738291..35263561f13 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotationWithDefaultParameter.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/CustomAnnotationWithDefaultParameter.txt @@ -4,8 +4,8 @@ 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 abstract fun first(): jet.String? - public abstract fun second(): jet.String? + public abstract fun first(): jet.String + public abstract fun second(): jet.String } test.CustomAnnotationWithDefaultParameter.MyAnnotation(first = "f": jet.String, second = "s": jet.String) public open class MyTest : java.lang.Object { diff --git a/compiler/testData/loadJava/compiledJava/annotations/EmptyArrayInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/EmptyArrayInParam.txt index a9000014ab8..6291ea4cac1 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/EmptyArrayInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/EmptyArrayInParam.txt @@ -8,6 +8,6 @@ public trait EmptyArrayInParam : java.lang.Object { public final annotation class MyAnnotation : jet.Annotation { public constructor MyAnnotation(/*0*/ vararg value: jet.String /*jet.Array*/) - public abstract fun value(): 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 d5bd15c9dce..6ac491fd4d6 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/EnumInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/EnumInParam.txt @@ -4,6 +4,6 @@ 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 abstract fun 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 4baa3a0751e..c27bae720f0 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/PrimitiveValueInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/PrimitiveValueInParam.txt @@ -13,6 +13,6 @@ public trait PrimitiveValueInParam : java.lang.Object { public abstract fun f(): jet.Float public abstract fun i(): jet.Int public abstract fun l(): jet.Long - public abstract fun str(): jet.String? + public abstract fun str(): jet.String } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation.txt b/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation.txt index 29bc5d2fe31..ac07f0b3d1b 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation.txt @@ -4,11 +4,11 @@ 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 abstract fun 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 abstract fun 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 bdf8b44cf50..bc9d1999c21 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation2.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/RecursiveAnnotation2.txt @@ -4,11 +4,11 @@ public trait RecursiveAnnotation2 : java.lang.Object { public final annotation class A : jet.Annotation { public constructor A(/*0*/ value: test.RecursiveAnnotation2.B) - public abstract fun 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 abstract fun 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 abb61d28c7b..96290ad65eb 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/StringConcatenationInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/StringConcatenationInParam.txt @@ -4,7 +4,7 @@ public trait StringConcatenationInParam : java.lang.Object { public final annotation class Anno : jet.Annotation { public constructor Anno(/*0*/ value: jet.String) - public abstract fun value(): jet.String? + public abstract fun value(): jet.String } test.StringConcatenationInParam.Anno(value = "hello": jet.String) public open class Class : java.lang.Object { diff --git a/compiler/testData/loadJava/compiledJava/annotations/StringConstantInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/StringConstantInParam.txt index 3678a910f72..ed230003b4b 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/StringConstantInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/StringConstantInParam.txt @@ -4,7 +4,7 @@ public trait StringConstantInParam : java.lang.Object { public final annotation class Anno : jet.Annotation { public constructor Anno(/*0*/ value: jet.String) - public abstract fun value(): jet.String? + public abstract fun value(): jet.String } test.StringConstantInParam.Anno(value = "hello": jet.String) public open class Class : java.lang.Object { diff --git a/compiler/testData/loadJava/compiledJava/annotations/StringInParam.txt b/compiler/testData/loadJava/compiledJava/annotations/StringInParam.txt index fb561e152b2..4771271cf64 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/StringInParam.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/StringInParam.txt @@ -4,7 +4,7 @@ public trait StringInParam : java.lang.Object { public final annotation class Anno : jet.Annotation { public constructor Anno(/*0*/ value: jet.String) - public abstract fun value(): jet.String? + public abstract fun value(): jet.String } test.StringInParam.Anno(value = "hello": jet.String) public open class Class : java.lang.Object { diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaFunctionResolver.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaFunctionResolver.java index 9aa31cbc865..cc360fd6edc 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaFunctionResolver.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/JavaFunctionResolver.java @@ -251,7 +251,8 @@ public final class JavaFunctionResolver { : TypeUsage.MEMBER_SIGNATURE_COVARIANT; JetType transformedType = typeTransformer.transformToType(returnType, typeUsage, typeVariableResolver); - if (annotationResolver.hasNotNullAnnotation(method)) { + // Annotation arguments are never null in Java + if (method.getContainingClass().isAnnotationType() || annotationResolver.hasNotNullAnnotation(method)) { return TypeUtils.makeNotNullable(transformedType); } else {