Hi all,<div><br></div><div>At J1 there was an interesting talk on what&#39;s new in JDK 8 regarding annotations [1]. There are some things which are beneficial for the Bean Validation use case:</div><div><br></div><div>* JSR 308 (annotations on types): Will allow us to do things like private List&lt;@Email String&gt; emails;</div>
<div><br></div><div>Yeah!</div><div><br></div><div>* Repeating annotations: One can put the same annotation several times to an element:</div><div><br></div><div>@Size(min=8, groups=Default.class)</div><div>@Size(min=16, groups=Admin.class)</div>
<div>private String password;</div><div><br></div><div>The compiler puts that into a container annotation (e.g. @Size.List) and there will be updates to the reflection API to retrieve repeated annotations.</div><br>* javax.lang.model backed by Core Reflection:<div>
<br></div><div>The model API will be usable at runtime, taking reflection types as input:</div><br>TypeElement someClassElement = createMirror(SomeClass.class);<div><br></div><div>So this will allow to share code between a Bean Validation runtime (which typically uses reflection) and an annotation processor (which typically uses the model API) for checking constraints etc.</div>
<div><br></div><div>Hardy, as a bonus, this will make it finally dead easy to discover overridden methods :) :</div><div><br></div><div>
                
        
        
                ExecutableElement superFoo =  createMirror(Super.class.getDeclaredMethod(&quot;foo&quot;));<br>ExecutableElement childFoo =  createMirror(Child.class.getDeclaredMethod(&quot;foo&quot;));</div><div>TypeElement childElement = createMirror(Child.class);<br>
<br></div><div>assert getElements().overrides(childFoo, superFoo, childElement) == true</div><div><br></div><div>So it seems there is a BV 1.2 due once JDK 8 is through the door :)</div><div><br></div><div>--Gunnar</div><div>
<div><div><br></div><div>[1] <a href="https://oracleus.activeevents.com/connect/sessionDetail.ww?SESSION_ID=4469">https://oracleus.activeevents.com/connect/sessionDetail.ww?SESSION_ID=4469</a></div></div></div>