https://kotlinlang.org logo
Title
b

Ben Tilford

09/22/2021, 5:07 PM
Is it possible to compose or extend annotations in kotlin? In java you could add an annotation as a property like
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface SuperAnnotation {
    String value();
}

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface SubAnnotation {
    SuperAnnotation superAnnotation();
    String subValue();
}
h

hho

09/22/2021, 5:31 PM
Not sure what you wanna do, but I think it translates pretty much 1:1 – annotations can have other annotations as parameters.
b

Ben Tilford

09/22/2021, 5:35 PM
👍
I think I got tripped up on constructor params vs default values