为什么这里的元素类型注解为Integer而不是Integer[]?

Why is the element type here annotated as Integer and not Integer[]?

假设 @TypeAnno 是某种类型注释。

@TypeAnno Integer[] vec;

此处元素类型 Integer 被注释而不是 Integer[]。为什么?

类型注释适用于紧随其后的类型组件。

Integer[] 是一个复合类型,由两部分组成:[] 是数组部分,Integer 是元素类型。希望能够在每个部分上编写类型注释。 @Nullable Object @NonNull [] 是一个包含 possibly-null 个对象的 non-null 数组。

欲了解更多信息, 请参阅类型注释常见问题条目 What is the meaning of array annotations such as @NonNull Object @Nullable []? and I don't like array and receiver annotations.。还 请参阅 Syntax of array annotations in the type annotation specifiaction. This is also addressed in the Java Language Specification (for example, section Where Annotations May Appear 节)。