External Annotations

We annotated a method of an external library as @NotNull using external annotation, so we won't need to use "!!" on the returned value. When compiling with intelliJ this works fine, however when running gradle build we get:

warning:Annotations path entry points to a non-existent location:
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type …?
Execution failed for task ‘:compileKotlin’.

it looks like grade isn’t aware of the external annotations file?

10x,
Alex

1 Like

Hi, If you want to add annotations for some of your libraries, you should add the following line to your build.gradle file:

kotlinOptions.annotations = file('<path to annotations>')

Annotations for JDK should be configured automatically. Here is a link

works! 10x for the quick reply!

Is this still valid? I cannot find it. Has it been moved?