test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java

changeset 2150
ae4f5cb78ebd
parent 1969
7de231613e4a
child 2525
2eb010b6cb22
child 2612
cb7e7928902f
equal deleted inserted replaced
2149:e5d3cd43c85e 2150:ae4f5cb78ebd
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 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 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 */ 22 */
23 23
24 import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
25
26 /* 24 /*
27 * @test 25 * @test
26 * @bug 8026791
28 * @summary Test population of reference info for constructor results 27 * @summary Test population of reference info for constructor results
29 * @compile -g Driver.java ReferenceInfoUtil.java Constructors.java 28 * @compile -g Driver.java ReferenceInfoUtil.java Constructors.java
30 * @run main Driver Constructors 29 * @run main Driver Constructors
31 */ 30 */
31
32 import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
33
32 public class Constructors { 34 public class Constructors {
33 35
34 @TADescriptions({ 36 @TADescriptions({
35 @TADescription(annotation = "TA", type = METHOD_RETURN), 37 @TADescription(annotation = "TA", type = METHOD_RETURN),
36 @TADescription(annotation = "TB", type = METHOD_RETURN), 38 @TADescription(annotation = "TB", type = METHOD_RETURN),
40 return "class Test { @TA Test() {}" + 42 return "class Test { @TA Test() {}" +
41 " @TB Test(@TC int b) {} }"; 43 " @TB Test(@TC int b) {} }";
42 } 44 }
43 45
44 @TADescriptions({ 46 @TADescriptions({
45 @TADescription(annotation = "TA", type = METHOD_RETURN), 47 @TADescription(annotation = "TA", type = METHOD_RETURN, genericLocation = {1, 0}),
46 @TADescription(annotation = "TB", type = METHOD_RETURN), 48 @TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0}),
47 @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) 49 @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
48 }) 50 })
49 @TestClass("Test$Inner") 51 @TestClass("Test$Inner")
50 public String innerClass() { 52 public String innerClass() {
51 return "class Test { class Inner {" + 53 return "class Test { class Inner {" +
54 " } }"; 56 " } }";
55 } 57 }
56 58
57 @TADescriptions({ 59 @TADescriptions({
58 @TADescription(annotation = "TA", type = METHOD_RECEIVER), 60 @TADescription(annotation = "TA", type = METHOD_RECEIVER),
59 @TADescription(annotation = "TB", type = METHOD_RETURN), 61 @TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0}),
60 @TADescription(annotation = "TC", type = METHOD_RECEIVER), 62 @TADescription(annotation = "TC", type = METHOD_RECEIVER),
61 @TADescription(annotation = "TD", type = METHOD_RETURN), 63 @TADescription(annotation = "TD", type = METHOD_RETURN, genericLocation = {1, 0}),
62 @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) 64 @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
63 }) 65 })
64 @TestClass("Test$Inner") 66 @TestClass("Test$Inner")
65 public String innerClass2() { 67 public String innerClass2() {
66 return "class Test { class Inner {" + 68 return "class Test { class Inner {" +
70 } 72 }
71 73
72 @TADescriptions({ 74 @TADescriptions({
73 @TADescription(annotation = "TA", type = METHOD_RECEIVER), 75 @TADescription(annotation = "TA", type = METHOD_RECEIVER),
74 @TADescription(annotation = "TB", type = METHOD_RECEIVER, genericLocation = {1, 0}), 76 @TADescription(annotation = "TB", type = METHOD_RECEIVER, genericLocation = {1, 0}),
75 @TADescription(annotation = "TC", type = METHOD_RETURN), 77 @TADescription(annotation = "TC", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}),
76 @TADescription(annotation = "TD", type = METHOD_RECEIVER, genericLocation = {1, 0}), 78 @TADescription(annotation = "TD", type = METHOD_RECEIVER, genericLocation = {1, 0}),
77 @TADescription(annotation = "TE", type = METHOD_RETURN), 79 @TADescription(annotation = "TE", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}),
78 @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) 80 @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
79 }) 81 })
80 @TestClass("Outer$Middle$Inner") 82 @TestClass("Outer$Middle$Inner")
81 public String innerClass3() { 83 public String innerClass3() {
82 return "class Outer { class Middle { class Inner {" + 84 return "class Outer { class Middle { class Inner {" +

mercurial