1 /* |
1 /* |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
40 public class MethodReferenceParserTest { |
40 public class MethodReferenceParserTest { |
41 |
41 |
42 static int checkCount = 0; |
42 static int checkCount = 0; |
43 |
43 |
44 enum ReferenceKind { |
44 enum ReferenceKind { |
45 METHOD_REF("#Q##Gm"), |
45 METHOD_REF("#Q::#Gm"), |
46 CONSTRUCTOR_REF("#Q##Gnew"), |
46 CONSTRUCTOR_REF("#Q::#Gnew"), |
47 FALSE_REF("min < max"), |
47 FALSE_REF("min < max"), |
48 ERR_SUPER("#Q##Gsuper"), |
48 ERR_SUPER("#Q::#Gsuper"), |
49 ERR_METH0("#Q##Gm()"), |
49 ERR_METH0("#Q::#Gm()"), |
50 ERR_METH1("#Q##Gm(X)"), |
50 ERR_METH1("#Q::#Gm(X)"), |
51 ERR_CONSTR0("#Q##Gnew()"), |
51 ERR_CONSTR0("#Q::#Gnew()"), |
52 ERR_CONSTR1("#Q##Gnew(X)"); |
52 ERR_CONSTR1("#Q::#Gnew(X)"); |
53 |
53 |
54 String referenceTemplate; |
54 String referenceTemplate; |
55 |
55 |
56 ReferenceKind(String referenceTemplate) { |
56 ReferenceKind(String referenceTemplate) { |
57 this.referenceTemplate = referenceTemplate; |
57 this.referenceTemplate = referenceTemplate; |
108 SUPER("super"), |
108 SUPER("super"), |
109 NEW("new Foo()"), |
109 NEW("new Foo()"), |
110 METHOD("m()"), |
110 METHOD("m()"), |
111 FIELD("a.f"), |
111 FIELD("a.f"), |
112 UBOUND_SIMPLE("A"), |
112 UBOUND_SIMPLE("A"), |
|
113 UNBOUND_ARRAY1("int[]"), |
|
114 UNBOUND_ARRAY2("A<G>[][]"), |
113 UNBOUND_GENERIC1("A<X>"), |
115 UNBOUND_GENERIC1("A<X>"), |
114 UNBOUND_GENERIC2("A<X, Y>"), |
116 UNBOUND_GENERIC2("A<X, Y>"), |
115 UNBOUND_GENERIC3("A<? extends X, ? super Y>"), |
117 UNBOUND_GENERIC3("A<? extends X, ? super Y>"), |
116 UNBOUND_GENERIC4("A<int[], short[][]>"), |
118 UNBOUND_GENERIC4("A<int[], short[][]>"), |
117 NESTED_GENERIC1("A<A<X,Y>, A<X,Y>>"), |
119 NESTED_GENERIC1("A<A<X,Y>, A<X,Y>>"), |
123 this.qualifier = qualifier; |
125 this.qualifier = qualifier; |
124 } |
126 } |
125 } |
127 } |
126 |
128 |
127 enum ExprKind { |
129 enum ExprKind { |
128 NONE("#R#S"), |
130 NONE("#R::S"), |
129 SINGLE_PAREN1("(#R#S)"), |
131 SINGLE_PAREN1("(#R#S)"), |
130 SINGLE_PAREN2("(#R)#S"), |
132 SINGLE_PAREN2("(#R)#S"), |
131 DOUBLE_PAREN1("((#R#S))"), |
133 DOUBLE_PAREN1("((#R#S))"), |
132 DOUBLE_PAREN2("((#R)#S)"), |
134 DOUBLE_PAREN2("((#R)#S)"), |
133 DOUBLE_PAREN3("((#R))#S"); |
135 DOUBLE_PAREN3("((#R))#S"); |