diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSAnnotationDescriptorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSAnnotationDescriptorImpl.kt index 1aff270135..ea99447b49 100644 --- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSAnnotationDescriptorImpl.kt +++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSAnnotationDescriptorImpl.kt @@ -354,7 +354,7 @@ fun ValueParameterDescriptor.getDefaultValue(ownerAnnotation: KSAnnotation): Any } }.toList(), this.type - ) + ).toValue(ownerAnnotation) else -> JavaPsiFacade.getInstance(psi.project).constantEvaluationHelper .computeConstantExpression((psi).defaultValue).let { if (it is PsiType) { diff --git a/test-utils/testData/api/annotationWithDefaultValues.kt b/test-utils/testData/api/annotationWithDefaultValues.kt index 2a31d51c73..338f34b2cd 100644 --- a/test-utils/testData/api/annotationWithDefaultValues.kt +++ b/test-utils/testData/api/annotationWithDefaultValues.kt @@ -18,14 +18,14 @@ // TEST PROCESSOR: AnnotationDefaultValuesProcessor // EXPECTED: // KotlinAnnotation -> b:default,kClassValue:Array>,topLevelProp:foo,companionProp:companion -// JavaAnnotation -> withDefaultValue:OK,stringArrayParam:["3", "5", "7"],typeVal:HashMap<*, *>,nested:@Nested +// JavaAnnotation -> withDefaultValue:OK,stringArrayParam:[3, 5, 7],typeVal:HashMap<*, *>,nested:@Nested // JavaAnnotation2 -> x:x-default,y:y-default,z:z-default // KotlinAnnotation2 -> y:y-default,z:z-default,kotlinEnumVal:VALUE_1 // KotlinAnnotationLib -> b:defaultInLib,kClassValue:OtherKotlinAnnotation,topLevelProp:bar // JavaAnnotationWithDefaults -> stringVal:foo,stringArrayVal:[x, y],typeVal:HashMap<*, *>,typeArrayVal:[LinkedHashMap<*, *>],intVal:3,intArrayVal:[1, 3, 5],enumVal:JavaEnum.DEFAULT,enumArrayVal:[JavaEnum.VAL1, JavaEnum.VAL2],localEnumVal:JavaAnnotationWithDefaults.LocalEnum.LOCAL1,otherAnnotationVal:@OtherAnnotation,otherAnnotationArrayVal:[@OtherAnnotation],kotlinAnnotationLibVal:@OtherKotlinAnnotation // KotlinAnnotationWithDefaults -> stringVal:foo,stringArrayVal:[x, y],typeVal:HashMap<*, *>,typeArrayVal:[LinkedHashMap<*, *>],intVal:3,intArrayVal:[1, 3, 5],enumVal:JavaEnum.DEFAULT,enumArrayVal:[JavaEnum.VAL1, JavaEnum.VAL2],otherAnnotationVal:@OtherAnnotation,otherAnnotationArrayVal:[@OtherAnnotation],kotlinAnnotationLibVal:@OtherKotlinAnnotation // KotlinAnnotation -> b:default,kClassValue:Array>,topLevelProp:foo,companionProp:companion -// JavaAnnotation -> withDefaultValue:OK,stringArrayParam:["3", "5", "7"],typeVal:HashMap<*, *>,nested:@Nested +// JavaAnnotation -> withDefaultValue:OK,stringArrayParam:[3, 5, 7],typeVal:HashMap<*, *>,nested:@Nested // JavaAnnotation2 -> x:x-default,y:y-default,z:z-default // KotlinAnnotation2 -> y:y-default,z:z-default,kotlinEnumVal:VALUE_1 // END