Annotation in M13

I'm using IDEA 14.1.4 and both Kotlin 0.13.1513 and 0.13.1514 to test this.

This is from documentation:

@Target([AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION]) @Retention(AnnotationRetention.SOURCE) @MustBeDocumented public annotation class Fancy

Error:  CLASS is not annotation class

It should be without bracket since it’s a vararg:

@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)

And then also from the documentation, using annotation with Lamda:

val f = @Suspendable { Fiber.sleep(10) }

Error: This annotation is not applicable to target 'expression'

That @Suspendable is from Java, how do I add @Target to existing annotation from Java?

Is that mean that it must be changed directly from the source code who has the interface?

The documentation for declaring the annotation targets indeed has an error, we'll correct this.

Changing the targets of a Java annotation is not possible. However, we will allow applying annotations targeting methods (including @Suspendable) to lambdas in M14.

Hi,

an user has recently opened an issue about that in Quasar (and has found this thread). Is it certain that method-bound Java annotations will be allowed for lambdas in M14 and is there any (even rough) timeframe?

Thanks!

– Fabio

The issue is fixed in this commit: https://github.com/JetBrains/kotlin/commit/dd4601fd0849c736007c33445bbe3059beda1e4a M14 is coming out next week.