A Kotlin compiler plugin that annotates Kotlin-generated methods with
lombok.Generated
to signify to code analyzers that these methods have been
generated by the compiler.
Please note that JaCoCo landed support for recognizing Kotlin-generated
code in 0.8.2, so we advise using that instead if possible.
It has the advantage of not polluting your code with lombok.Generated
annotations.
In Gradle, you can do that as follows:
jacoco {
toolVersion = '0.8.2'
}
To use the plugin, just apply the plugin in your build.gradle
:
plugins {
id 'nl.fabianm.kotlin.plugin.generated' version '1.5.0'
}
Make sure you install the version that is compatible with the Kotlin version you are using:
Kotlin | Plugin |
---|---|
1.2.* | 1.0 |
1.3.0+ | 1.3.3 |
1.3.50+ | 1.4.0 |
1.3.61+ | 1.5.0 |
You can optionally configure the plugin as shown below:
kotlinGenerated {
// The annotation to annotate the generated methods with
annotation = "lombok.Generated"
// A flag to indicate whether the annotation should be visibile at runtime
visible = true
}
To be able to use projects utilizing this plugin within IntelliJ IDEA,
you need to install the IntelliJ plugin (see #4 for more information). You can find the plugin on the
Releases page, labeled plugin-idea-*.zip
To use the plugin from the command line, invoke kotlinc
using the
following command line arguments:
kotlinc -Xplugin="<path-to-plugin-compiler.jar>" -P plugin:nl.fabianm.kotlin.plugin.generated:annotation="lombok.Generated" -P plugin:nl.fabianm.kotlin.plugin.generated:visible=true ...
The code is released under the Apache version 2.0 license. See the LICENSE.txt file.