author | mchung |
Wed, 27 May 2015 13:25:18 -0700 | |
changeset 30846 | 2b3f379840f0 |
parent 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
15385 | 1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
24896
diff
changeset
|
2 |
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
15385 | 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 |
import static com.sun.tools.classfile.TypeAnnotation.TargetType.*; |
|
25 |
||
26 |
/* |
|
27 |
* @test |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
28 |
* @bug 8028576 8042451 |
15385 | 29 |
* @summary Test population of reference info for exception parameters |
30 |
* @author Werner Dietl |
|
30846 | 31 |
* @modules jdk.jdeps/com.sun.tools.classfile |
15385 | 32 |
* @compile -g Driver.java ReferenceInfoUtil.java ExceptionParameters.java |
33 |
* @run main Driver ExceptionParameters |
|
34 |
*/ |
|
35 |
public class ExceptionParameters { |
|
36 |
||
37 |
@TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
|
38 |
public String exception() { |
|
39 |
return "void exception() { try { new Object(); } catch(@TA Exception e) { } }"; |
|
40 |
} |
|
41 |
||
42 |
@TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
|
43 |
public String finalException() { |
|
44 |
return "void finalException() { try { new Object(); } catch(final @TA Exception e) { } }"; |
|
45 |
} |
|
46 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
47 |
@TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
48 |
@TADescription(annotation = "TB", type = EXCEPTION_PARAMETER, exceptionIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
49 |
@TADescription(annotation = "TC", type = EXCEPTION_PARAMETER, exceptionIndex = 2) |
17578 | 50 |
public String multipleExceptions1() { |
15385 | 51 |
return "void multipleExceptions() { " + |
52 |
"try { new Object(); } catch(@TA Exception e) { }" + |
|
53 |
"try { new Object(); } catch(@TB Exception e) { }" + |
|
54 |
"try { new Object(); } catch(@TC Exception e) { }" + |
|
55 |
" }"; |
|
56 |
} |
|
17578 | 57 |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
58 |
@TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
59 |
@TADescription(annotation = "TB", type = EXCEPTION_PARAMETER, exceptionIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
60 |
@TADescription(annotation = "TC", type = EXCEPTION_PARAMETER, exceptionIndex = 2) |
17578 | 61 |
public String multipleExceptions2() { |
62 |
return "void multipleExceptions() { " + |
|
63 |
" try { new Object(); " + |
|
64 |
" try { new Object(); " + |
|
65 |
" try { new Object(); } catch(@TA Exception e) { }" + |
|
66 |
" } catch(@TB Exception e) { }" + |
|
67 |
" } catch(@TC Exception e) { }" + |
|
68 |
"}"; |
|
69 |
} |
|
70 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
71 |
@TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
72 |
@TADescription(annotation = "TB", type = EXCEPTION_PARAMETER, exceptionIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
73 |
@TADescription(annotation = "TC", type = EXCEPTION_PARAMETER, exceptionIndex = 2) |
17578 | 74 |
public String multipleExceptions3() { |
75 |
return "void multipleExceptions() { " + |
|
76 |
" try { new Object(); " + |
|
77 |
" } catch(@TA Exception e1) { "+ |
|
78 |
" try { new Object(); " + |
|
79 |
" } catch(@TB Exception e2) {" + |
|
80 |
" try { new Object(); } catch(@TC Exception e3) { }" + |
|
81 |
" }" + |
|
82 |
" }" + |
|
83 |
"}"; |
|
84 |
} |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
85 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
86 |
@TADescription(annotation = "RTAs", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
87 |
public String exceptionRepeatableAnnoation() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
88 |
return "void exception() { try { new Object(); } catch(@RTA @RTA Exception e) { } }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
89 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
90 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
91 |
@TADescription(annotation = "RTAs", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
92 |
@TADescription(annotation = "RTBs", type = EXCEPTION_PARAMETER, exceptionIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
93 |
@TADescription(annotation = "RTCs", type = EXCEPTION_PARAMETER, exceptionIndex = 2) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
94 |
public String multipleExceptionsRepeatableAnnotation1() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
95 |
return "void multipleExceptions() { " + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
96 |
"try { new Object(); } catch(@RTA @RTA Exception e) { }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
97 |
"try { new Object(); } catch(@RTB @RTB Exception e) { }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
98 |
"try { new Object(); } catch(@RTC @RTC Exception e) { }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
99 |
" }"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
100 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
101 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
102 |
@TADescription(annotation = "RTAs", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
103 |
@TADescription(annotation = "RTBs", type = EXCEPTION_PARAMETER, exceptionIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
104 |
@TADescription(annotation = "RTCs", type = EXCEPTION_PARAMETER, exceptionIndex = 2) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
105 |
public String multipleExceptionsRepeatableAnnotation2() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
106 |
return "void multipleExceptions() { " + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
107 |
" try { new Object(); " + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
108 |
" try { new Object(); " + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
109 |
" try { new Object(); } catch(@RTA @RTA Exception e) { }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
110 |
" } catch(@RTB @RTB Exception e) { }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
111 |
" } catch(@RTC @RTC Exception e) { }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
112 |
"}"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
113 |
} |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
114 |
|
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
115 |
@TADescription(annotation = "RTAs", type = EXCEPTION_PARAMETER, exceptionIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
116 |
@TADescription(annotation = "RTBs", type = EXCEPTION_PARAMETER, exceptionIndex = 1) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
117 |
@TADescription(annotation = "RTCs", type = EXCEPTION_PARAMETER, exceptionIndex = 2) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
118 |
public String multipleExceptionsRepeatableAnnotation3() { |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
119 |
return "void multipleExceptions() { " + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
120 |
" try { new Object(); " + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
121 |
" } catch(@RTA @RTA Exception e1) { "+ |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
122 |
" try { new Object(); " + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
123 |
" } catch(@RTB @RTB Exception e2) {" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
124 |
" try { new Object(); } catch(@RTC @RTC Exception e3) { }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
125 |
" }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
126 |
" }" + |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
127 |
"}"; |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
22443
diff
changeset
|
128 |
} |
15385 | 129 |
} |