I attempted to write a simple Jersey-based webapp, which requires an annotation on a class of the form
@Path(“/foo”)
When I compile a Kotlin class annotated with this annotation
Path(“/foo”)
class Hello() {
…
}
I got a compile time error
…
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.goldin.plugins:kotlin-maven-plugin:0.2.3.8-beta-6:compile (compile-kotlin-sources) on project jersey-kotlin: Execution compile-kotlin-sources of goal com.goldin.plugins:kotlin-maven-plugin:0.2.3.8-beta-6:compile failed: java.lang.UnsupportedOperationException: Only annotations without values are supported by backend so far -> [Help 1]
[ERROR]
...
Is there a YouTrack issue I can follow to learn when Java annotations with arguments are supported in Kotlin?
I know there is a lot on the plate of the Kotlin language team. But I'm reminded of the guidance the Scala folks give when asked how to get started at work with the language: write some tests with it.
So today in Kotlin with JUnit4 annotations I can do
``
Test
fun testChimp() {
// blah
}
But as I understand it, I cannot do
``
Test(expected = RuntimeException.class)
fun testChimpExectsError() {
// blahblah
}
because annotations with arguments are not yet supported.
So I’m thinking the sooner annotations with arguments are supported, the sooner you can pull in the people who can justify to their managers that they can get started at work with Kotlin by coding some of their unit tests with it.
Is there a Kotlin issue around adding annotation argument support? If yes, I’ll vote for it.
Yeah, I'm really looking forward to getting a feel for what a Jersey webapp looks like coded in Kotlin. And for that you need annotations that take arguments.