jean
@Target(AnnotationTarget.PROPERTY) @Retention(AnnotationRetention.SOURCE) annotation class MyAnnotation(val myArgument: Boolean = false) ... @MyAnnotation val someVariable1: String @MyAnnotation(myArgument = true) val someVariable2: String ...
null
false
val argumentValue = someVariable.annotations.first().arguments logger.warn("${someVariable.simpleName.asString()} argumentValue: $argumentValue"") ... w: [ksp] someVariable1 argumentValue: [myArgument:null] w: [ksp] someVariable2 argumentValue: [myArgument:true]
Ting-Yuan Huang
Jiaxiang
kotlinVersion=1.8.0 kspVersion=1.8.0-1.0.8
A modern programming language that makes developers happier.