正確使用,我想知道我是否應該把javax.annotation.Nonnull
註釋每個參數之前:的javax.annotation.Nonnull
import javax.annotation.Nonnull;
interface Foo {
void bar(@Nonnull Integer x, @Nonnull String y);
}
或把它之前只方法簽名:
import javax.annotation.Nonnull;
@Nonnull
interface Foo {
void bar(Integer x, String y);
}
我m使用Intellij代碼檢查。
我會把它放在每個參數的前面:如果給方法簽名添加一個參數,它可以爲null會怎麼樣? – Nathan
@Nathan我同意你的看法,但我和我的同事進行了辯論,所以我想讓事情清楚而明確。 – xuesheng