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) 2009, 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:
17578
diff
changeset
|
28 |
* @bug 8042451 |
15385 | 29 |
* @summary Test population of reference info for method exception clauses |
30846 | 30 |
* @modules jdk.jdeps/com.sun.tools.classfile |
15385 | 31 |
* @compile -g Driver.java ReferenceInfoUtil.java MethodThrows.java |
32 |
* @run main Driver MethodThrows |
|
33 |
*/ |
|
34 |
public class MethodThrows { |
|
35 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
36 |
@TADescription(annotation = "TA", type = THROWS, typeIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
37 |
@TADescription(annotation = "TB", type = THROWS, typeIndex = 2) |
15385 | 38 |
public String regularMethod() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
39 |
return "class %TEST_CLASS_NAME% { void test() throws @TA RuntimeException, IllegalArgumentException, @TB Exception { } }"; |
15385 | 40 |
} |
41 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
42 |
@TADescription(annotation = "TA", type = THROWS, typeIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
43 |
@TADescription(annotation = "TB", type = THROWS, typeIndex = 2) |
15385 | 44 |
public String abstractMethod() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
45 |
return "abstract class %TEST_CLASS_NAME% { abstract void test() throws @TA RuntimeException, IllegalArgumentException, @TB Exception; }"; |
15385 | 46 |
} |
47 |
||
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
48 |
@TADescription(annotation = "TA", type = THROWS, typeIndex = 0) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
49 |
@TADescription(annotation = "TB", type = THROWS, typeIndex = 2) |
15385 | 50 |
public String interfaceMethod() { |
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
51 |
return "interface %TEST_CLASS_NAME% { void test() throws @TA RuntimeException, IllegalArgumentException, @TB Exception; }"; |
15385 | 52 |
} |
17578 | 53 |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
54 |
@TADescription(annotation = "TA", type = THROWS, typeIndex = 0, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
55 |
genericLocation = {}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
56 |
@TADescription(annotation = "TB", type = THROWS, typeIndex = 0, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
57 |
genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
58 |
@TADescription(annotation = "TC", type = THROWS, typeIndex = 0, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
59 |
genericLocation = {1, 0, 1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
60 |
@TADescription(annotation = "TD", type = THROWS, typeIndex = 1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
61 |
genericLocation = {}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
62 |
@TADescription(annotation = "TE", type = THROWS, typeIndex = 1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
63 |
genericLocation = {1, 0}) |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
64 |
@TADescription(annotation = "TF", type = THROWS, typeIndex = 1, |
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
65 |
genericLocation = {1, 0, 1, 0}) |
17578 | 66 |
public String NestedTypes() { |
67 |
return "class Outer { class Middle { class Inner1 extends Exception {}" + |
|
68 |
" class Inner2 extends Exception{} } }" + |
|
24896
986d876a9121
8042451: Write tests for all possible kinds of type annotation
aeremeev
parents:
17578
diff
changeset
|
69 |
"class %TEST_CLASS_NAME% { void test() throws @TA Outer.@TB Middle.@TC Inner1, @TD Outer.@TE Middle.@TF Inner2 { } }"; |
17578 | 70 |
} |
15385 | 71 |
} |