test for inner and anon class
Jonathan Gibbons
jonathan.gibbons at oracle.com
Thu May 23 18:05:07 PDT 2013
On 05/23/2013 05:55 PM, Steve Sides wrote:
> Hi Werner,
> I updated the test I had for Inner and anonymous classes. It has been
> blocked by a few bugs (listed @bug) which are now fixed.
> However, as I started enabling the tests I ran in to a couple more.
> The test is here,
> http://cr.openjdk.java.net/~ssides/8015323/
> but it will fail due to these two
>
> 8015323 If class InnerAnnon is instantiated, type annotations on
> ia_m1() are incorrectly written to classfile.
>
> 8015257 A type annotation with ElementTypes TYPE_USE and FIELD placed
> on type
> argument is placed on the ctor if repeated and on the field if not
> repeated.
>
> There is currently an @ignore on the test as I wasn't sure which repo
> this might want to go into, and if in tl/langtools it should have the
> ignore.
> The affect parts of the test are noted in the generated test
> sources(if you comment out all the next lines, it'll pass).
>
> The 8015323 scenario used to crash, not they're written incorrectly.
> 8015727 used to not write to classfile at all if repeated, not it just
> writes incorrectly.
>
> The test case is a little clunky looking, but it found several bugs
> and I found it runs faster and is very easy to diagnose and narrow
> down a test case.
>
> -steve
>
>
Steve,
Nice test.
I don't know if it would ease maintenance, but one suggestion might be
to move the testsource string into a separate file, called something
like testsource.template, and then read it into a String use
java.nio.file.Files API. I know normally we keep the template within
the main source file, but this template is getting pretty long.
Anyway, just a suggestion, for your ease-of-use. Your call.
-- Jon
More information about the type-annotations-dev
mailing list