简体   繁体   English

对数组使用 Nullness 注释

[英]Using Nullness annotation with array

Can someone help me to understand the difference between the following three annotated return value methods ie how does the constraints on the return type of each differ from each other :有人可以帮助我理解以下三个带注释的返回值方法之间的区别,即每个方法的返回类型的约束如何彼此不同:

static @Nullable double[] multiply(){...}

static @Nullable double @Nullable[] multiply(){...}

static double @Nullable[] multiply(){...}

Type annotations are written immediately before the type to which they apply.类型注解写在它们所应用的类型之前。

  • Double [] : An array of Double. Double [] : Double 数组。
  • Double @Nullable [] : A nullable array of Double. Double @Nullable [] :Double 的可为空数组。
  • @Nullable Double [] : An array of nullable Double. @Nullable Double [] :可空双@Nullable Double []数组。
  • @Nullable Double @Nullable [] : A nullable array of nullable Double. @Nullable Double @Nullable [] :可空@Nullable Double @Nullable []数组。

This is explained in the Java Language Specification, section 9.7.4 and in the Java Type Annotations Specification, section 2.2.1 .这在Java Language Specification, section 9.7.4Java Type Annotations Specification, section 2.2.1 中有解释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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