In Java 8, we can mark individual array sizes with annotations (see section 10.2 in JLS 8). For example,
int @a[] a; int @a[] @b[] a; void someMethod(int @a[] @b... y) {}
We can then analyze such declarations using Java Reflection to implement certain logic.
Do you know any practical applications of this function in real Java infrastructures or Java libraries?
java java-8 annotations jls
Vitaly
source share