Test fails with AssertionError

Steve Sides steve.sides at oracle.com
Mon Apr 1 14:01:18 PDT 2013


I don't have any for lambda and repeated annotations, other than the one 
noted (...Test3).
CombinationsTargetTest3.java had been passing for a while, then it 
failed last night (not on a repeated annotation scenario).

I have one which tests some anonymous and inner classes (not lambda 
though), but it ran across the repeated annotation bugs too often and I 
did not put it back, but reported the bugs separately.

-steve

On 4/1/2013 1:50 PM, Werner Dietl wrote:
> Thanks for the info, I'll look into this.
> For me failures/T8009360.java is passing and I had ignored
> classfile/CombinationsTargetTest3.java because of all the repeated
> type annotations failures.
> I'll add a separate test case for this.
>
> Are there any outstanding tests from you that I haven't included in
> the repository yet? Do you have more tests for lambda and anonymous
> classes?
>
> cu, WMD.
>
> On Mon, Apr 1, 2013 at 1:43 PM, Steve Sides<steve.sides at oracle.com>  wrote:
>> Looking at today's nihgtly testing, I see the AssertionError reported in bug
>> 8009360 (test
>> tools/javac/annotations/typeAnnotations/failures/T8009360.java),
>> now shows up in a testcase from
>> tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java.
>> The test case is:
>>
>> // src9: type annotations on static method of interface
>> class Test17{
>>    interface I  {
>>      static @A @B String m() { @A @B String ret = "I.m"; return ret; }
>>    }
>> }
>>
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @Repeatable( AC.class ) @interface A { }
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @interface AC { A[] value(); }
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @Repeatable( BC.class ) @interface B { }
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @interface BC { B[] value(); }
>>
>>
>> This test had been passing up through 3/29(doesn't look like we got a build
>> and test on 3/30).
>> Contents of log file from the test is below
>>
>> -steve
>>
>>
>> An exception has occurred in the compiler (1.8.0-ea). Please file a bug at
>> the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after
>> checking the Bug Parade for duplicates. Include your program and the
>> following diagnostic in your report.  Thank you.
>> java.lang.AssertionError: Can't annotate already annotated type: (@A, at B ::
>> java.lang.String); adding: @A, at B
>> 	at com.sun.tools.javac.util.Assert.error(Assert.java:133)
>> 	at com.sun.tools.javac.util.Assert.check(Assert.java:94)
>> 	at com.sun.tools.javac.code.Type$AnnotatedType.<init>(Type.java:1591)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitAnnotatedType(TypeAnnotations.java:518)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitAnnotatedType(TypeAnnotations.java:497)
>> 	at com.sun.tools.javac.code.Type$AnnotatedType.accept(Type.java:1628)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:577)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:461)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:291)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:985)
>> 	at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:770)
>> 	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:233)
>> 	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:959)
>> 	at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:685)
>> 	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:233)
>> 	at
>> com.sun.tools.javac.code.TypeAnnotations$1.enterAnnotation(TypeAnnotations.java:96)
>> 	at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:140)
>> 	at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:123)
>> 	at com.sun.tools.javac.comp.Enter.complete(Enter.java:514)
>> 	at com.sun.tools.javac.comp.Enter.main(Enter.java:473)
>> 	at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:990)
>> 	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:865)
>> 	at com.sun.tools.javac.main.Main.compile(Main.java:519)
>> 	at com.sun.tools.javac.main.Main.compile(Main.java:376)
>> 	at com.sun.tools.javac.main.Main.compile(Main.java:365)
>> 	at com.sun.tools.javac.main.Main.compile(Main.java:356)
>> 	at com.sun.tools.javac.Main.compile(Main.java:77)
>> 	at ClassfileTestHelper.compile(ClassfileTestHelper.java:50)
>> 	at CombinationsTargetTest3.test(CombinationsTargetTest3.java:192)
>> 	at CombinationsTargetTest3.run(CombinationsTargetTest3.java:133)
>> 	at CombinationsTargetTest3.main(CombinationsTargetTest3.java:105)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> 	at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:487)
>> 	at
>> com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:706)
>> 	at java.lang.Thread.run(Thread.java:722)
>> fail compile. Source:
>> import java.lang.annotation.*;
>> import static java.lang.annotation.RetentionPolicy.*;
>> import static java.lang.annotation.ElementType.*;
>> import java.util.List;
>> import java.util.ArrayList;
>>
>> // src9: type annotations on static method of interface
>> class Test17{
>>    interface I  {
>>      static @A @B String m() { @A @B String ret = "I.m"; return ret; }
>>    }
>> }
>>
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @Repeatable( AC.class ) @interface A { }
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @interface AC { A[] value(); }
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @Repeatable( BC.class ) @interface B { }
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @interface BC { B[] value(); }
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE_PARAMETER,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @Repeatable(DC.class) @interface D { }
>> @Retention(CLASS)
>> @Target({TYPE_USE,TYPE_PARAMETER,TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE})
>> @interface DC { D[] value(); }
>>
>> java.lang.Error: compilation failed. rc=4
>> 	at ClassfileTestHelper.compile(ClassfileTestHelper.java:53)
>> 	at CombinationsTargetTest3.test(CombinationsTargetTest3.java:192)
>> 	at CombinationsTargetTest3.run(CombinationsTargetTest3.java:133)
>> 	at CombinationsTargetTest3.main(CombinationsTargetTest3.java:105)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> 	at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:487)
>> 	at
>> com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:706)
>> 	at java.lang.Thread.run(Thread.java:722)
>>
>> JavaTest Message: Test threw exception: java.lang.Error
>> JavaTest Message: shutting down test
>>
>> result: Failed. Execution failed: `main' threw exception: java.lang.Error:
>> compilation failed. rc=4
>>
>>
>> test result: Failed. Execution failed: `main' threw exception:
>> java.lang.Error: compilation failed. rc=4
>
>



More information about the type-annotations-dev mailing list