Open
Description
I want to generate a data object from a kotlin class (Author), but it generates an error that I could not solve
Could not generate element for org.vult.services.Author: null
I think it may be because when generating the kotlin stub add annotations to the attributes and thus error in the generation of the converter.
EJ. @org.jetbrains.annotations.NotNull()
it is possible to generate from a kotlin class or is there an example?
This is my Gradle.Script
buildscript{
ext.kotlin_version = '1.1.3-2'
ext.shadow_version = '2.0.1'
repositories{
jcenter()
}
dependencies{
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.github.jengelman.gradle.plugins:shadow:$shadow_version"
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.github.johnrengelman.shadow'
ext.vertx_version = '3.4.2'
repositories {
jcenter()
}
dependencies {
implementation "io.vertx:vertx-core:$vertx_version"
implementation "io.vertx:vertx-web-client:$vertx_version"
implementation "io.vertx:vertx-rx-java:$vertx_version"
implementation "io.vertx:vertx-service-proxy:$vertx_version"
implementation "io.vertx:vertx-codegen:$vertx_version"
implementation "io.vertx:vertx-lang-kotlin:$vertx_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains:annotations:13.0"
kapt "io.vertx:vertx-service-proxy:$vertx_version:processor"
testImplementation 'junit:junit:4.12'
}
compileKotlin{
kotlinOptions.jvmTarget = "1.8"
}
kapt{
}
sourceSets {
main.java.srcDirs += [file("$buildDir/generated/source/kapt/main")]
}
Author.kt
@DataObject(generateConverter = true)
class Author(){
lateinit var name:String
lateinit var email:String
constructor(json:JsonObject?):this(){}
fun toJson():JsonObject{
val json = JsonObject()
return json
}
}
thanks