External Annotations only for third party libraries?

How can I make it so IntelliJ will do inline `@Nonnull` and `@Nullable` annotations when in my source code but use an external annotations file when annotating third party library code?  For example, when I navigate to Guava's `ImmutableSet<E>.of` method and then tell IntelliJ to mark it as @Nonnull I want it to add to the annotation.xml file in my project.  However, if I am looking at my project's source code and I do the same thing I want it to put the @Nonnull annotation inline.

Currently, it is always putting annotations in an annotations file, never inline.

Also, how does this forum not have code blocks in its styling bar?!

3 comments
Comment actions Permalink

You need to delete annotations root in File|Project Structure|Module|Paths, then you'll get question-hint where to place your annotations. Choosing "In code" should solve the problem

0
Comment actions Permalink

If I do that, how does IntelliJ know where to find external annotation files for third party libraries?

0
Comment actions Permalink

External libraries are configured separately: each library has "annotations root", where annotations for this library should be found

0

Please sign in to leave a comment.