|
Given that one cannot design an annotation in a way that it can be used with Java 8 (supporting the new functionalities) and older versions at the same time, the $2.72-question is how support for the Java 8 features should be delivered.
The following approaches come to mind (this discusses the HV constraints only, the spec constraints are another issue):
-
Just change the existing constraints such as @Email but adding @Repeatable etc. and require Java SE 8 as the minimum version for the next major HV release (6?); Users on older versions would have to restrict themselves to the latest HV version support SE 7 and older
-
Change the existing constraints, requiring SE 8 as minimum for HV by default. In addition provide an alternative annotation module suitable for older SE versions. Users of such older JDK could use the latest HV JAR but the constraints from that alternative annotation module.
-
Extract the constraints into a separate module which is provided in two flavors, one for SE 8 and one for SE 7 and older. Users would have to depend on the HV JAR and the annotation JAR matching their environment.
|