test/tools/javac/annotations/typeAnnotations/newlocations/AnonymousClass.java

Thu, 24 Oct 2013 01:27:10 -0400

author
emc
date
Thu, 24 Oct 2013 01:27:10 -0400
changeset 2168
119747cd9f25
parent 1755
ddb4a2bfcd82
child 2525
2eb010b6cb22
permissions
-rw-r--r--

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

jjg@1755 1 /*
jjg@1755 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
jjg@1755 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@1755 4 *
jjg@1755 5 * This code is free software; you can redistribute it and/or modify it
jjg@1755 6 * under the terms of the GNU General Public License version 2 only, as
jjg@1755 7 * published by the Free Software Foundation.
jjg@1755 8 *
jjg@1755 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@1755 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@1755 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@1755 12 * version 2 for more details (a copy is included in the LICENSE file that
jjg@1755 13 * accompanied this code).
jjg@1755 14 *
jjg@1755 15 * You should have received a copy of the GNU General Public License version
jjg@1755 16 * 2 along with this work; if not, write to the Free Software Foundation,
jjg@1755 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@1755 18 *
jjg@1755 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jjg@1755 20 * or visit www.oracle.com if you need additional information or have any
jjg@1755 21 * questions.
jjg@1755 22 */
jjg@1755 23
jjg@1755 24 import java.lang.annotation.*;
jjg@1755 25
jjg@1755 26 /*
jjg@1755 27 * @test
jjg@1755 28 * @bug 1234567
jjg@1755 29 * @summary new type annotation location: anonymous class creation
jjg@1755 30 * @author Werner Dietl
jjg@1755 31 * @compile AnonymousClass.java
jjg@1755 32 */
jjg@1755 33 class AnonymousClass {
jjg@1755 34 Object o1 = new @TA Object() { };
emc@2168 35 Object o2 = new @TA Object() { };
jjg@1755 36 }
jjg@1755 37
jjg@1755 38 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
jjg@1755 39 @interface TA { }
jjg@1755 40
jjg@1755 41 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
jjg@1755 42 @interface TB { }

mercurial