Make vararg argument of java annotation have 'out' type

This commit is contained in:
Svetlana Isakova
2014-12-25 17:13:57 +03:00
parent d1556331ef
commit d2becce1ac
15 changed files with 94 additions and 46 deletions
@@ -257,13 +257,7 @@ public class AnnotationResolver {
}
});
JetType arrayType = KotlinBuiltIns.getInstance().getPrimitiveArrayJetTypeByPrimitiveJetType(varargElementType);
if (arrayType == null) {
arrayType = KotlinBuiltIns.getInstance().getArrayType(OUT_VARIANCE, varargElementType);
}
//todo use parameterDescriptor.getType() instead of arrayType
return new ArrayValue(constants, arrayType, true, usesVariableAsConstant);
return new ArrayValue(constants, parameterDescriptor.getType(), true, usesVariableAsConstant);
}
else {
// we should actually get only one element, but just in case of getting many, we take the last one
@@ -7381,7 +7381,7 @@ package java {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Deprecated : kotlin.Annotation {
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Deprecated : kotlin.Annotation {
public constructor Deprecated()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -7870,7 +7870,7 @@ package java {
private open fun registerNatives(): kotlin.Unit
}
java.lang.annotation.Target(value = {ElementType.METHOD}: kotlin.Array<java.lang.annotation.ElementType>) java.lang.annotation.Retention(value = RetentionPolicy.SOURCE: java.lang.annotation.RetentionPolicy) public final annotation class Override : kotlin.Annotation {
java.lang.annotation.Target(value = {ElementType.METHOD}: kotlin.Array<out java.lang.annotation.ElementType>) java.lang.annotation.Retention(value = RetentionPolicy.SOURCE: java.lang.annotation.RetentionPolicy) public final annotation class Override : kotlin.Annotation {
public constructor Override()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -8202,8 +8202,8 @@ package java {
public/*package*/ final val serialVersionUID: kotlin.Long = 4383685877147921099.toLong()
}
java.lang.annotation.Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE}: kotlin.Array<java.lang.annotation.ElementType>) java.lang.annotation.Retention(value = RetentionPolicy.SOURCE: java.lang.annotation.RetentionPolicy) public final annotation class SuppressWarnings : kotlin.Annotation {
public constructor SuppressWarnings(/*0*/ vararg value: kotlin.String /*kotlin.Array<kotlin.String>*/)
java.lang.annotation.Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE}: kotlin.Array<out java.lang.annotation.ElementType>) java.lang.annotation.Retention(value = RetentionPolicy.SOURCE: java.lang.annotation.RetentionPolicy) public final annotation class SuppressWarnings : kotlin.Annotation {
public constructor SuppressWarnings(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -8747,7 +8747,7 @@ package java {
private final val serialVersionUID: kotlin.Long = 8125925355765570191.toLong()
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Documented : kotlin.Annotation {
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Documented : kotlin.Annotation {
public constructor Documented()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -8945,14 +8945,14 @@ package java {
private final val serialVersionUID: kotlin.Long = 8445097402741811912.toLong()
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Inherited : kotlin.Annotation {
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Inherited : kotlin.Annotation {
public constructor Inherited()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Retention : kotlin.Annotation {
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Retention : kotlin.Annotation {
public constructor Retention(/*0*/ value: java.lang.annotation.RetentionPolicy)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -9034,8 +9034,8 @@ package java {
public final /*synthesized*/ fun values(): kotlin.Array<java.lang.annotation.RetentionPolicy>
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Target : kotlin.Annotation {
public constructor Target(/*0*/ vararg value: java.lang.annotation.ElementType /*kotlin.Array<java.lang.annotation.ElementType>*/)
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Target : kotlin.Annotation {
public constructor Target(/*0*/ vararg value: java.lang.annotation.ElementType /*kotlin.Array<out java.lang.annotation.ElementType>*/)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -7386,7 +7386,7 @@ package java {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Deprecated : kotlin.Annotation {
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Deprecated : kotlin.Annotation {
public constructor Deprecated()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -7875,7 +7875,7 @@ package java {
private open fun registerNatives(): kotlin.Unit
}
java.lang.annotation.Target(value = {ElementType.METHOD}: kotlin.Array<java.lang.annotation.ElementType>) java.lang.annotation.Retention(value = RetentionPolicy.SOURCE: java.lang.annotation.RetentionPolicy) public final annotation class Override : kotlin.Annotation {
java.lang.annotation.Target(value = {ElementType.METHOD}: kotlin.Array<out java.lang.annotation.ElementType>) java.lang.annotation.Retention(value = RetentionPolicy.SOURCE: java.lang.annotation.RetentionPolicy) public final annotation class Override : kotlin.Annotation {
public constructor Override()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -8207,8 +8207,8 @@ package java {
public/*package*/ final val serialVersionUID: kotlin.Long = 4383685877147921099.toLong()
}
java.lang.annotation.Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE}: kotlin.Array<java.lang.annotation.ElementType>) java.lang.annotation.Retention(value = RetentionPolicy.SOURCE: java.lang.annotation.RetentionPolicy) public final annotation class SuppressWarnings : kotlin.Annotation {
public constructor SuppressWarnings(/*0*/ vararg value: kotlin.String /*kotlin.Array<kotlin.String>*/)
java.lang.annotation.Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE}: kotlin.Array<out java.lang.annotation.ElementType>) java.lang.annotation.Retention(value = RetentionPolicy.SOURCE: java.lang.annotation.RetentionPolicy) public final annotation class SuppressWarnings : kotlin.Annotation {
public constructor SuppressWarnings(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -8752,7 +8752,7 @@ package java {
private final val serialVersionUID: kotlin.Long = 8125925355765570191.toLong()
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Documented : kotlin.Annotation {
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Documented : kotlin.Annotation {
public constructor Documented()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -8950,14 +8950,14 @@ package java {
private final val serialVersionUID: kotlin.Long = 8445097402741811912.toLong()
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Inherited : kotlin.Annotation {
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Inherited : kotlin.Annotation {
public constructor Inherited()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Retention : kotlin.Annotation {
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Retention : kotlin.Annotation {
public constructor Retention(/*0*/ value: java.lang.annotation.RetentionPolicy)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -9039,8 +9039,8 @@ package java {
public final /*synthesized*/ fun values(): kotlin.Array<java.lang.annotation.RetentionPolicy>
}
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class Target : kotlin.Annotation {
public constructor Target(/*0*/ vararg value: java.lang.annotation.ElementType /*kotlin.Array<java.lang.annotation.ElementType>*/)
java.lang.annotation.Documented() java.lang.annotation.Retention(value = RetentionPolicy.RUNTIME: java.lang.annotation.RetentionPolicy) java.lang.annotation.Target(value = {ElementType.ANNOTATION_TYPE}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class Target : kotlin.Annotation {
public constructor Target(/*0*/ vararg value: java.lang.annotation.ElementType /*kotlin.Array<out java.lang.annotation.ElementType>*/)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -0,0 +1,9 @@
// FILE: A.java
public @interface A {
String[] arg();
}
// FILE: b.kt
[A(*<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH(kotlin.Array<out kotlin.String>; IGNORE)!>array<!>(1, "b"))]
fun test() {
}
@@ -0,0 +1,11 @@
package
A(arg = {IntegerValueType(1), "b"}: kotlin.Array<???>) internal fun test(): kotlin.Unit
public final annotation class A : kotlin.Annotation {
public constructor A(/*0*/ vararg arg: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public abstract fun arg(): kotlin.Array<kotlin.String>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,5 @@
annotation class B(vararg val args: String)
[B(*<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH(kotlin.Array<out kotlin.String>; IGNORE)!>array<!>(1, "b"))]
fun test() {
}
@@ -0,0 +1,11 @@
package
B(args = {IntegerValueType(1), "b"}: kotlin.Array<???>) internal fun test(): kotlin.Unit
internal final annotation class B : kotlin.Annotation {
public constructor B(/*0*/ vararg args: kotlin.String /*kotlin.Array<out kotlin.String>*/)
internal final val args: kotlin.Array<out kotlin.String>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -6,7 +6,7 @@ public trait AnnotationInParam {
public constructor A()
}
test.AnnotationInParam.MyAnnotationWithParam2(value = test.AnnotationInParam.MyAnnotation2(value = {"test", "test2"}: kotlin.Array<kotlin.String>): test.AnnotationInParam.MyAnnotation2) public open class B {
test.AnnotationInParam.MyAnnotationWithParam2(value = test.AnnotationInParam.MyAnnotation2(value = {"test", "test2"}: kotlin.Array<out kotlin.String>): test.AnnotationInParam.MyAnnotation2) public open class B {
public constructor B()
}
@@ -20,7 +20,7 @@ public trait AnnotationInParam {
}
public final annotation class MyAnnotation2 : kotlin.Annotation {
public constructor MyAnnotation2(/*0*/ vararg value: kotlin.String /*kotlin.Array<kotlin.String>*/)
public constructor MyAnnotation2(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public abstract fun value(): kotlin.Array<kotlin.String>
}
@@ -2,7 +2,7 @@ package test
public trait ArrayOfEnumInParam {
java.lang.annotation.Target(value = {ElementType.FIELD, ElementType.CONSTRUCTOR}: kotlin.Array<java.lang.annotation.ElementType>) public final annotation class targetAnnotation : kotlin.Annotation {
java.lang.annotation.Target(value = {ElementType.FIELD, ElementType.CONSTRUCTOR}: kotlin.Array<out java.lang.annotation.ElementType>) public final annotation class targetAnnotation : kotlin.Annotation {
public constructor targetAnnotation(/*0*/ value: kotlin.String)
public abstract fun value(): kotlin.String
}
@@ -2,12 +2,12 @@ package test
public trait ArrayOfStringInParam {
test.ArrayOfStringInParam.MyAnnotation(value = {"a", "b", "c"}: kotlin.Array<kotlin.String>) public open class A {
test.ArrayOfStringInParam.MyAnnotation(value = {"a", "b", "c"}: kotlin.Array<out kotlin.String>) public open class A {
public constructor A()
}
public final annotation class MyAnnotation : kotlin.Annotation {
public constructor MyAnnotation(/*0*/ vararg value: kotlin.String /*kotlin.Array<kotlin.String>*/)
public constructor MyAnnotation(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public abstract fun value(): kotlin.Array<kotlin.String>
}
}
@@ -4,11 +4,11 @@ public open class ClassObjectArrayInParam {
public constructor ClassObjectArrayInParam()
public final annotation class Anno : kotlin.Annotation {
public constructor Anno(/*0*/ vararg value: java.lang.Class<out kotlin.Any?> /*kotlin.Array<java.lang.Class<out kotlin.Any?>>*/)
public constructor Anno(/*0*/ vararg value: java.lang.Class<out kotlin.Any?> /*kotlin.Array<out java.lang.Class<out kotlin.Any?>>*/)
public abstract fun value(): kotlin.Array<java.lang.Class<out kotlin.Any?>>
}
test.ClassObjectArrayInParam.Anno(value = {test.ClassObjectArrayInParam.class, test.ClassObjectArrayInParam.Nested.class, kotlin.String.class}: kotlin.Array<java.lang.Class<out kotlin.Any?>>) public open class Nested {
test.ClassObjectArrayInParam.Anno(value = {test.ClassObjectArrayInParam.class, test.ClassObjectArrayInParam.Nested.class, kotlin.String.class}: kotlin.Array<out java.lang.Class<out kotlin.Any?>>) public open class Nested {
public constructor Nested()
}
}
@@ -2,12 +2,12 @@ package test
public trait EmptyArrayInParam {
test.EmptyArrayInParam.MyAnnotation(value = {}: kotlin.Array<kotlin.String>) public open class A {
test.EmptyArrayInParam.MyAnnotation(value = {}: kotlin.Array<out kotlin.String>) public open class A {
public constructor A()
}
public final annotation class MyAnnotation : kotlin.Annotation {
public constructor MyAnnotation(/*0*/ vararg value: kotlin.String /*kotlin.Array<kotlin.String>*/)
public constructor MyAnnotation(/*0*/ vararg value: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public abstract fun value(): kotlin.Array<kotlin.String>
}
}
@@ -3,10 +3,10 @@ package test
public /*synthesized*/ fun NullInAnnotation(/*0*/ function: () -> kotlin.Unit): test.NullInAnnotation
public trait NullInAnnotation {
test.NullInAnnotation.Ann(a = null: kotlin.Nothing?, b = {null}: kotlin.Array<kotlin.String>) public abstract fun foo(): kotlin.Unit
test.NullInAnnotation.Ann(a = null: kotlin.Nothing?, b = {null}: kotlin.Array<out kotlin.String>) public abstract fun foo(): kotlin.Unit
public final annotation class Ann : kotlin.Annotation {
public constructor Ann(/*0*/ a: kotlin.String, /*1*/ vararg b: kotlin.String /*kotlin.Array<kotlin.String>*/)
public constructor Ann(/*0*/ a: kotlin.String, /*1*/ vararg b: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public abstract fun a(): kotlin.String
public abstract fun b(): kotlin.Array<kotlin.String>
}
@@ -39,7 +39,7 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
@TestDataPath("$PROJECT_ROOT")
@InnerTestClasses({Annotations.AnnotationApplicability.class, Annotations.AnnotationParameterMustBeConstant.class, Annotations.PlatformStatic.class})
@InnerTestClasses({Annotations.AnnotationApplicability.class, Annotations.AnnotationParameterMustBeConstant.class, Annotations.AnnotationWithVarargParameter.class, Annotations.PlatformStatic.class})
@RunWith(JUnit3RunnerWithInners.class)
public static class Annotations extends AbstractJetDiagnosticsTestWithStdLib {
public void testAllFilesPresentInAnnotations() throws Exception {
@@ -112,6 +112,27 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class AnnotationWithVarargParameter extends AbstractJetDiagnosticsTestWithStdLib {
public void testAllFilesPresentInAnnotationWithVarargParameter() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("javaAnnotationWithVarargArgument.kt")
public void testJavaAnnotationWithVarargArgument() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/javaAnnotationWithVarargArgument.kt");
doTest(fileName);
}
@TestMetadata("kotlinAnnotationWithVarargArgument.kt")
public void testKotlinAnnotationWithVarargArgument() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/annotationWithVarargParameter/kotlinAnnotationWithVarargArgument.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -171,16 +171,13 @@ public class LazyJavaClassMemberScope(
val jReturnType = method.getReturnType() ?: throw AssertionError("Annotation method has no return type: " + method)
val attr = TypeUsage.MEMBER_SIGNATURE_INVARIANT.toAttributes(allowFlexible = false)
val varargElementType =
if (index == methods.size() - 1 && jReturnType is JavaArrayType) {
c.typeResolver.transformJavaType(
jReturnType.getComponentType(),
attr
)
}
else null
val returnType = c.typeResolver.transformJavaType(jReturnType, attr)
val (returnType, varargElementType) =
if (index == methods.size() - 1 && jReturnType is JavaArrayType)
Pair(c.typeResolver.transformArrayType(jReturnType, attr, isVararg = true),
c.typeResolver.transformJavaType(jReturnType.getComponentType(), attr))
else
Pair(c.typeResolver.transformJavaType(jReturnType, attr), null)
result.add(ValueParameterDescriptorImpl(
constructor,