Fields.java revision 1690:f10cffab99b4
1/* 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24package typeannos; 25 26import java.lang.annotation.*; 27 28/* 29 * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 30 */ 31class DefaultScope { 32 Parameterized<String, String> unannotated; 33 Parameterized<@FldA String, String> firstTypeArg; 34 Parameterized<String, @FldA String> secondTypeArg; 35 Parameterized<@FldA String, @FldB String> bothTypeArgs; 36 37 Parameterized<@FldA Parameterized<@FldA String, @FldB String>, @FldB String> 38 nestedParameterized; 39 40 @FldA String [] array1; 41 @FldA String @FldB [] array1Deep; 42 @FldA String [] [] array2; 43 @FldD String @FldC @FldA [] @FldC @FldB [] array2Deep; 44 String @FldA [] [] array2First; 45 String [] @FldB [] array2Second; 46 47 // Old-style array syntax 48 String array2FirstOld @FldA []; 49 String array2SecondOld [] @FldB []; 50} 51 52class ModifiedScoped { 53 public final Parameterized<String, String> unannotated = null; 54 public final Parameterized<@FldA String, String> firstTypeArg = null; 55 public final Parameterized<String, @FldA String> secondTypeArg = null; 56 public final Parameterized<@FldA String, @FldB String> bothTypeArgs = null; 57 58 public final Parameterized<@FldA Parameterized<@FldA String, @FldB String>, @FldB String> 59 nestedParameterized = null; 60 61 public final @FldA String [] array1 = null; 62 public final @FldA String @FldB [] array1Deep = null; 63 public final @FldA String [] [] array2 = null; 64 public final @FldA String @FldA [] @FldB [] array2Deep = null; 65 public final String @FldA [] [] array2First = null; 66 public final String [] @FldB [] array2Second = null; 67} 68 69class Parameterized<K, V> { } 70 71@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 72@Documented 73@interface FldA { } 74@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 75@Documented 76@interface FldB { } 77@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 78@Documented 79@interface FldC { } 80@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 81@Documented 82@interface FldD { } 83