Now annotations are resolved with following algorithm:
1. On COMPILER_REQUIRED_ANNOTATIONS we resolve all annotations
and store results if this is compiler annotation, plugin annotation,
or annotation with meta-annotation (meta annotations are checked
recursively with designated resolution if needed)
2. On TYPES stage we resolve all those annotations once again and if
some annotation changes resolution then we keep type from p.1 and
report error on this annotation, so user should disambiguate it
Ambiguity may occur because of nested annotations with same name as
plugin annotations:
```
annotation class SomeAnnotation // (1) plugin annotation
open class Base {
annotation class SomeAnnotation // (2)
}
class Derived : Base() {
@SomeAnnotation // <-----------------
class Inner
}
```
At COMPILER_REQUIRED_ANNOTATIONS annotation call will be resolved to (1)
because at this stage supertypes are not resolved yet, and we consider
only importing scopes. At the TYPES stage we will find correct
annotation from supertype
Kotlin serialization IDEA plugin
Kotlin serialization plugin consists of three parts: a compiler plugin, an IntelliJ plugin and a runtime library.
This is the folder with common source for all plugins, IDEA plugin is built from here. Gradle and Maven plugins can be found in libraries folder.
Building and usage
Prerequisites:
Before all, follow the instructions from root README.md to download dependencies and build Kotlin compiler. (./gradlew dist)
Plugin works only with IntelliJIDEA 2017.2 and higher.
Make sure you have latest dev version of Kotlin plugin installed.
With gradle:
Run ./gradlew :kotlinx-serialization-compiler-plugin:dist.
In IDEA, open Settings - Plugins - Install plugin from disk... and choose $kotlin_root/dist/artifacts/Serialization/lib/kotlinx-serialization-compiler-plugin.jar
From within IDE (for development):
Run ./gradlew runIde You'll get a fresh copy of IDEA with Kotlin and Kotlin-serialization plugins built from sources.
Building gradle plugin
Run ./gradlew :kotlinx-gradle-serialization-plugin:install
Building maven plugin
Make all prerequisites from libraries' README.md for Maven projects. Go to $kotlin_root/libraries/tools/kotlin-maven-serialization. Run mvn install