view test/tools/javac/annotations/typeAnnotations/failures/TypeOnAnonClass.java @ 2583:119747cd9f25

8023682: Incorrect attributes emitted for anonymous class declaration Summary: Cause javac to emit type annotations on new instruction as well as anonymous class supertype for annotated anonymous classes. Reviewed-by: jjg, jfranck
author emc
date Thu, 24 Oct 2013 01:27:10 -0400
parents
children
line wrap: on
line source

/*
 * @test /nodynamiccopyright/
 * @bug 8023682
 * @summary Cannot annotate an anonymous class with a target type of TYPE
 * @compile/fail/ref=TypeOnAnonClass.out -XDrawDiagnostics TypeOnAnonClass.java
 */
import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface X {}
interface Foo {}
class TypeOnAnonClass { void m() { new @X Foo() {}; } }