FieldTest.java revision 3294:9adfb22ff08f
1/* 2 * Copyright (c) 2015, 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 24/* 25 * @test 26 * @bug 8049238 27 * @summary Checks Signature attribute for fields. 28 * @library /tools/lib /tools/javac/lib ../lib 29 * @modules jdk.compiler/com.sun.tools.javac.api 30 * jdk.compiler/com.sun.tools.javac.file 31 * jdk.compiler/com.sun.tools.javac.main 32 * jdk.jdeps/com.sun.tools.classfile 33 * jdk.jdeps/com.sun.tools.javap 34 * @build TestBase TestResult InMemoryFileManager ToolBox 35 * @build FieldTest Driver ExpectedSignature ExpectedSignatureContainer 36 * @run main Driver FieldTest 37 */ 38 39import java.util.Comparator; 40import java.util.List; 41import java.util.Map; 42 43@ExpectedSignature(descriptor = "FieldTest", signature = "<T:Ljava/lang/Object;>Ljava/lang/Object;") 44public class FieldTest<T> { 45 46 @ExpectedSignature(descriptor = "typeInList", signature = "Ljava/util/List<TT;>;") 47 List<T> typeInList; 48 49 @ExpectedSignature(descriptor = "boundsType", signature = "Ljava/util/List<Ljava/util/Map<+TT;-TT;>;>;") 50 List<Map<? extends T, ? super T>> boundsType; 51 52 @ExpectedSignature(descriptor = "type", signature = "TT;") 53 T type; 54 55 @ExpectedSignature(descriptor = "typeInArray", signature = "[TT;") 56 T[] typeInArray; 57 58 @ExpectedSignature(descriptor = "byteArrayInList", signature = "Ljava/util/List<[B>;") 59 List<byte[]> byteArrayInList; 60 61 @ExpectedSignature(descriptor = "shortArrayInList", signature = "Ljava/util/List<[S>;") 62 List<short[]> shortArrayInList; 63 64 @ExpectedSignature(descriptor = "intArrayInList", signature = "Ljava/util/List<[I>;") 65 List<int[]> intArrayInList; 66 67 @ExpectedSignature(descriptor = "longArrayInList", signature = "Ljava/util/List<[J>;") 68 List<long[]> longArrayInList; 69 70 @ExpectedSignature(descriptor = "charArrayInList", signature = "Ljava/util/List<[C>;") 71 List<char[]> charArrayInList; 72 73 @ExpectedSignature(descriptor = "booleanArrayInList", signature = "Ljava/util/List<[Z>;") 74 List<boolean[]> booleanArrayInList; 75 76 @ExpectedSignature(descriptor = "floatArrayInList", signature = "Ljava/util/List<[F>;") 77 List<float[]> floatArrayInList; 78 79 @ExpectedSignature(descriptor = "doubleArrayInList", signature = "Ljava/util/List<[D>;") 80 List<double[]> doubleArrayInList; 81 82 @ExpectedSignature(descriptor = "integerInList", signature = "Ljava/util/List<Ljava/lang/Integer;>;") 83 List<Integer> integerInList; 84 85 @ExpectedSignature(descriptor = "typeInMultiArray", signature = "[[TT;") 86 T[][] typeInMultiArray; 87 88 @ExpectedSignature(descriptor = "arrayOfClasses", signature = "[Ljava/util/List<TT;>;") 89 List<T>[] arrayOfClasses; 90 91 @ExpectedSignature(descriptor = "extendsWildCard", signature = "Ljava/util/List<+TT;>;") 92 List<? extends T> extendsWildCard; 93 94 @ExpectedSignature(descriptor = "superWildCard", signature = "Ljava/util/Comparator<-TT;>;") 95 Comparator<? super T> superWildCard; 96 97 @ExpectedSignature(descriptor = "extendsSuperWildCard", 98 signature = "Ljava/util/List<+Ljava/util/Comparator<-TT;>;>;") 99 List<? extends Comparator<? super T>> extendsSuperWildCard; 100 101 @ExpectedSignature(descriptor = "wildCard", signature = "Ljava/util/Comparator<*>;") 102 Comparator<?> wildCard; 103 104 @ExpectedSignature(descriptor = "boundsBooleanArray", signature = "Ljava/util/Map<+[Z-[Z>;") 105 Map<? extends boolean[], ? super boolean[]> boundsBooleanArray; 106 107 @ExpectedSignature(descriptor = "boundsByteArray", signature = "Ljava/util/Map<+[B-[B>;") 108 Map<? extends byte[], ? super byte[]> boundsByteArray; 109 110 @ExpectedSignature(descriptor = "boundsShortArray", signature = "Ljava/util/Map<+[S-[S>;") 111 Map<? extends short[], ? super short[]> boundsShortArray; 112 113 @ExpectedSignature(descriptor = "boundsIntArray", signature = "Ljava/util/Map<+[I-[I>;") 114 Map<? extends int[], ? super int[]> boundsIntArray; 115 116 @ExpectedSignature(descriptor = "boundsLongArray", signature = "Ljava/util/Map<+[J-[J>;") 117 Map<? extends long[], ? super long[]> boundsLongArray; 118 119 @ExpectedSignature(descriptor = "boundsCharArray", signature = "Ljava/util/Map<+[C-[C>;") 120 Map<? extends char[], ? super char[]> boundsCharArray; 121 122 @ExpectedSignature(descriptor = "boundsFloatArray", signature = "Ljava/util/Map<+[F-[F>;") 123 Map<? extends float[], ? super float[]> boundsFloatArray; 124 125 @ExpectedSignature(descriptor = "boundsDoubleArray", signature = "Ljava/util/Map<+[D-[D>;") 126 Map<? extends double[], ? super double[]> boundsDoubleArray; 127 128 @ExpectedSignature(descriptor = "boundsObjectArray", 129 signature = "Ljava/util/Map<+[Ljava/lang/Object;-[Ljava/lang/Object;>;") 130 Map<? extends Object[], ? super Object[]> boundsObjectArray; 131 132 boolean booleanNoSignatureAttribute; 133 byte byteNoSignatureAttribute; 134 char charNoSignatureAttribute; 135 short shortNoSignatureAttribute; 136 int intNoSignatureAttribute; 137 long longNoSignatureAttribute; 138 float floatNoSignatureAttribute; 139 double doubleNoSignatureAttribute; 140 141 List listNoSignatureAttribute; 142 143 @ExpectedSignature(descriptor = "staticByteArrayInList", signature = "Ljava/util/List<[B>;") 144 static List<byte[]> staticByteArrayInList; 145 146 @ExpectedSignature(descriptor = "staticShortArrayInList", signature = "Ljava/util/List<[S>;") 147 static List<short[]> staticShortArrayInList; 148 149 @ExpectedSignature(descriptor = "staticIntArrayInList", signature = "Ljava/util/List<[I>;") 150 static List<int[]> staticIntArrayInList; 151 152 @ExpectedSignature(descriptor = "staticLongArrayInList", signature = "Ljava/util/List<[J>;") 153 static List<long[]> staticLongArrayInList; 154 155 @ExpectedSignature(descriptor = "staticCharArrayInList", signature = "Ljava/util/List<[C>;") 156 static List<char[]> staticCharArrayInList; 157 158 @ExpectedSignature(descriptor = "staticBooleanArrayInList", signature = "Ljava/util/List<[Z>;") 159 static List<boolean[]> staticBooleanArrayInList; 160 161 @ExpectedSignature(descriptor = "staticFloatArrayInList", signature = "Ljava/util/List<[F>;") 162 static List<float[]> staticFloatArrayInList; 163 164 @ExpectedSignature(descriptor = "staticDoubleArrayInList", signature = "Ljava/util/List<[D>;") 165 static List<double[]> staticDoubleArrayInList; 166 167 @ExpectedSignature(descriptor = "staticIntegerInList", signature = "Ljava/util/List<Ljava/lang/Integer;>;") 168 static List<Integer> staticIntegerInList; 169 170 @ExpectedSignature(descriptor = "staticWildCard", signature = "Ljava/util/Comparator<*>;") 171 static Comparator<?> staticWildCard; 172 173 @ExpectedSignature(descriptor = "staticBoundsBooleanArray", signature = "Ljava/util/Map<+[Z-[Z>;") 174 static Map<? extends boolean[], ? super boolean[]> staticBoundsBooleanArray; 175 176 @ExpectedSignature(descriptor = "staticBoundsByteArray", signature = "Ljava/util/Map<+[B-[B>;") 177 static Map<? extends byte[], ? super byte[]> staticBoundsByteArray; 178 179 @ExpectedSignature(descriptor = "staticBoundsShortArray", signature = "Ljava/util/Map<+[S-[S>;") 180 static Map<? extends short[], ? super short[]> staticBoundsShortArray; 181 182 @ExpectedSignature(descriptor = "staticBoundsIntArray", signature = "Ljava/util/Map<+[I-[I>;") 183 static Map<? extends int[], ? super int[]> staticBoundsIntArray; 184 185 @ExpectedSignature(descriptor = "staticBoundsLongArray", signature = "Ljava/util/Map<+[J-[J>;") 186 static Map<? extends long[], ? super long[]> staticBoundsLongArray; 187 188 @ExpectedSignature(descriptor = "staticBoundsCharArray", signature = "Ljava/util/Map<+[C-[C>;") 189 static Map<? extends char[], ? super char[]> staticBoundsCharArray; 190 191 @ExpectedSignature(descriptor = "staticBoundsFloatArray", signature = "Ljava/util/Map<+[F-[F>;") 192 static Map<? extends float[], ? super float[]> staticBoundsFloatArray; 193 194 @ExpectedSignature(descriptor = "staticBoundsDoubleArray", signature = "Ljava/util/Map<+[D-[D>;") 195 static Map<? extends double[], ? super double[]> staticBoundsDoubleArray; 196 197 @ExpectedSignature(descriptor = "staticBoundsObjectArray", 198 signature = "Ljava/util/Map<+[Ljava/lang/Object;-[Ljava/lang/Object;>;") 199 static Map<? extends Object[], ? super Object[]> staticBoundsObjectArray; 200 201 static boolean staticBooleanNoSignatureAttribute; 202 static byte staticByteNoSignatureAttribute; 203 static char staticCharNoSignatureAttribute; 204 static short staticShortNoSignatureAttribute; 205 static int staticIntNoSignatureAttribute; 206 static long staticLongNoSignatureAttribute; 207 static float staticFloatNoSignatureAttribute; 208 static double staticDoubleNoSignatureAttribute; 209 210 static List staticListNoSignatureAttribute; 211} 212