java - IntelliJ IDEA complains about null check for @NotNull parameter -
java - IntelliJ IDEA complains about null check for @NotNull parameter -
i want utilize jetbrains @nullable/@notnull annotations in project.
i have class @notnull field. constructor naturally not take null throws exception instead. of course of study parameter of constructor annotated @notnull.
why intellij thought complain null-check? documentation states:
an element annotated notnull claims null value forbidden homecoming (for methods), pass (parameters) , hold (local variables , fields).
but still have check null-values @ runtime in case build scheme not understand annotation , accepts statement new car(null). wrong?
if utilize jetbrains @notnull annotation, runtime assertions added compiled bytecode that'll guarantee null not passed there. makes no sense write same checks in source code. approach works quite us.
if utilize other annotations or don't want instrument bytecode, can disable particular warning pressing alt+enter on it, "edit inspection settings" , checking "ignore assert statements". such conditional statements treated assertions ide.
java intellij-idea annotations notnull
Comments
Post a Comment