test/tools/javac/annotations/FinalStringInNested.java

Mon, 20 Jul 2015 11:41:52 -0700

author
asaha
date
Mon, 20 Jul 2015 11:41:52 -0700
changeset 2941
29ef5ee31b3d
parent 2596
fa8be3ce18fc
permissions
-rw-r--r--

Added tag jdk8u65-b06 for changeset ae5e31450299

jfranck@2596 1 /*
jfranck@2596 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
jfranck@2596 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jfranck@2596 4 *
jfranck@2596 5 * This code is free software; you can redistribute it and/or modify it
jfranck@2596 6 * under the terms of the GNU General Public License version 2 only, as
jfranck@2596 7 * published by the Free Software Foundation.
jfranck@2596 8 *
jfranck@2596 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jfranck@2596 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jfranck@2596 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jfranck@2596 12 * version 2 for more details (a copy is included in the LICENSE file that
jfranck@2596 13 * accompanied this code).
jfranck@2596 14 *
jfranck@2596 15 * You should have received a copy of the GNU General Public License version
jfranck@2596 16 * 2 along with this work; if not, write to the Free Software Foundation,
jfranck@2596 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jfranck@2596 18 *
jfranck@2596 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jfranck@2596 20 * or visit www.oracle.com if you need additional information or have any
jfranck@2596 21 * questions.
jfranck@2596 22 */
jfranck@2596 23
jfranck@2596 24 /*
jfranck@2596 25 * @test
jfranck@2596 26 * @bug 8054448
jfranck@2596 27 * @summary Verify that constant strings in nested classes in anonymous classes
jfranck@2596 28 * can be used in annotations.
jfranck@2596 29 * @compile FinalStringInNested.java
jfranck@2596 30 */
jfranck@2596 31
jfranck@2596 32 public class FinalStringInNested {
jfranck@2596 33
jfranck@2596 34 public void f() {
jfranck@2596 35 Object o = new Object() {
jfranck@2596 36 @FinalStringInNested.Annotation(Nested.ID)
jfranck@2596 37 class Nested {
jfranck@2596 38 static final String ID = "B";
jfranck@2596 39 }
jfranck@2596 40 };
jfranck@2596 41 }
jfranck@2596 42
jfranck@2596 43 @interface Annotation {
jfranck@2596 44 String value();
jfranck@2596 45 }
jfranck@2596 46 }

mercurial