formatting of annotated array types

Markus Keller markus_keller at ch.ibm.com
Wed Nov 6 11:10:25 PST 2013


I know that coding conventions used by examples in the JLS are not 
normative, but a consistent notation is nonetheless helpful.

JLS7 consistently uses a terse array type notation without any spaces 
between the type and the brackets, e.g. int[][] or Class<?>[].

java-annotation-design.html and 308.pdf usually keep the terse notation, 
but add a space on both sides of an interspersed type annotation. These 
spaces are not enforced by the grammar, but I agree they improve 
readability.

Could this style be used consistently in the code examples? 2013-10-24 
only needs corrections in two places:

308.pdf:  int [] @Foo [] f;
expected: int[] @Foo [] f;

308.pdf:  @X String [] []
          String @X [] []
          String [] @X []

expected: @X String[][]
          String @X [][]
          String[] @X []

Thanks,
Markus



More information about the type-annotations-spec-comments mailing list