some more fiddling

michael keith michael.keith at oracle.com
Thu Jan 24 13:52:34 PST 2013


Oh, one other thing that I found is probably worth reporting as well. I 
thought I remembered that annotations were supposed to be returned in 
the order they appeared on the annotated element but I found that not to 
be the case in one instance.

Using the test case

@FooContainer({ @Foo(1), @Foo(2) }) @Foo(3)
class A {}

and invoking getAnnotations(Foo.class) the result was [ @Foo(3), 
@Foo(1), @Foo(2) ].
Calling getAnnotations() returned [ @Foo(1), @Foo(2), @Foo(3) ], which 
is not backwards compatible but is at least in the correct order!

-Mike

On 24/01/2013 4:16 PM, michael keith wrote:
> So I did some playing around with b72 in a couple of ways.
>
> First, I went and modified all of the current JPA container 
> annotations to be JDK 8 repeatable (using @ContainerFor and 
> @ContainedBy, since @Repeatable did not seem to be included) and 
> compiled it using b72. Then I took the JPA RI (EclipseLink) code and 
> its existing JPA tests and built them using JDK 1.7_11. I then ran the 
> tests using b72 and found that all of the tests passed, so basically 
> existing code and test cases compiled using a previous JDK will 
> continue to work (at least in the test cases that I ran). So the first 
> "do no harm" test seems to have passed :-)
>
> The next thing I did was up the ante and move on to creating tests 
> using new features (e.g. repeating annotations) to see how compatible 
> the code would be. In other words, I wanted to make sure the same 
> processing code could handle repeating annotations using the old API. 
> It turned out not to work, though, so either the compatibility layer 
> that we discussed before Christmas isn't done yet, or the current 
> support just doesn't work as expected. For example, invoking 
> getAnnotation(Foo.class) on both
>
> @Foo(1) @Foo(2)
> class A {}
>
> and
>
> @FooContainer({@Foo(1), @Foo(2)})
> class A {}
>
> both returned @Foo(1). In both of these cases it should have returned 
> null.
>
> This, combined with the fact that the Repeatable annotation was not 
> shipped in b72 leads me to believe that the compatibility support is 
> still forthcoming. Do you folks have any estimates for when it will be 
> ready to try out?
>
> Thanks,
> -Mike



More information about the enhanced-metadata-spec-discuss mailing list