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 parameters |
jjg@1521 | 29 | * @compile -g Driver.java ReferenceInfoUtil.java MethodParameters.java |
jjg@1521 | 30 | * @run main Driver MethodParameters |
jjg@1521 | 31 | */ |
jjg@1521 | 32 | public class MethodParameters { |
jjg@1521 | 33 | |
jjg@1521 | 34 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
jjg@1521 | 35 | public String methodParamAsPrimitive() { |
jjg@1521 | 36 | return "void test(@TA int a) { }"; |
jjg@1521 | 37 | } |
jjg@1521 | 38 | |
jjg@1521 | 39 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1) |
jjg@1521 | 40 | public String methodParamAsObject() { |
jjg@1521 | 41 | return "void test(Object b, @TA Object a) { }"; |
jjg@1521 | 42 | } |
jjg@1521 | 43 | |
jjg@1521 | 44 | @TADescriptions({ |
jjg@1521 | 45 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0), |
jjg@1521 | 46 | @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 47 | genericLocation = { 3, 0 }, paramIndex = 0), |
jjg@1521 | 48 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 49 | genericLocation = { 3, 1 }, paramIndex = 0), |
jjg@1521 | 50 | @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 51 | genericLocation = { 3, 1, 3, 0 }, paramIndex = 0) |
jjg@1521 | 52 | }) |
jjg@1521 | 53 | public String methodParamAsParametrized() { |
jjg@1521 | 54 | return "void test(@TA Map<@TB String, @TC List<@TD String>> a) { }"; |
jjg@1521 | 55 | } |
jjg@1521 | 56 | |
jjg@1521 | 57 | @TADescriptions({ |
jjg@1521 | 58 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0), |
jjg@1521 | 59 | @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 60 | genericLocation = { 3, 0 }, paramIndex = 0), |
jjg@1521 | 61 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 62 | genericLocation = { 3, 0, 2, 0 }, paramIndex = 0), |
jjg@1521 | 63 | @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 64 | genericLocation = { 3, 1 }, paramIndex = 0), |
jjg@1521 | 65 | @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 66 | genericLocation = { 3, 1, 3, 0 }, paramIndex = 0), |
jjg@1521 | 67 | @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 68 | genericLocation = { 3, 1, 3, 0, 2, 0 }, paramIndex = 0), |
jjg@1521 | 69 | @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 70 | genericLocation = { 3, 1, 3, 0, 2, 0, 3, 0 }, paramIndex = 0), |
jjg@1521 | 71 | @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 72 | genericLocation = { 3, 1, 3, 0, 2, 0, 3, 0, 2, 0 }, paramIndex = 0), |
jjg@1521 | 73 | @TADescription(annotation = "TI", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 74 | genericLocation = { 3, 1, 3, 0, 2, 0, 3, 1 }, paramIndex = 0), |
jjg@1521 | 75 | @TADescription(annotation = "TJ", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 76 | genericLocation = { 3, 1, 3, 0, 2, 0, 3, 1, 2, 0 }, paramIndex = 0) |
jjg@1521 | 77 | }) |
jjg@1521 | 78 | public String methodParamAsWildcard() { |
jjg@1521 | 79 | return "void test(@TA Map<@TB ? extends @TC String," + |
jjg@1521 | 80 | " @TD List<@TE ? extends @TF Map<@TG ? super @TH String," + |
jjg@1521 | 81 | " @TI ? extends @TJ Object>>> a) { }"; |
jjg@1521 | 82 | } |
jjg@1521 | 83 | |
jjg@1521 | 84 | @TADescriptions({ |
jjg@1521 | 85 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1), |
jjg@1521 | 86 | @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 87 | genericLocation = { 0, 0 }, paramIndex = 1), |
jjg@1521 | 88 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 89 | genericLocation = { 0, 0, 0, 0 }, paramIndex = 1) |
jjg@1521 | 90 | }) |
jjg@1521 | 91 | public String methodParamAsArray() { |
jjg@1521 | 92 | return "void test(Object b, @TC String @TA [] @TB [] a) { }"; |
jjg@1521 | 93 | } |
jjg@1521 | 94 | |
jjg@1521 | 95 | @TADescriptions({ |
jjg@1563 | 96 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, |
jjg@1563 | 97 | genericLocation = { 0, 0 }, paramIndex = 1), |
jjg@1563 | 98 | @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
jjg@1563 | 99 | genericLocation = { 0, 0 }, paramIndex = 1) |
jjg@1563 | 100 | }) |
jjg@1563 | 101 | public String methodParamAsArray2() { |
jjg@1563 | 102 | return "void test(Object b, @TA @TB String [] a) { }"; |
jjg@1563 | 103 | } |
jjg@1563 | 104 | |
jjg@1563 | 105 | @TADescriptions({ |
jjg@1563 | 106 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, |
jjg@1563 | 107 | genericLocation = { 0, 0 }, paramIndex = 1), |
jjg@1563 | 108 | @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
jjg@1563 | 109 | genericLocation = { 0, 0 }, paramIndex = 1), |
jjg@1563 | 110 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
jjg@1563 | 111 | genericLocation = { 0, 0 }, paramIndex = 1) |
jjg@1563 | 112 | }) |
jjg@1563 | 113 | public String methodParamAsArray3() { |
jjg@1563 | 114 | return "void test(Object b, @TA @TB @TC String [] a) { }"; |
jjg@1563 | 115 | } |
jjg@1563 | 116 | |
jjg@1563 | 117 | @TADescriptions({ |
jjg@1521 | 118 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1), |
jjg@1521 | 119 | @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 120 | genericLocation = { 0, 0 }, paramIndex = 1), |
jjg@1521 | 121 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 122 | genericLocation = { 0, 0, 0, 0 }, paramIndex = 1) |
jjg@1521 | 123 | }) |
jjg@1521 | 124 | public String methodParamAsVararg() { |
jjg@1521 | 125 | return "void test(Object b, @TC String @TA [] @TB ... a) { }"; |
jjg@1521 | 126 | } |
jjg@1521 | 127 | |
jjg@1521 | 128 | @TADescriptions({ |
jjg@1521 | 129 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1), |
jjg@1521 | 130 | @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 131 | genericLocation = { 0, 0 }, paramIndex = 1), |
jjg@1521 | 132 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 133 | genericLocation = { 0, 0, 0, 0 }, paramIndex = 1) |
jjg@1521 | 134 | }) |
jjg@1521 | 135 | public String methodParamAsFQVararg() { |
jjg@1521 | 136 | return "void test(Object b, java.lang.@TC String @TA [] @TB ... a) { }"; |
jjg@1521 | 137 | } |
jjg@1521 | 138 | |
jjg@1521 | 139 | @TADescriptions({}) |
jjg@1521 | 140 | public String methodWithDeclarationAnnotatin() { |
jjg@1521 | 141 | return "void test(@Decl String a) { }"; |
jjg@1521 | 142 | } |
jjg@1521 | 143 | |
jjg@1521 | 144 | @TADescriptions({}) |
jjg@1521 | 145 | public String methodWithNoTargetAnno() { |
jjg@1521 | 146 | return "void test(@A String a) { }"; |
jjg@1521 | 147 | } |
jjg@1521 | 148 | |
jjg@1521 | 149 | // Smoke tests |
jjg@1521 | 150 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
jjg@1521 | 151 | public String interfacemethodParamAsObject() { |
jjg@1521 | 152 | return "interface Test { void test(@TA Object a); }"; |
jjg@1521 | 153 | } |
jjg@1521 | 154 | |
jjg@1521 | 155 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 2) |
jjg@1521 | 156 | public String abstractmethodParamAsObject() { |
jjg@1521 | 157 | return "abstract class Test { abstract void test(Object b, Object c, @TA Object a); }"; |
jjg@1521 | 158 | } |
jjg@1521 | 159 | |
jjg@1521 | 160 | @TADescriptions({ |
jjg@1521 | 161 | @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0), |
jjg@1521 | 162 | @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 163 | genericLocation = { 3, 0 }, paramIndex = 0), |
jjg@1521 | 164 | @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 165 | genericLocation = { 3, 1 }, paramIndex = 0), |
jjg@1521 | 166 | @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER, |
jjg@1521 | 167 | genericLocation = { 3, 1, 3, 0 }, paramIndex = 0) |
jjg@1521 | 168 | }) |
jjg@1521 | 169 | public String interfacemethodParamAsParametrized() { |
jjg@1521 | 170 | return "interface Test { void test(@TA Map<@TB String, @TC List<@TD String>> a); }"; |
jjg@1521 | 171 | } |
jjg@1521 | 172 | |
jjg@1521 | 173 | } |