简体   繁体   中英

IntelliJ - How to disable generation of `@NotNull` annotation?

When I extract a method, IDEA generates code like this:

@NotNull
private String getSimpleName(TestInfo testInfo) {
  return testInfo.getTestClass().get().getSimpleName();
}

I don't want IDEA to generate the @NotNull annotation - in my project everything is assumed to be "not null" by default.

I've added my own custom @Nullable annotation in the "Nullable/NotNull Configuration" dialog - but it seems like one of the annotations in the "NotNull Annotations" section always has to be selected.

I've looked in the "File and Code Templates" section - neither "Implemented Method Body" nor "New Method Body" template contains the @NotNull code.

How do I tell IDEA that everything is "@NotNull" be default and it should not generate an annotation?

Please try the latest version of IntelliJ IDEA: https://www.jetbrains.com/idea/nextversion/ . "Generate annotations" option should be available there: 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM