gpt4 book ai didi

java - 正确使用 javax.annotation.Nonnull

转载 作者:行者123 更新时间:2023-11-30 10:27:04 32 4
gpt4 key购买 nike

我想知道我是否应该在每个参数之前放置 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);
}

我正在使用 Intellij 代码检查。

最佳答案

每个参数之前都有更具体的定义。

关于java - 正确使用 javax.annotation.Nonnull,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45437709/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com