author | jjg |
Sun, 20 Oct 2013 12:46:12 -0700 | |
changeset 21481 | f0aeb1da97bd |
parent 19651 | b1aa46cc2198 |
child 24896 | 986d876a9121 |
permissions | -rw-r--r-- |
15385 | 1 |
/* |
17578 | 2 |
* Copyright (c) 2012, 2013, 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 |
/* |
|
25 |
* @test |
|
21481
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
26 |
* @bug 8026791 |
15385 | 27 |
* @summary Test population of reference info for constructor results |
28 |
* @compile -g Driver.java ReferenceInfoUtil.java Constructors.java |
|
29 |
* @run main Driver Constructors |
|
30 |
*/ |
|
21481
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
31 |
|
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
32 |
import static com.sun.tools.classfile.TypeAnnotation.TargetType.*; |
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
33 |
|
15385 | 34 |
public class Constructors { |
35 |
||
36 |
@TADescriptions({ |
|
37 |
@TADescription(annotation = "TA", type = METHOD_RETURN), |
|
38 |
@TADescription(annotation = "TB", type = METHOD_RETURN), |
|
39 |
@TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
|
40 |
}) |
|
41 |
public String regularClass() { |
|
42 |
return "class Test { @TA Test() {}" + |
|
43 |
" @TB Test(@TC int b) {} }"; |
|
44 |
} |
|
45 |
||
46 |
@TADescriptions({ |
|
21481
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
47 |
@TADescription(annotation = "TA", type = METHOD_RETURN, genericLocation = {1, 0}), |
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
48 |
@TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0}), |
15385 | 49 |
@TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
50 |
}) |
|
51 |
@TestClass("Test$Inner") |
|
52 |
public String innerClass() { |
|
53 |
return "class Test { class Inner {" + |
|
54 |
" @TA Inner() {}" + |
|
55 |
" @TB Inner(@TC int b) {}" + |
|
56 |
" } }"; |
|
57 |
} |
|
58 |
||
59 |
@TADescriptions({ |
|
60 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER), |
|
21481
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
61 |
@TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0}), |
15385 | 62 |
@TADescription(annotation = "TC", type = METHOD_RECEIVER), |
21481
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
63 |
@TADescription(annotation = "TD", type = METHOD_RETURN, genericLocation = {1, 0}), |
15385 | 64 |
@TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
65 |
}) |
|
66 |
@TestClass("Test$Inner") |
|
67 |
public String innerClass2() { |
|
68 |
return "class Test { class Inner {" + |
|
69 |
" @TB Inner(@TA Test Test.this) {}" + |
|
70 |
" @TD Inner(@TC Test Test.this, @TE int b) {}" + |
|
71 |
" } }"; |
|
72 |
} |
|
17578 | 73 |
|
74 |
@TADescriptions({ |
|
75 |
@TADescription(annotation = "TA", type = METHOD_RECEIVER), |
|
76 |
@TADescription(annotation = "TB", type = METHOD_RECEIVER, genericLocation = {1, 0}), |
|
21481
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
77 |
@TADescription(annotation = "TC", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}), |
17578 | 78 |
@TADescription(annotation = "TD", type = METHOD_RECEIVER, genericLocation = {1, 0}), |
21481
f0aeb1da97bd
8026791: wrong type_path encoded for method_return on an inner class constructor
jjg
parents:
19651
diff
changeset
|
79 |
@TADescription(annotation = "TE", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}), |
17578 | 80 |
@TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) |
81 |
}) |
|
82 |
@TestClass("Outer$Middle$Inner") |
|
83 |
public String innerClass3() { |
|
84 |
return "class Outer { class Middle { class Inner {" + |
|
85 |
" @TC Inner(@TA Outer. @TB Middle Middle.this) {}" + |
|
86 |
" @TE Inner(@TD Middle Outer.Middle.this, @TF int b) {}" + |
|
87 |
" } } }"; |
|
88 |
} |
|
89 |
||
19651 | 90 |
@TADescriptions({ |
91 |
@TADescription(annotation = "TA", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, |
|
92 |
typeIndex = 0, offset = 4), |
|
93 |
@TADescription(annotation = "TB", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, |
|
94 |
typeIndex = 0, offset = 0) |
|
95 |
}) |
|
96 |
public String generic1() { |
|
97 |
return "class Test { <T> Test(int i) { new <@TA T>Test(); }" + |
|
98 |
" <T> Test() { <@TB String>this(0); } }"; |
|
99 |
} |
|
100 |
||
101 |
@TADescriptions({ |
|
102 |
@TADescription(annotation = "TA", type = CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, |
|
103 |
typeIndex = 0, offset = 0) |
|
104 |
}) |
|
105 |
public String generic2() { |
|
106 |
return "class Super { <T> Super(int i) { } } " + |
|
107 |
"class Test extends Super { <T> Test() { <@TA String>super(0); } }"; |
|
108 |
} |
|
109 |
||
15385 | 110 |
} |