• <bdo id='0Ede3'></bdo><ul id='0Ede3'></ul>

  1. <legend id='0Ede3'><style id='0Ede3'><dir id='0Ede3'><q id='0Ede3'></q></dir></style></legend><tfoot id='0Ede3'></tfoot>

    <small id='0Ede3'></small><noframes id='0Ede3'>

    1. <i id='0Ede3'><tr id='0Ede3'><dt id='0Ede3'><q id='0Ede3'><span id='0Ede3'><b id='0Ede3'><form id='0Ede3'><ins id='0Ede3'></ins><ul id='0Ede3'></ul><sub id='0Ede3'></sub></form><legend id='0Ede3'></legend><bdo id='0Ede3'><pre id='0Ede3'><center id='0Ede3'></center></pre></bdo></b><th id='0Ede3'></th></span></q></dt></tr></i><div id='0Ede3'><tfoot id='0Ede3'></tfoot><dl id='0Ede3'><fieldset id='0Ede3'></fieldset></dl></div>
    2. @Nullable 注解用法

      时间:2023-07-26

      • <bdo id='TifyF'></bdo><ul id='TifyF'></ul>
          <tbody id='TifyF'></tbody>
      • <small id='TifyF'></small><noframes id='TifyF'>

              <i id='TifyF'><tr id='TifyF'><dt id='TifyF'><q id='TifyF'><span id='TifyF'><b id='TifyF'><form id='TifyF'><ins id='TifyF'></ins><ul id='TifyF'></ul><sub id='TifyF'></sub></form><legend id='TifyF'></legend><bdo id='TifyF'><pre id='TifyF'><center id='TifyF'></center></pre></bdo></b><th id='TifyF'></th></span></q></dt></tr></i><div id='TifyF'><tfoot id='TifyF'></tfoot><dl id='TifyF'><fieldset id='TifyF'></fieldset></dl></div>

              <legend id='TifyF'><style id='TifyF'><dir id='TifyF'><q id='TifyF'></q></dir></style></legend>
              <tfoot id='TifyF'></tfoot>
                本文介绍了@Nullable 注解用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我看到java中的一些方法声明为:

                I saw some method in java declared as:

                void foo(@Nullable Object obj)
                { ... }
                

                这里的@Nullable是什么意思?这是否意味着输入可能是null?

                What's the meaning of @Nullable here? Does it mean the input could be null?

                没有注解,输入仍然可以为空,所以我猜不只是它?

                Without the annotation, the input can still be null, so I guess that's not just it?

                推荐答案

                明确了方法接受空值,如果你重写了方法,你也应该接受空值.

                It makes it clear that the method accepts null values, and that if you override the method, you should also accept null values.

                它还可以作为 FindBugs 等代码分析器的提示.例如,如果此类方法取消引用其参数而不首先检查 null,则 FindBugs 将发出警告.

                It also serves as a hint for code analyzers like FindBugs. For example, if such a method dereferences its argument without checking for null first, FindBugs will emit a warning.

                这篇关于@Nullable 注解用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何使用 Hibernate @Any 相关的注解? 下一篇:@Transactional(传播=传播.需要)

                相关文章

                最新文章

                <legend id='1Kd8i'><style id='1Kd8i'><dir id='1Kd8i'><q id='1Kd8i'></q></dir></style></legend>
                <tfoot id='1Kd8i'></tfoot>
                <i id='1Kd8i'><tr id='1Kd8i'><dt id='1Kd8i'><q id='1Kd8i'><span id='1Kd8i'><b id='1Kd8i'><form id='1Kd8i'><ins id='1Kd8i'></ins><ul id='1Kd8i'></ul><sub id='1Kd8i'></sub></form><legend id='1Kd8i'></legend><bdo id='1Kd8i'><pre id='1Kd8i'><center id='1Kd8i'></center></pre></bdo></b><th id='1Kd8i'></th></span></q></dt></tr></i><div id='1Kd8i'><tfoot id='1Kd8i'></tfoot><dl id='1Kd8i'><fieldset id='1Kd8i'></fieldset></dl></div>

                    <bdo id='1Kd8i'></bdo><ul id='1Kd8i'></ul>

                    <small id='1Kd8i'></small><noframes id='1Kd8i'>