Sat, 13 Apr 2013 12:25:44 +0100
8010659: Javac Crashes while building OpenJFX
Reviewed-by: jjg
Contributed-by: maurizio.cimadamore@oracle.com
jjg@1521 | 1 | /* |
darcy@1534 | 2 | * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
jjg@1521 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@1521 | 4 | * |
jjg@1521 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@1521 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@1521 | 7 | * published by the Free Software Foundation. |
jjg@1521 | 8 | * |
jjg@1521 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@1521 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@1521 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@1521 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@1521 | 13 | * accompanied this code). |
jjg@1521 | 14 | * |
jjg@1521 | 15 | * You should have received a copy of the GNU General Public License version |
jjg@1521 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@1521 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@1521 | 18 | * |
jjg@1521 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jjg@1521 | 20 | * or visit www.oracle.com if you need additional information or have any |
jjg@1521 | 21 | * questions. |
jjg@1521 | 22 | */ |
jjg@1521 | 23 | |
jjg@1521 | 24 | import static com.sun.tools.classfile.TypeAnnotation.TargetType.*; |
jjg@1521 | 25 | |
jjg@1521 | 26 | /* |
jjg@1521 | 27 | * @test |
jjg@1521 | 28 | * @summary Test population of reference info for method type parameters |
jjg@1521 | 29 | * @compile -g Driver.java ReferenceInfoUtil.java MethodTypeParam.java |
jjg@1521 | 30 | * @run main Driver MethodTypeParam |
jjg@1521 | 31 | */ |
jjg@1521 | 32 | public class MethodTypeParam { |
jjg@1521 | 33 | |
jjg@1521 | 34 | @TADescriptions({ |
jjg@1521 | 35 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, paramIndex = 0), |
jjg@1521 | 36 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0), |
jjg@1521 | 37 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER, paramIndex = 1), |
jjg@1521 | 38 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0), |
jjg@1521 | 39 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1) |
jjg@1521 | 40 | }) |
jjg@1521 | 41 | public String regularClass() { |
jjg@1521 | 42 | return "<@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> void test() { }"; |
jjg@1521 | 43 | } |
jjg@1521 | 44 | |
jjg@1521 | 45 | @TADescriptions({ |
jjg@1521 | 46 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, paramIndex = 0), |
jjg@1521 | 47 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0), |
jjg@1521 | 48 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER, paramIndex = 1), |
jjg@1521 | 49 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1) |
jjg@1521 | 50 | }) |
jjg@1521 | 51 | public String regularClass2() { |
jjg@1521 | 52 | return "<@TA K extends @TB Date, @TC V extends @TE Cloneable> void test() { }"; |
jjg@1521 | 53 | } |
jjg@1521 | 54 | |
jjg@1521 | 55 | @TADescriptions({ |
jjg@1521 | 56 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1), |
jjg@1521 | 57 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}), |
jjg@1521 | 58 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1), |
jjg@1521 | 59 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}), |
jjg@1521 | 60 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}), |
jjg@1521 | 61 | @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0) |
jjg@1521 | 62 | }) |
jjg@1521 | 63 | public String regularClassParameterized() { |
jjg@1521 | 64 | return "<K extends @TA Map<String, @TB String>, V extends @TF Object & @TC List<@TD List<@TE Object>>> void test() { }"; |
jjg@1521 | 65 | } |
jjg@1521 | 66 | |
jjg@1521 | 67 | @TADescriptions({ |
jjg@1521 | 68 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, paramIndex = 0), |
jjg@1521 | 69 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0), |
jjg@1521 | 70 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER, paramIndex = 1), |
jjg@1521 | 71 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0), |
jjg@1521 | 72 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1) |
jjg@1521 | 73 | }) |
jjg@1521 | 74 | public String abstractClass() { |
jjg@1521 | 75 | return "abstract class Test { abstract <@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> void test(); }"; |
jjg@1521 | 76 | } |
jjg@1521 | 77 | |
jjg@1521 | 78 | @TADescriptions({ |
jjg@1521 | 79 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1), |
jjg@1521 | 80 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}), |
jjg@1521 | 81 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1), |
jjg@1521 | 82 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}), |
jjg@1521 | 83 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}), |
jjg@1521 | 84 | @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0), |
jjg@1521 | 85 | @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0) |
jjg@1521 | 86 | }) |
jjg@1521 | 87 | public String abstractClassParameterized() { |
jjg@1521 | 88 | return "abstract class Test { abstract <K extends @TG Object & @TA Map<String, @TB String>, V extends @TF Object & @TC List<@TD List<@TE Object>>> void test(); }"; |
jjg@1521 | 89 | } |
jjg@1521 | 90 | |
jjg@1521 | 91 | @TADescriptions({ |
jjg@1521 | 92 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1), |
jjg@1521 | 93 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}), |
jjg@1521 | 94 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1), |
jjg@1521 | 95 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}), |
jjg@1521 | 96 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}) |
jjg@1521 | 97 | }) |
jjg@1521 | 98 | public String abstractClassParameterized2() { |
jjg@1521 | 99 | return "abstract class Test { abstract <K extends @TA Map<String, @TB String>, V extends @TC List<@TD List<@TE Object>>> void test(); }"; |
jjg@1521 | 100 | } |
jjg@1521 | 101 | |
jjg@1521 | 102 | @TADescriptions({ |
jjg@1521 | 103 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1), |
jjg@1521 | 104 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1) |
jjg@1521 | 105 | }) |
jjg@1521 | 106 | public String abstractClassParameterized3() { |
jjg@1521 | 107 | return "abstract class Test { abstract <K extends @TA List<String>, V extends @TB List<Object>> void test(); }"; |
jjg@1521 | 108 | } |
jjg@1521 | 109 | |
jjg@1521 | 110 | @TADescriptions({ |
jjg@1521 | 111 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, paramIndex = 0), |
jjg@1521 | 112 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0), |
jjg@1521 | 113 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER, paramIndex = 1), |
jjg@1521 | 114 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0), |
jjg@1521 | 115 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1) |
jjg@1521 | 116 | }) |
jjg@1521 | 117 | public String regularInterface() { |
jjg@1521 | 118 | return "interface Test { <@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> void test(); }"; |
jjg@1521 | 119 | } |
jjg@1521 | 120 | |
jjg@1521 | 121 | @TADescriptions({ |
jjg@1521 | 122 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1), |
jjg@1521 | 123 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}), |
jjg@1521 | 124 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1), |
jjg@1521 | 125 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}), |
jjg@1521 | 126 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}), |
jjg@1521 | 127 | @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0), |
jjg@1521 | 128 | @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0), |
jjg@1521 | 129 | @TADescription(annotation = "TH", type = METHOD_TYPE_PARAMETER, paramIndex = 0), |
jjg@1521 | 130 | @TADescription(annotation = "TI", type = METHOD_TYPE_PARAMETER, paramIndex = 1) |
jjg@1521 | 131 | }) |
jjg@1521 | 132 | public String regularInterfaceParameterized() { |
jjg@1521 | 133 | return "interface Test { <@TH K extends @TG Object & @TA Map<String, @TB String>, @TI V extends @TF Object & @TC List<@TD List<@TE Object>>> void test(); }"; |
jjg@1521 | 134 | } |
jjg@1521 | 135 | |
jjg@1521 | 136 | @TADescriptions({ |
jjg@1521 | 137 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1), |
jjg@1521 | 138 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}), |
jjg@1521 | 139 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1), |
jjg@1521 | 140 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}), |
jjg@1521 | 141 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}), |
jjg@1521 | 142 | @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER, paramIndex = 0), |
jjg@1521 | 143 | @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER, paramIndex = 1) |
jjg@1521 | 144 | }) |
jjg@1521 | 145 | public String regularInterfaceParameterized2() { |
jjg@1521 | 146 | return "interface Test { <@TF K extends @TA Map<String, @TB String>, @TG V extends @TC List<@TD List<@TE Object>>> void test(); }"; |
jjg@1521 | 147 | } |
jjg@1521 | 148 | |
jjg@1521 | 149 | @TADescription(annotation = "TA", type = METHOD_RETURN) |
jjg@1521 | 150 | public String useInReturn1() { |
jjg@1521 | 151 | return "class Test { <T> @TA T m() { throw new RuntimeException(); } }"; |
jjg@1521 | 152 | } |
jjg@1521 | 153 | |
jjg@1521 | 154 | @TADescription(annotation = "TA", type = METHOD_RETURN, genericLocation = {3, 0}) |
jjg@1521 | 155 | public String useInReturn2() { |
jjg@1521 | 156 | return "class Test { <T> Class<@TA T> m() { throw new RuntimeException(); } }"; |
jjg@1521 | 157 | } |
jjg@1521 | 158 | |
jjg@1521 | 159 | @TADescriptions({ |
jjg@1521 | 160 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0), |
jjg@1521 | 161 | @TADescription(annotation = "TB", type = METHOD_RETURN) |
jjg@1521 | 162 | }) |
jjg@1521 | 163 | public String useInReturn3() { |
jjg@1521 | 164 | return "class Test { <T extends @TA Object> @TB T m() { throw new RuntimeException(); } }"; |
jjg@1521 | 165 | } |
jjg@1521 | 166 | |
jjg@1521 | 167 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 168 | paramIndex = 0, genericLocation = {3, 0}) |
jjg@1521 | 169 | public String useInParam1() { |
jjg@1521 | 170 | return "class Test { <T> void m(Class<@TA T> p) { throw new RuntimeException(); } }"; |
jjg@1521 | 171 | } |
jjg@1521 | 172 | |
jjg@1521 | 173 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 174 | paramIndex = 0, genericLocation = {3, 0}) |
jjg@1521 | 175 | public String useInParam2() { |
jjg@1521 | 176 | return "class Test { void m(Class<@TA Object> p) { throw new RuntimeException(); } }"; |
jjg@1521 | 177 | } |
jjg@1521 | 178 | |
jjg@1521 | 179 | @TADescriptions({ |
jjg@1521 | 180 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1), |
jjg@1521 | 181 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 2), |
jjg@1521 | 182 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
jjg@1521 | 183 | }) |
jjg@1521 | 184 | public String useInParam3() { |
jjg@1521 | 185 | return "interface IA {} " + |
jjg@1521 | 186 | "interface IB<XB> {} " + |
jjg@1521 | 187 | "interface IC<XC> {} " + |
jjg@1521 | 188 | "class Test { <T extends @TA IB<IA> & @TB IC<IA>> void m(@TC T p) { throw new RuntimeException(); } }"; |
jjg@1521 | 189 | } |
jjg@1521 | 190 | |
jjg@1521 | 191 | @TADescriptions({ |
jjg@1521 | 192 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 193 | paramIndex = 0, boundIndex = 1, |
jjg@1521 | 194 | genericLocation = {}), |
jjg@1521 | 195 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 196 | paramIndex = 0, boundIndex = 2, |
jjg@1521 | 197 | genericLocation = {}), |
jjg@1521 | 198 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 199 | paramIndex = 0) |
jjg@1521 | 200 | }) |
jjg@1521 | 201 | public String useInParam4() { |
jjg@1521 | 202 | return "class Test {" + |
jjg@1521 | 203 | " interface IA {} " + |
jjg@1521 | 204 | " interface IB<XB> {} " + |
jjg@1521 | 205 | " interface IC<XC> {} " + |
jjg@1521 | 206 | " <T extends @TA IB<IA> & @TB IC<IA>> void m(@TC T p) { throw new RuntimeException(); } }"; |
jjg@1521 | 207 | } |
jjg@1521 | 208 | |
jjg@1521 | 209 | @TADescriptions({ |
jjg@1521 | 210 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 211 | paramIndex = 0, boundIndex = 0, |
jjg@1521 | 212 | genericLocation = {}), |
jjg@1521 | 213 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 214 | paramIndex = 0, boundIndex = 0, |
jjg@1521 | 215 | genericLocation = {1, 0}), |
jjg@1521 | 216 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 217 | paramIndex = 0, boundIndex = 0, |
jjg@1521 | 218 | genericLocation = {1, 0, 3, 0}), |
jjg@1521 | 219 | }) |
jjg@1521 | 220 | public String useInParam5() { |
jjg@1521 | 221 | return "class Test {" + |
jjg@1521 | 222 | " interface IA {} " + |
jjg@1521 | 223 | " class CB<XC> {} " + |
jjg@1521 | 224 | " <T extends @TA Test. @TB CB<@TC IA>> void m(T p) { throw new RuntimeException(); } }"; |
jjg@1521 | 225 | } |
jjg@1521 | 226 | |
jjg@1521 | 227 | @TADescriptions({ |
jjg@1521 | 228 | @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, |
jjg@1521 | 229 | paramIndex = 0), |
jjg@1521 | 230 | @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 231 | paramIndex = 0, boundIndex = 0, |
jjg@1521 | 232 | genericLocation = {}), |
jjg@1521 | 233 | @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 234 | paramIndex = 0, boundIndex = 0, |
jjg@1521 | 235 | genericLocation = {1, 0, 3, 0}), |
jjg@1521 | 236 | @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 237 | paramIndex = 0, boundIndex = 1, |
jjg@1521 | 238 | genericLocation = {}), |
jjg@1521 | 239 | @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, |
jjg@1521 | 240 | paramIndex = 0, boundIndex = 1, |
jjg@1521 | 241 | genericLocation = {3, 0}) |
jjg@1521 | 242 | }) |
jjg@1521 | 243 | public String useInParam6() { |
jjg@1521 | 244 | return "class Test {" + |
jjg@1521 | 245 | " interface IA {} " + |
jjg@1521 | 246 | " interface IB<XB> {} " + |
jjg@1521 | 247 | " class CC<XC> {} " + |
jjg@1521 | 248 | " interface ID<XD> {} " + |
jjg@1521 | 249 | " <@TA T extends @TB Test.CC<@TC IA> & Test. @TD ID<@TE IA>> void m(T p) { throw new RuntimeException(); } }"; |
jjg@1521 | 250 | } |
jjg@1521 | 251 | } |