Skip to content

Commit

Permalink
expand array for java default array values.
Browse files Browse the repository at this point in the history
(cherry picked from commit 6760276)
  • Loading branch information
neetopia authored and KSP Auto Pick committed Jul 20, 2023
1 parent fc5536f commit 5625c5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions test-utils/testData/api/annotationWithDefaultValues.kt
Expand Up @@ -18,14 +18,14 @@
// TEST PROCESSOR: AnnotationDefaultValuesProcessor
// EXPECTED:
// KotlinAnnotation -> b:default,kClassValue:Array<Array<InnerObj>>,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<Array<InnerObj>>,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
Expand Down

0 comments on commit 5625c5c

Please sign in to comment.