author | dholmes |
Sat, 23 Jun 2018 01:32:41 -0400 | |
changeset 50735 | 2f2af62dfac7 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1 |
/* |
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
4 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
8 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
13 |
* accompanied this code). |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
14 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
18 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
21 |
* questions. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
22 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
23 |
|
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
24 |
package annotations.classfile; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
25 |
|
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
26 |
import java.io.*; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
27 |
import java.net.URL; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
28 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
29 |
import com.sun.tools.classfile.*; |
36526 | 30 |
import com.sun.tools.classfile.ConstantPool.InvalidIndex; |
31 |
import com.sun.tools.classfile.ConstantPool.UnexpectedEntry; |
|
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
32 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
33 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
34 |
* A class providing utilities for writing tests that inspect class |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
35 |
* files directly, looking for specific type annotations. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
36 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
37 |
* Note: this framework does not currently handle repeating |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
38 |
* annotations. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
39 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
40 |
public class ClassfileInspector { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
41 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
42 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
43 |
* A group of expected annotations to be found in a given class. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
44 |
* If the class name is null, then the template will be applied to |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
45 |
* every class. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
46 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
47 |
public static class Expected { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
48 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
49 |
* The name of the class. If {@code null} this template will |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
50 |
* apply to every class; otherwise, it will only be applied to |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
51 |
* the named class. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
52 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
53 |
public final String classname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
54 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
55 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
56 |
* The expected class annotations. These will be checked |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
57 |
* against the class' attributes. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
58 |
*/ |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
59 |
public final ExpectedAnnotation[] classAnnos; |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
60 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
61 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
62 |
* The expected method annotations. These will be checked |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
63 |
* against all methods in the class. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
64 |
*/ |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
65 |
public final ExpectedMethodAnnotation[] methodAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
66 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
67 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
68 |
* The expected method parameter annotations. These will be checked |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
69 |
* against all methods in the class. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
70 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
71 |
public final ExpectedParameterAnnotation[] methodParamAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
72 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
73 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
74 |
* The expected field type annotations. These will be checked |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
75 |
* against all fields in the class. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
76 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
77 |
public final ExpectedFieldAnnotation[] fieldAnnos; |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
78 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
79 |
/** |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
80 |
* The expected class type annotations. These will be checked |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
81 |
* against the class' attributes. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
82 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
83 |
public final ExpectedTypeAnnotation[] classTypeAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
84 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
85 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
86 |
* The expected method type annotations. These will be checked |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
87 |
* against all methods in the class. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
88 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
89 |
public final ExpectedMethodTypeAnnotation[] methodTypeAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
90 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
91 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
92 |
* The expected field type annotations. These will be checked |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
93 |
* against all fields in the class. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
94 |
*/ |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
95 |
public final ExpectedFieldTypeAnnotation[] fieldTypeAnnos; |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
96 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
97 |
/** |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
98 |
* Create an {@code Expected} from all components. |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
99 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
100 |
* @param classname The name of the class to match, or {@code |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
101 |
* null} for all classes. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
102 |
* @param classAnnos The expected class annotations. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
103 |
* @param methodAnnos The expected method annotations. |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
104 |
* @param methodParamAnnos The expected method parameter annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
105 |
* @param fieldAnnos The expected field annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
106 |
* @param classTypeAnnos The expected class type annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
107 |
* @param methodTypeAnnos The expected method type annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
108 |
* @param fieldTypeAnnos The expected field type annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
109 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
110 |
public Expected(String classname, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
111 |
ExpectedAnnotation[] classAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
112 |
ExpectedMethodAnnotation[] methodAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
113 |
ExpectedParameterAnnotation[] methodParamAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
114 |
ExpectedFieldAnnotation[] fieldAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
115 |
ExpectedTypeAnnotation[] classTypeAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
116 |
ExpectedMethodTypeAnnotation[] methodTypeAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
117 |
ExpectedFieldTypeAnnotation[] fieldTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
118 |
this.classname = classname; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
119 |
this.classAnnos = classAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
120 |
this.methodAnnos = methodAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
121 |
this.methodParamAnnos = methodParamAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
122 |
this.fieldAnnos = fieldAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
123 |
this.classTypeAnnos = classTypeAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
124 |
this.methodTypeAnnos = methodTypeAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
125 |
this.fieldTypeAnnos = fieldTypeAnnos; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
126 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
127 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
128 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
129 |
* Create an {@code Expected} from regular annotation components. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
130 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
131 |
* @param classname The name of the class to match, or {@code |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
132 |
* null} for all classes. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
133 |
* @param classAnnos The expected class annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
134 |
* @param methodAnnos The expected method annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
135 |
* @param methodParamAnnos The expected method parameter annotations. |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
136 |
* @param fieldAnnos The expected field annotations. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
137 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
138 |
public Expected(String classname, |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
139 |
ExpectedAnnotation[] classAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
140 |
ExpectedMethodAnnotation[] methodAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
141 |
ExpectedParameterAnnotation[] methodParamAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
142 |
ExpectedFieldAnnotation[] fieldAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
143 |
this(classname, classAnnos, methodAnnos, methodParamAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
144 |
fieldAnnos, null, null, null); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
145 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
146 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
147 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
148 |
* Create an {@code Expected} from type annotation components. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
149 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
150 |
* @param classname The name of the class to match, or {@code |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
151 |
* null} for all classes. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
152 |
* @param classTypeAnnos The expected class type annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
153 |
* @param methodTypeAnnos The expected method type annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
154 |
* @param fieldTypeAnnos The expected field type annotations. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
155 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
156 |
public Expected(String classname, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
157 |
ExpectedTypeAnnotation[] classTypeAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
158 |
ExpectedMethodTypeAnnotation[] methodTypeAnnos, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
159 |
ExpectedFieldTypeAnnotation[] fieldTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
160 |
this(classname, null, null, null, null, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
161 |
classTypeAnnos, methodTypeAnnos, fieldTypeAnnos); |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
162 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
163 |
|
36526 | 164 |
@Override |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
165 |
public String toString() { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
166 |
final StringBuilder sb = new StringBuilder(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
167 |
final String newline = System.lineSeparator(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
168 |
sb.append("Expected on class ").append(classname); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
169 |
if (null != classAnnos) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
170 |
sb.append(newline).append("Class annotations:").append(newline); |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
171 |
for(ExpectedAnnotation anno : classAnnos) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
172 |
sb.append(anno).append(newline); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
173 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
174 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
175 |
if (null != methodAnnos) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
176 |
sb.append(newline).append("Method annotations:").append(newline); |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
177 |
for(ExpectedAnnotation anno : methodAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
178 |
sb.append(anno).append(newline); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
179 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
180 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
181 |
if (null != methodParamAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
182 |
sb.append(newline).append("Method param annotations:").append(newline); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
183 |
for(ExpectedAnnotation anno : methodParamAnnos) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
184 |
sb.append(anno).append(newline); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
185 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
186 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
187 |
if (null != fieldAnnos) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
188 |
sb.append(newline).append("Field annotations:").append(newline); |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
189 |
for(ExpectedAnnotation anno : fieldAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
190 |
sb.append(anno).append(newline); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
191 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
192 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
193 |
if (null != classTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
194 |
sb.append(newline).append("Class type annotations:").append(newline); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
195 |
for(ExpectedAnnotation anno : classTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
196 |
sb.append(anno).append(newline); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
197 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
198 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
199 |
if (null != methodTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
200 |
sb.append(newline).append("Method type annotations:").append(newline); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
201 |
for(ExpectedAnnotation anno : methodTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
202 |
sb.append(anno).append(newline); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
203 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
204 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
205 |
if (null != fieldTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
206 |
sb.append(newline).append("Field type annotations:").append(newline); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
207 |
for(ExpectedAnnotation anno : fieldTypeAnnos) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
208 |
sb.append(anno).append(newline); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
209 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
210 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
211 |
return sb.toString(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
212 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
213 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
214 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
215 |
* See if this template applies to a class. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
216 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
217 |
* @param classname The classname to check. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
218 |
* @return Whether or not this template should apply. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
219 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
220 |
public boolean matchClassName(String classname) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
221 |
return this.classname == null || this.classname.equals(classname); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
222 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
223 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
224 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
225 |
* After applying the template to all classes, check to see if |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
226 |
* any of the expected annotations weren't matched. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
227 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
228 |
* @return The number of missed matches. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
229 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
230 |
public int check() { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
231 |
int count = 0; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
232 |
if (classAnnos != null) { |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
233 |
for(ExpectedAnnotation expected : classAnnos) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
234 |
if (!expected.check()) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
235 |
count++; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
236 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
237 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
238 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
239 |
if (methodAnnos != null) { |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
240 |
for(ExpectedAnnotation expected : methodAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
241 |
if (!expected.check()) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
242 |
count++; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
243 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
244 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
245 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
246 |
if (methodParamAnnos != null) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
247 |
for(ExpectedAnnotation expected : methodParamAnnos) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
248 |
if (!expected.check()) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
249 |
count++; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
250 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
251 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
252 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
253 |
if (fieldAnnos != null) { |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
254 |
for(ExpectedAnnotation expected : fieldAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
255 |
if (!expected.check()) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
256 |
count++; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
257 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
258 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
259 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
260 |
if (classTypeAnnos != null) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
261 |
for(ExpectedAnnotation expected : classTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
262 |
if (!expected.check()) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
263 |
count++; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
264 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
265 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
266 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
267 |
if (methodTypeAnnos != null) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
268 |
for(ExpectedAnnotation expected : methodTypeAnnos) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
269 |
if (!expected.check()) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
270 |
count++; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
271 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
272 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
273 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
274 |
if (fieldTypeAnnos != null) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
275 |
for(ExpectedAnnotation expected : fieldTypeAnnos) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
276 |
if (!expected.check()) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
277 |
count++; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
278 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
279 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
280 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
281 |
return count; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
282 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
283 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
284 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
285 |
/** |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
286 |
* An expected annotation. This is both a superclass for |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
287 |
* method, field, and type annotations, as well as a class for |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
288 |
* annotations on a class. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
289 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
290 |
public static class ExpectedAnnotation { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
291 |
protected int count = 0; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
292 |
protected final String expectedName; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
293 |
protected final int expectedCount; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
294 |
protected final boolean visibility; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
295 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
296 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
297 |
* Create an {@code ExpectedAnnotation} from its |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
298 |
* components. It is usually a better idea to use a {@code |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
299 |
* Builder} to do this. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
300 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
301 |
* @param expectedName The expected annotation name. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
302 |
* @param visibility Whether this annotation should be runtime-visible. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
303 |
* @param expectedCount The number of annotations that should |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
304 |
* be seen. If 0, this asserts that the |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
305 |
* described annotation is not present. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
306 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
307 |
public ExpectedAnnotation(String expectedName, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
308 |
boolean visibility, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
309 |
int expectedCount) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
310 |
this.expectedName = expectedName; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
311 |
this.visibility = visibility; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
312 |
this.expectedCount = expectedCount; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
313 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
314 |
|
36526 | 315 |
@Override |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
316 |
public String toString() { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
317 |
final StringBuilder sb = new StringBuilder(); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
318 |
sb.append("Expected "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
319 |
sb.append(expectedCount); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
320 |
sb.append(" annotation "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
321 |
sb.append(expectedName); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
322 |
sb.append(visibility ? ", runtime visibile " : ", runtime invisibile "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
323 |
return sb.toString(); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
324 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
325 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
326 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
327 |
* See if this template matches the given visibility. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
328 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
329 |
* @param Whether or not the annotation is visible at runtime. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
330 |
* @return Whether or not this template matches the visibility. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
331 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
332 |
public boolean matchVisibility(boolean visibility) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
333 |
return this.visibility == visibility; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
334 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
335 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
336 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
337 |
* Attempty to match this template against an annotation. If |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
338 |
* it does match, then the match count for the template will |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
339 |
* be incremented. Otherwise, nothing will be done. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
340 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
341 |
* @param anno The annotation to attempt to match. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
342 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
343 |
public void matchAnnotation(ConstantPool cpool, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
344 |
Annotation anno) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
345 |
if (checkMatch(cpool, anno)) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
346 |
count++; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
347 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
348 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
349 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
350 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
351 |
* Indicate whether an annotation matches this expected |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
352 |
* annotation. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
353 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
354 |
* @param ConstantPool The constant pool to use. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
355 |
* @param anno The annotation to check. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
356 |
* @return Whether the annotation matches. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
357 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
358 |
protected boolean checkMatch(ConstantPool cpool, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
359 |
Annotation anno) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
360 |
try { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
361 |
return cpool.getUTF8Info(anno.type_index).value.equals("L" + expectedName + ";"); |
36526 | 362 |
} catch (InvalidIndex | UnexpectedEntry e) { |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
363 |
return false; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
364 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
365 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
366 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
367 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
368 |
* After all matching, check to see if the expected number of |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
369 |
* matches equals the actual number. If not, then print a |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
370 |
* failure message and return {@code false}. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
371 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
372 |
* @return Whether or not the expected number of matched |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
373 |
* equals the actual number. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
374 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
375 |
public boolean check() { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
376 |
if (count != expectedCount) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
377 |
System.err.println(this + ", but saw " + count); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
378 |
return false; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
379 |
} else { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
380 |
return true; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
381 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
382 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
383 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
384 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
385 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
386 |
* An annotation found on a method. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
387 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
388 |
public static class ExpectedMethodAnnotation extends ExpectedAnnotation { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
389 |
protected final String methodname; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
390 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
391 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
392 |
* Create an {@code ExpectedMethodAnnotation} from its |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
393 |
* components. It is usually a better idea to use a {@code |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
394 |
* Builder} to do this. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
395 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
396 |
* @param methodname The expected method name. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
397 |
* @param expectedName The expected annotation name. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
398 |
* @param visibility Whether this annotation should be runtime-visible. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
399 |
* @param expectedCount The number of annotations that should be seen. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
400 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
401 |
public ExpectedMethodAnnotation(String methodname, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
402 |
String expectedName, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
403 |
boolean visibility, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
404 |
int expectedCount) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
405 |
super(expectedName, visibility, expectedCount); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
406 |
this.methodname = methodname; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
407 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
408 |
|
36526 | 409 |
@Override |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
410 |
public String toString() { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
411 |
final StringBuilder sb = new StringBuilder(); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
412 |
sb.append("Expected "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
413 |
sb.append(expectedCount); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
414 |
sb.append(" annotation "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
415 |
sb.append(expectedName); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
416 |
sb.append(visibility ? ", runtime visibile " : ", runtime invisibile "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
417 |
sb.append(" on method "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
418 |
sb.append(methodname); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
419 |
return sb.toString(); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
420 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
421 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
422 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
423 |
* See if this template applies to a method. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
424 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
425 |
* @param methodname The method name to check. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
426 |
* @return Whether or not this template should apply. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
427 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
428 |
public boolean matchMethodName(String methodname) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
429 |
return this.methodname.equals(methodname); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
430 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
431 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
432 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
433 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
434 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
435 |
* An annotation found on a method parameter. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
436 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
437 |
public static class ExpectedParameterAnnotation |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
438 |
extends ExpectedMethodAnnotation { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
439 |
protected final int index; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
440 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
441 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
442 |
* Create an {@code ExpectedParameterAnnotation} from its |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
443 |
* components. It is usually a better idea to use a {@code |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
444 |
* Builder} to do this. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
445 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
446 |
* @param methodname The expected method name. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
447 |
* @param index The parameter index. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
448 |
* @param expectedName The expected annotation name. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
449 |
* @param visibility Whether this annotation should be runtime-visible. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
450 |
* @param expectedCount The number of annotations that should be seen. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
451 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
452 |
public ExpectedParameterAnnotation(String methodname, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
453 |
int index, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
454 |
String expectedName, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
455 |
boolean visibility, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
456 |
int expectedCount) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
457 |
super(methodname, expectedName, visibility, expectedCount); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
458 |
this.index = index; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
459 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
460 |
|
36526 | 461 |
@Override |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
462 |
public String toString() { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
463 |
final StringBuilder sb = new StringBuilder(); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
464 |
sb.append("Expected "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
465 |
sb.append(expectedCount); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
466 |
sb.append(" annotation "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
467 |
sb.append(expectedName); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
468 |
sb.append(visibility ? ", runtime visibile " : ", runtime invisibile "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
469 |
sb.append(" on method "); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
470 |
sb.append(methodname); |
36526 | 471 |
sb.append(" parameter "); |
472 |
sb.append(index); |
|
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
473 |
return sb.toString(); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
474 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
475 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
476 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
477 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
478 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
479 |
* An annotation found on a field. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
480 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
481 |
public static class ExpectedFieldAnnotation extends ExpectedAnnotation { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
482 |
private final String fieldname; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
483 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
484 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
485 |
* Create an {@code ExpectedFieldAnnotation} from its |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
486 |
* components. It is usually a better idea to use a {@code |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
487 |
* Builder} to do this. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
488 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
489 |
* @param fieldname The expected field name. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
490 |
* @param expectedName The expected annotation name. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
491 |
* @param visibility Whether this annotation should be runtime-visible. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
492 |
* @param expectedCount The number of annotations that should be seen. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
493 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
494 |
public ExpectedFieldAnnotation(String fieldname, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
495 |
String expectedName, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
496 |
boolean visibility, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
497 |
int expectedCount) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
498 |
super(expectedName, visibility, expectedCount); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
499 |
this.fieldname = fieldname; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
500 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
501 |
|
36526 | 502 |
@Override |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
503 |
public String toString() { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
504 |
final StringBuilder sb = new StringBuilder(); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
505 |
sb.append("Expected ").append(expectedCount) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
506 |
.append(" annotation ").append(expectedName) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
507 |
.append(visibility ? ", runtime visibile " : ", runtime invisibile ") |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
508 |
.append(" on field ").append(fieldname); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
509 |
return sb.toString(); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
510 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
511 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
512 |
/** |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
513 |
* See if this template applies to a field. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
514 |
* |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
515 |
* @param fieldname The field name to check. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
516 |
* @return Whether or not this template should apply. |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
517 |
*/ |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
518 |
public boolean matchFieldName(String fieldname) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
519 |
return this.fieldname.equals(fieldname); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
520 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
521 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
522 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
523 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
524 |
/** |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
525 |
* An expected type annotation. This is both a superclass for |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
526 |
* method and field type annotations, as well as a class for type |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
527 |
* annotations on a class. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
528 |
*/ |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
529 |
public static class ExpectedTypeAnnotation extends ExpectedAnnotation { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
530 |
protected final TypeAnnotation.TargetType targetType; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
531 |
protected final int bound_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
532 |
protected final int parameter_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
533 |
protected final int type_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
534 |
protected final int exception_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
535 |
protected final TypeAnnotation.Position.TypePathEntry[] typePath; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
536 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
537 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
538 |
* Create an {@code ExpectedTypeAnnotation} from its |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
539 |
* components. It is usually a better idea to use a {@code |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
540 |
* Builder} to do this. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
541 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
542 |
* @param expectedName The expected annotation name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
543 |
* @param visibility Whether this annotation should be runtime-visible. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
544 |
* @param expectedCount The number of annotations that should |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
545 |
* be seen. If 0, this asserts that the |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
546 |
* described annotation is not present. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
547 |
* @param targetType The expected target type. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
548 |
* @param bound_index The expected bound index, or {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
549 |
* @param parameter_index The expected parameter index, or |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
550 |
* {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
551 |
* @param type_index The expected type index, or {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
552 |
* @param exception_index The expected exception index, or |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
553 |
* {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
554 |
* @param typePath The expected type path. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
555 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
556 |
public ExpectedTypeAnnotation(String expectedName, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
557 |
boolean visibility, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
558 |
int expectedCount, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
559 |
TypeAnnotation.TargetType targetType, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
560 |
int bound_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
561 |
int parameter_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
562 |
int type_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
563 |
int exception_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
564 |
TypeAnnotation.Position.TypePathEntry... typePath) { |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
565 |
super(expectedName, visibility, expectedCount); |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
566 |
this.targetType = targetType; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
567 |
this.bound_index = bound_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
568 |
this.parameter_index = parameter_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
569 |
this.type_index = type_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
570 |
this.exception_index = exception_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
571 |
this.typePath = typePath; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
572 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
573 |
|
36526 | 574 |
@Override |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
575 |
public String toString() { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
576 |
final StringBuilder sb = new StringBuilder(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
577 |
sb.append("Expected "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
578 |
sb.append(expectedCount); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
579 |
sb.append(" annotation "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
580 |
sb.append(expectedName); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
581 |
sb.append(visibility ? ", runtime visibile " : ", runtime invisibile "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
582 |
sb.append(targetType); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
583 |
sb.append(", bound_index = "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
584 |
sb.append(bound_index); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
585 |
sb.append(", parameter_index = "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
586 |
sb.append(parameter_index); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
587 |
sb.append(", type_index = "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
588 |
sb.append(type_index); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
589 |
sb.append(", exception_index = "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
590 |
sb.append(exception_index); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
591 |
sb.append(", type_path = ["); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
592 |
for(int i = 0; i < typePath.length; i++) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
593 |
if (i != 0) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
594 |
sb.append(", "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
595 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
596 |
sb.append(typePath[i]); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
597 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
598 |
sb.append("]"); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
599 |
return sb.toString(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
600 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
601 |
|
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
602 |
@Override |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
603 |
public void matchAnnotation(ConstantPool cpool, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
604 |
Annotation anno) {} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
605 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
606 |
public void matchAnnotation(TypeAnnotation anno) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
607 |
if (checkMatch(anno)) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
608 |
count++; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
609 |
} |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
610 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
611 |
|
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
612 |
public boolean checkMatch(TypeAnnotation anno) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
613 |
boolean matches = checkMatch(anno.constant_pool, anno.annotation); |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
614 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
615 |
matches = matches && anno.position.type == targetType; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
616 |
matches = matches && anno.position.bound_index == bound_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
617 |
matches = matches && anno.position.parameter_index == parameter_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
618 |
matches = matches && anno.position.type_index == type_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
619 |
matches = matches && anno.position.exception_index == exception_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
620 |
matches = matches && anno.position.location.size() == typePath.length; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
621 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
622 |
if (matches) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
623 |
int i = 0; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
624 |
for(TypeAnnotation.Position.TypePathEntry entry : |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
625 |
anno.position.location) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
626 |
matches = matches && typePath[i++].equals(entry); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
627 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
628 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
629 |
|
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
630 |
return matches; |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
631 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
632 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
633 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
634 |
* A builder class for creating {@code |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
635 |
* ExpectedTypeAnnotation}s in a more convenient fashion. The |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
636 |
* constructor for {@code ExpectedTypeAnnotation} takes a |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
637 |
* large number of parameters (by necessity). This class |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
638 |
* allows users to construct a {@code ExpectedTypeAnnotation}s |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
639 |
* using only the ones they need. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
640 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
641 |
public static class Builder { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
642 |
protected final String expectedName; |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
643 |
protected final boolean visibility; |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
644 |
protected final int expectedCount; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
645 |
protected final TypeAnnotation.TargetType targetType; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
646 |
protected int bound_index = Integer.MIN_VALUE; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
647 |
protected int parameter_index = Integer.MIN_VALUE; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
648 |
protected int type_index = Integer.MIN_VALUE; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
649 |
protected int exception_index = Integer.MIN_VALUE; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
650 |
protected TypeAnnotation.Position.TypePathEntry[] typePath = |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
651 |
new TypeAnnotation.Position.TypePathEntry[0]; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
652 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
653 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
654 |
* Create a {@code Builder} from the mandatory parameters. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
655 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
656 |
* @param expectedName The expected annotation name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
657 |
* @param targetType The expected target type. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
658 |
* @param visibility Whether this annotation should be runtime-visible. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
659 |
* @param expectedCount The number of annotations that should be seen. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
660 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
661 |
public Builder(String expectedName, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
662 |
TypeAnnotation.TargetType targetType, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
663 |
boolean visibility, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
664 |
int expectedCount) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
665 |
this.expectedName = expectedName; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
666 |
this.visibility = visibility; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
667 |
this.expectedCount = expectedCount; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
668 |
this.targetType = targetType; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
669 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
670 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
671 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
672 |
* Create an {@code ExpectedTypeAnnotation} from all |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
673 |
* parameters that have been provided. The default values |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
674 |
* will be used for those that have not. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
675 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
676 |
* @return The cretaed {@code ExpectedTypeAnnotation}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
677 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
678 |
public ExpectedTypeAnnotation build() { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
679 |
return new ExpectedTypeAnnotation(expectedName, visibility, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
680 |
expectedCount, targetType, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
681 |
bound_index, parameter_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
682 |
type_index, exception_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
683 |
typePath); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
684 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
685 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
686 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
687 |
* Provide a bound index parameter. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
688 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
689 |
* @param bound_index The bound_index value. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
690 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
691 |
public Builder setBoundIndex(int bound_index) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
692 |
this.bound_index = bound_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
693 |
return this; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
694 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
695 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
696 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
697 |
* Provide a parameter index parameter. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
698 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
699 |
* @param bound_index The parameter_index value. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
700 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
701 |
public Builder setParameterIndex(int parameter_index) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
702 |
this.parameter_index = parameter_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
703 |
return this; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
704 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
705 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
706 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
707 |
* Provide a type index parameter. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
708 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
709 |
* @param type_index The type_index value. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
710 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
711 |
public Builder setTypeIndex(int type_index) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
712 |
this.type_index = type_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
713 |
return this; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
714 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
715 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
716 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
717 |
* Provide an exception index parameter. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
718 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
719 |
* @param exception_index The exception_index value. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
720 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
721 |
public Builder setExceptionIndex(int exception_index) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
722 |
this.exception_index = exception_index; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
723 |
return this; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
724 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
725 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
726 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
727 |
* Provide a type path parameter. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
728 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
729 |
* @param typePath The type path value. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
730 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
731 |
public Builder setTypePath(TypeAnnotation.Position.TypePathEntry[] typePath) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
732 |
this.typePath = typePath; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
733 |
return this; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
734 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
735 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
736 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
737 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
738 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
739 |
* A type annotation found on a method. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
740 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
741 |
public static class ExpectedMethodTypeAnnotation extends ExpectedTypeAnnotation { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
742 |
private final String methodname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
743 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
744 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
745 |
* Create an {@code ExpectedMethodTypeAnnotation} from its |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
746 |
* components. It is usually a better idea to use a {@code |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
747 |
* Builder} to do this. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
748 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
749 |
* @param methodname The expected method name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
750 |
* @param expectedName The expected annotation name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
751 |
* @param visibility Whether this annotation should be runtime-visible. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
752 |
* @param expectedCount The number of annotations that should be seen. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
753 |
* @param targetType The expected target type. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
754 |
* @param bound_index The expected bound index, or {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
755 |
* @param parameter_index The expected parameter index, or |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
756 |
* {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
757 |
* @param type_index The expected type index, or {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
758 |
* @param exception_index The expected exception index, or |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
759 |
* {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
760 |
* @param typePath The expected type path. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
761 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
762 |
public ExpectedMethodTypeAnnotation(String methodname, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
763 |
String expectedName, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
764 |
boolean visibility, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
765 |
int expectedCount, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
766 |
TypeAnnotation.TargetType targetType, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
767 |
int bound_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
768 |
int parameter_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
769 |
int type_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
770 |
int exception_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
771 |
TypeAnnotation.Position.TypePathEntry... typePath) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
772 |
super(expectedName, visibility, expectedCount, targetType, bound_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
773 |
parameter_index, type_index, exception_index, typePath); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
774 |
this.methodname = methodname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
775 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
776 |
|
36526 | 777 |
@Override |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
778 |
public String toString() { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
779 |
final StringBuilder sb = new StringBuilder(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
780 |
sb.append("Expected "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
781 |
sb.append(expectedCount); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
782 |
sb.append(" annotation "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
783 |
sb.append(expectedName); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
784 |
sb.append(visibility ? ", runtime visibile " : ", runtime invisibile "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
785 |
sb.append(targetType); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
786 |
sb.append(", bound_index = "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
787 |
sb.append(bound_index); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
788 |
sb.append(", parameter_index = "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
789 |
sb.append(parameter_index); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
790 |
sb.append(", type_index = "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
791 |
sb.append(type_index); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
792 |
sb.append(", exception_index = "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
793 |
sb.append(exception_index); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
794 |
sb.append(", type_path = ["); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
795 |
for(int i = 0; i < typePath.length; i++) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
796 |
if (i != 0) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
797 |
sb.append(", "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
798 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
799 |
sb.append(typePath[i]); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
800 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
801 |
sb.append("]"); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
802 |
sb.append(" on method "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
803 |
sb.append(methodname); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
804 |
return sb.toString(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
805 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
806 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
807 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
808 |
* See if this template applies to a method. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
809 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
810 |
* @param methodname The method name to check. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
811 |
* @return Whether or not this template should apply. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
812 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
813 |
public boolean matchMethodName(String methodname) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
814 |
return this.methodname.equals(methodname); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
815 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
816 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
817 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
818 |
* A builder class for creating {@code |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
819 |
* ExpectedMethodTypeAnnotation}s in a more convenient fashion. The |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
820 |
* constructor for {@code ExpectedMethodTypeAnnotation} takes a |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
821 |
* large number of parameters (by necessity). This class |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
822 |
* allows users to construct a {@code ExpectedMethodTypeAnnotation}s |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
823 |
* using only the ones they need. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
824 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
825 |
public static class Builder extends ExpectedTypeAnnotation.Builder { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
826 |
protected final String methodname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
827 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
828 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
829 |
* Create a {@code Builder} from the mandatory parameters. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
830 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
831 |
* @param methodname The expected method name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
832 |
* @param expectedName The expected annotation name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
833 |
* @param targetType The expected target type. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
834 |
* @param visibility Whether this annotation should be runtime-visible. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
835 |
* @param expectedCount The number of annotations that should be seen. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
836 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
837 |
public Builder(String methodname, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
838 |
String expectedName, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
839 |
TypeAnnotation.TargetType targetType, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
840 |
boolean visibility, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
841 |
int expectedCount) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
842 |
super(expectedName, targetType, visibility, expectedCount); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
843 |
this.methodname = methodname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
844 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
845 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
846 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
847 |
* Create an {@code ExpectedMethodTypeAnnotation} from all |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
848 |
* parameters that have been provided. The default values |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
849 |
* will be used for those that have not. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
850 |
* |
36526 | 851 |
* @return The created {@code ExpectedMethodTypeAnnotation}. |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
852 |
*/ |
36526 | 853 |
@Override |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
854 |
public ExpectedMethodTypeAnnotation build() { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
855 |
return new ExpectedMethodTypeAnnotation(methodname, expectedName, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
856 |
visibility, expectedCount, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
857 |
targetType, bound_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
858 |
parameter_index, type_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
859 |
exception_index, typePath); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
860 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
861 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
862 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
863 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
864 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
865 |
* A type annotation found on a field. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
866 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
867 |
public static class ExpectedFieldTypeAnnotation extends ExpectedTypeAnnotation { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
868 |
private final String fieldname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
869 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
870 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
871 |
* Create an {@code ExpectedFieldTypeAnnotation} from its |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
872 |
* components. It is usually a better idea to use a {@code |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
873 |
* Builder} to do this. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
874 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
875 |
* @param fieldname The expected field name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
876 |
* @param expectedName The expected annotation name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
877 |
* @param visibility Whether this annotation should be runtime-visible. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
878 |
* @param expectedCount The number of annotations that should be seen. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
879 |
* @param targetType The expected target type. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
880 |
* @param bound_index The expected bound index, or {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
881 |
* @param parameter_index The expected parameter index, or |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
882 |
* {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
883 |
* @param type_index The expected type index, or {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
884 |
* @param exception_index The expected exception index, or |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
885 |
* {@code Integer.MIN_VALUE}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
886 |
* @param typePath The expected type path. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
887 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
888 |
public ExpectedFieldTypeAnnotation(String fieldname, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
889 |
String expectedName, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
890 |
boolean visibility, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
891 |
int expectedCount, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
892 |
TypeAnnotation.TargetType targetType, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
893 |
int bound_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
894 |
int parameter_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
895 |
int type_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
896 |
int exception_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
897 |
TypeAnnotation.Position.TypePathEntry... typePath) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
898 |
super(expectedName, visibility, expectedCount, targetType, bound_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
899 |
parameter_index, type_index, exception_index, typePath); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
900 |
this.fieldname = fieldname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
901 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
902 |
|
36526 | 903 |
@Override |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
904 |
public String toString() { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
905 |
final StringBuilder sb = new StringBuilder(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
906 |
sb.append("Expected ").append(expectedCount) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
907 |
.append(" annotation ").append(expectedName) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
908 |
.append(visibility ? ", runtime visibile " : ", runtime invisibile ") |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
909 |
.append(targetType) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
910 |
.append(", bound_index = ").append(bound_index) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
911 |
.append(", parameter_index = ").append(parameter_index) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
912 |
.append(", type_index = ").append(type_index) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
913 |
.append(", exception_index = ").append(exception_index) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
914 |
.append(", type_path = ["); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
915 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
916 |
for(int i = 0; i < typePath.length; i++) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
917 |
if (i != 0) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
918 |
sb.append(", "); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
919 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
920 |
sb.append(typePath[i]); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
921 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
922 |
sb.append("]") |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
923 |
.append(" on field ").append(fieldname); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
924 |
return sb.toString(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
925 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
926 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
927 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
928 |
* See if this template applies to a field. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
929 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
930 |
* @param fieldname The field name to check. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
931 |
* @return Whether or not this template should apply. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
932 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
933 |
public boolean matchFieldName(String fieldname) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
934 |
return this.fieldname.equals(fieldname); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
935 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
936 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
937 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
938 |
* A builder class for creating {@code |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
939 |
* ExpectedFieldTypeAnnotation}s in a more convenient fashion. The |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
940 |
* constructor for {@code ExpectedFieldTypeAnnotation} takes a |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
941 |
* large number of parameters (by necessity). This class |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
942 |
* allows users to construct a {@code ExpectedFieldTypeAnnotation}s |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
943 |
* using only the ones they need. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
944 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
945 |
public static class Builder extends ExpectedTypeAnnotation.Builder { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
946 |
protected final String fieldname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
947 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
948 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
949 |
* Create a {@code Builder} from the mandatory parameters. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
950 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
951 |
* @param fieldname The expected field name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
952 |
* @param expectedName The expected annotation name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
953 |
* @param targetType The expected target type. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
954 |
* @param visibility Whether this annotation should be runtime-visible. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
955 |
* @param expectedCount The number of annotations that should be seen. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
956 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
957 |
public Builder(String fieldname, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
958 |
String expectedName, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
959 |
TypeAnnotation.TargetType targetType, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
960 |
boolean visibility, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
961 |
int expectedCount) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
962 |
super(expectedName, targetType, visibility, expectedCount); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
963 |
this.fieldname = fieldname; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
964 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
965 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
966 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
967 |
* Create an {@code ExpectedFieldTypeAnnotation} from all |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
968 |
* parameters that have been provided. The default values |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
969 |
* will be used for those that have not. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
970 |
* |
36526 | 971 |
* @return The created {@code ExpectedFieldTypeAnnotation}. |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
972 |
*/ |
36526 | 973 |
@Override |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
974 |
public ExpectedFieldTypeAnnotation build() { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
975 |
return new ExpectedFieldTypeAnnotation(fieldname, expectedName, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
976 |
visibility, expectedCount, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
977 |
targetType, bound_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
978 |
parameter_index, type_index, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
979 |
exception_index, typePath); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
980 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
981 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
982 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
983 |
|
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
984 |
private void matchClassAnnotation(ClassFile classfile, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
985 |
ExpectedAnnotation expected) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
986 |
throws ConstantPoolException { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
987 |
for(Attribute attr : classfile.attributes) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
988 |
attr.accept(annoMatcher(classfile.constant_pool), expected); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
989 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
990 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
991 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
992 |
private void matchMethodAnnotation(ClassFile classfile, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
993 |
ExpectedMethodAnnotation expected) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
994 |
throws ConstantPoolException { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
995 |
for(Method meth : classfile.methods) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
996 |
if (expected.matchMethodName(meth.getName(classfile.constant_pool))) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
997 |
for(Attribute attr : meth.attributes) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
998 |
attr.accept(annoMatcher(classfile.constant_pool), expected); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
999 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1000 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1001 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1002 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1003 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1004 |
private void matchParameterAnnotation(ClassFile classfile, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1005 |
ExpectedParameterAnnotation expected) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1006 |
throws ConstantPoolException { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1007 |
for(Method meth : classfile.methods) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1008 |
if (expected.matchMethodName(meth.getName(classfile.constant_pool))) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1009 |
for(Attribute attr : meth.attributes) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1010 |
attr.accept(paramMatcher(classfile.constant_pool), expected); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1011 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1012 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1013 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1014 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1015 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1016 |
private void matchFieldAnnotation(ClassFile classfile, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1017 |
ExpectedFieldAnnotation expected) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1018 |
throws ConstantPoolException { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1019 |
for(Field field : classfile.fields) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1020 |
if (expected.matchFieldName(field.getName(classfile.constant_pool))) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1021 |
for(Attribute attr : field.attributes) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1022 |
attr.accept(annoMatcher(classfile.constant_pool), expected); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1023 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1024 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1025 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1026 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1027 |
|
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1028 |
private void matchClassTypeAnnotation(ClassFile classfile, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1029 |
ExpectedTypeAnnotation expected) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1030 |
throws ConstantPoolException { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1031 |
for(Attribute attr : classfile.attributes) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1032 |
attr.accept(typeAnnoMatcher, expected); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1033 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1034 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1035 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1036 |
private void matchMethodTypeAnnotation(ClassFile classfile, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1037 |
ExpectedMethodTypeAnnotation expected) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1038 |
throws ConstantPoolException { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1039 |
for(Method meth : classfile.methods) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1040 |
if (expected.matchMethodName(meth.getName(classfile.constant_pool))) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1041 |
for(Attribute attr : meth.attributes) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1042 |
attr.accept(typeAnnoMatcher, expected); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1043 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1044 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1045 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1046 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1047 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1048 |
private void matchFieldTypeAnnotation(ClassFile classfile, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1049 |
ExpectedFieldTypeAnnotation expected) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1050 |
throws ConstantPoolException { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1051 |
for(Field field : classfile.fields) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1052 |
if (expected.matchFieldName(field.getName(classfile.constant_pool))) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1053 |
for(Attribute attr : field.attributes) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1054 |
attr.accept(typeAnnoMatcher, expected); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1055 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1056 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1057 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1058 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1059 |
|
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1060 |
private void matchClassAnnotations(ClassFile classfile, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1061 |
ExpectedAnnotation[] expected) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1062 |
throws ConstantPoolException { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1063 |
for(ExpectedAnnotation one : expected) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1064 |
matchClassAnnotation(classfile, one); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1065 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1066 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1067 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1068 |
private void matchMethodAnnotations(ClassFile classfile, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1069 |
ExpectedMethodAnnotation[] expected) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1070 |
throws ConstantPoolException { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1071 |
for(ExpectedMethodAnnotation one : expected) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1072 |
matchMethodAnnotation(classfile, one); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1073 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1074 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1075 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1076 |
private void matchParameterAnnotations(ClassFile classfile, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1077 |
ExpectedParameterAnnotation[] expected) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1078 |
throws ConstantPoolException { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1079 |
for(ExpectedParameterAnnotation one : expected) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1080 |
matchParameterAnnotation(classfile, one); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1081 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1082 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1083 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1084 |
private void matchFieldAnnotations(ClassFile classfile, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1085 |
ExpectedFieldAnnotation[] expected) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1086 |
throws ConstantPoolException { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1087 |
for(ExpectedFieldAnnotation one : expected) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1088 |
matchFieldAnnotation(classfile, one); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1089 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1090 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1091 |
|
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1092 |
private void matchClassTypeAnnotations(ClassFile classfile, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1093 |
ExpectedTypeAnnotation[] expected) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1094 |
throws ConstantPoolException { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1095 |
for(ExpectedTypeAnnotation one : expected) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1096 |
matchClassTypeAnnotation(classfile, one); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1097 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1098 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1099 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1100 |
private void matchMethodTypeAnnotations(ClassFile classfile, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1101 |
ExpectedMethodTypeAnnotation[] expected) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1102 |
throws ConstantPoolException { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1103 |
for(ExpectedMethodTypeAnnotation one : expected) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1104 |
matchMethodTypeAnnotation(classfile, one); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1105 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1106 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1107 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1108 |
private void matchFieldTypeAnnotations(ClassFile classfile, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1109 |
ExpectedFieldTypeAnnotation[] expected) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1110 |
throws ConstantPoolException { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1111 |
for(ExpectedFieldTypeAnnotation one : expected) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1112 |
matchFieldTypeAnnotation(classfile, one); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1113 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1114 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1115 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1116 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1117 |
* Run a template on a single {@code ClassFile}. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1118 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1119 |
* @param classfile The {@code ClassFile} on which to run tests. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1120 |
* @param expected The expected annotation template. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1121 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1122 |
public void run(ClassFile classfile, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1123 |
Expected... expected) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1124 |
throws ConstantPoolException { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1125 |
run(new ClassFile[] { classfile }, expected); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1126 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1127 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1128 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1129 |
* Run a template on multiple {@code ClassFile}s. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1130 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1131 |
* @param classfile The {@code ClassFile}s on which to run tests. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1132 |
* @param expected The expected annotation template. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1133 |
*/ |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1134 |
public void run(ClassFile[] classfiles, |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1135 |
Expected... expected) |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1136 |
throws ConstantPoolException { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1137 |
for(ClassFile classfile : classfiles) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1138 |
for(Expected one : expected) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1139 |
if (one.matchClassName(classfile.getName())) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1140 |
if (one.classAnnos != null) |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1141 |
matchClassAnnotations(classfile, one.classAnnos); |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1142 |
if (one.methodAnnos != null) |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1143 |
matchMethodAnnotations(classfile, one.methodAnnos); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1144 |
if (one.methodParamAnnos != null) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1145 |
matchParameterAnnotations(classfile, one.methodParamAnnos); |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1146 |
if (one.fieldAnnos != null) |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1147 |
matchFieldAnnotations(classfile, one.fieldAnnos); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1148 |
if (one.classTypeAnnos != null) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1149 |
matchClassTypeAnnotations(classfile, one.classTypeAnnos); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1150 |
if (one.methodTypeAnnos != null) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1151 |
matchMethodTypeAnnotations(classfile, one.methodTypeAnnos); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1152 |
if (one.fieldTypeAnnos != null) |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1153 |
matchFieldTypeAnnotations(classfile, one.fieldTypeAnnos); |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1154 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1155 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1156 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1157 |
int count = 0; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1158 |
for (Expected one : expected) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1159 |
count += one.check(); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1160 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1161 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1162 |
if (count != 0) { |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1163 |
throw new RuntimeException(count + " errors occurred in test"); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1164 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1165 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1166 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1167 |
/** |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1168 |
* Get a {@code ClassFile} from its file name. |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1169 |
* |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1170 |
* @param name The class' file name. |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1171 |
* @param host A class in the same package. |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1172 |
* @return The {@code ClassFile} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1173 |
*/ |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1174 |
public static ClassFile getClassFile(String name, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1175 |
Class<?> host) |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1176 |
throws IOException, ConstantPoolException { |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1177 |
final URL url = host.getResource(name); |
36526 | 1178 |
try (InputStream in = url.openStream()) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1179 |
return ClassFile.read(in); |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1180 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1181 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1182 |
|
36526 | 1183 |
private static class AbstractAttributeVisitor<T> implements Attribute.Visitor<Void, T> { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1184 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1185 |
@Override |
36526 | 1186 |
public Void visitDefault(DefaultAttribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1187 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1188 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1189 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1190 |
@Override |
36526 | 1191 |
public Void visitAnnotationDefault(AnnotationDefault_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1192 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1193 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1194 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1195 |
@Override |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1196 |
public Void visitBootstrapMethods(BootstrapMethods_attribute attr, T p) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1197 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1198 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1199 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1200 |
@Override |
36526 | 1201 |
public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1202 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1203 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1204 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1205 |
@Override |
36526 | 1206 |
public Void visitCode(Code_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1207 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1208 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1209 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1210 |
@Override |
36526 | 1211 |
public Void visitCompilationID(CompilationID_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1212 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1213 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1214 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1215 |
@Override |
36526 | 1216 |
public Void visitConstantValue(ConstantValue_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1217 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1218 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1219 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1220 |
@Override |
36526 | 1221 |
public Void visitDeprecated(Deprecated_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1222 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1223 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1224 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1225 |
@Override |
36526 | 1226 |
public Void visitEnclosingMethod(EnclosingMethod_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1227 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1228 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1229 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1230 |
@Override |
36526 | 1231 |
public Void visitExceptions(Exceptions_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1232 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1233 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1234 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1235 |
@Override |
36526 | 1236 |
public Void visitInnerClasses(InnerClasses_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1237 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1238 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1239 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1240 |
@Override |
36526 | 1241 |
public Void visitLineNumberTable(LineNumberTable_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1242 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1243 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1244 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1245 |
@Override |
36526 | 1246 |
public Void visitLocalVariableTable(LocalVariableTable_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1247 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1248 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1249 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1250 |
@Override |
36526 | 1251 |
public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1252 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1253 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1254 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1255 |
@Override |
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1256 |
public Void visitNestHost(NestHost_attribute attr, T p) { |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1257 |
return null; |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1258 |
} |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1259 |
|
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1260 |
@Override |
36526 | 1261 |
public Void visitMethodParameters(MethodParameters_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1262 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1263 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1264 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1265 |
@Override |
36526 | 1266 |
public Void visitModule(Module_attribute attr, T p) { |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1267 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1268 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1269 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1270 |
@Override |
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1271 |
public Void visitModuleHashes(ModuleHashes_attribute attr, T p) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1272 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1273 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1274 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1275 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1276 |
public Void visitModuleMainClass(ModuleMainClass_attribute attr, T p) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1277 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1278 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1279 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1280 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1281 |
public Void visitModulePackages(ModulePackages_attribute attr, T p) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1282 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1283 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1284 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1285 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1286 |
public Void visitModuleResolution(ModuleResolution_attribute attr, T p) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1287 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1288 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1289 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1290 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1291 |
public Void visitModuleTarget(ModuleTarget_attribute attr, T p) { |
36526 | 1292 |
return null; |
1293 |
} |
|
1294 |
||
1295 |
@Override |
|
50735
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1296 |
public Void visitNestMembers(NestMembers_attribute attr, T p) { |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1297 |
return null; |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1298 |
} |
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1299 |
|
2f2af62dfac7
8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents:
47216
diff
changeset
|
1300 |
@Override |
36526 | 1301 |
public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, T p) { |
1302 |
return null; |
|
1303 |
} |
|
1304 |
||
1305 |
@Override |
|
42822
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1306 |
public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, T p) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1307 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1308 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1309 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1310 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1311 |
public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, T p) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1312 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1313 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1314 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1315 |
@Override |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1316 |
public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, T p) { |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1317 |
return null; |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1318 |
} |
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1319 |
|
a84956e7ee4d
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42407
diff
changeset
|
1320 |
@Override |
36526 | 1321 |
public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, T p) { |
1322 |
return null; |
|
1323 |
} |
|
1324 |
||
1325 |
@Override |
|
1326 |
public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, T p) { |
|
1327 |
return null; |
|
1328 |
} |
|
1329 |
||
1330 |
@Override |
|
1331 |
public Void visitSignature(Signature_attribute attr, T p) { |
|
1332 |
return null; |
|
1333 |
} |
|
1334 |
||
1335 |
@Override |
|
1336 |
public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, T p) { |
|
1337 |
return null; |
|
1338 |
} |
|
1339 |
||
1340 |
@Override |
|
1341 |
public Void visitSourceFile(SourceFile_attribute attr, T p) { |
|
1342 |
return null; |
|
1343 |
} |
|
1344 |
||
1345 |
@Override |
|
1346 |
public Void visitSourceID(SourceID_attribute attr, T p) { |
|
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1347 |
return null; |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1348 |
} |
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1349 |
|
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1350 |
@Override |
36526 | 1351 |
public Void visitStackMap(StackMap_attribute attr, T p) { |
1352 |
return null; |
|
1353 |
} |
|
1354 |
||
1355 |
@Override |
|
1356 |
public Void visitStackMapTable(StackMapTable_attribute attr, T p) { |
|
1357 |
return null; |
|
1358 |
} |
|
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1359 |
|
36526 | 1360 |
@Override |
1361 |
public Void visitSynthetic(Synthetic_attribute attr, T p) { |
|
1362 |
return null; |
|
1363 |
} |
|
1364 |
} |
|
1365 |
||
1366 |
private static final Attribute.Visitor<Void, ExpectedTypeAnnotation> typeAnnoMatcher |
|
1367 |
= new AbstractAttributeVisitor<ExpectedTypeAnnotation>() { |
|
1368 |
||
1369 |
@Override |
|
1370 |
public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, |
|
1371 |
ExpectedTypeAnnotation expected) { |
|
1372 |
if (expected.matchVisibility(true)) { |
|
1373 |
for (TypeAnnotation anno : attr.annotations) { |
|
1374 |
expected.matchAnnotation(anno); |
|
1375 |
} |
|
1376 |
} |
|
1377 |
||
1378 |
return null; |
|
1379 |
} |
|
1380 |
||
1381 |
@Override |
|
1382 |
public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, |
|
1383 |
ExpectedTypeAnnotation expected) { |
|
1384 |
if (expected.matchVisibility(false)) { |
|
1385 |
for (TypeAnnotation anno : attr.annotations) { |
|
1386 |
expected.matchAnnotation(anno); |
|
1387 |
} |
|
1388 |
} |
|
1389 |
||
1390 |
return null; |
|
1391 |
} |
|
1392 |
}; |
|
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1393 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1394 |
private static Attribute.Visitor<Void, ExpectedAnnotation> annoMatcher(ConstantPool cpool) { |
36526 | 1395 |
return new AbstractAttributeVisitor<ExpectedAnnotation>() { |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1396 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1397 |
@Override |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1398 |
public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1399 |
ExpectedAnnotation expected) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1400 |
if (expected.matchVisibility(true)) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1401 |
for(Annotation anno : attr.annotations) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1402 |
expected.matchAnnotation(cpool, anno); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1403 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1404 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1405 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1406 |
return null; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1407 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1408 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1409 |
@Override |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1410 |
public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1411 |
ExpectedAnnotation expected) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1412 |
if (expected.matchVisibility(false)) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1413 |
for(Annotation anno : attr.annotations) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1414 |
expected.matchAnnotation(cpool, anno); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1415 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1416 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1417 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1418 |
return null; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1419 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1420 |
}; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1421 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1422 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1423 |
private static Attribute.Visitor<Void, ExpectedParameterAnnotation> paramMatcher(ConstantPool cpool) { |
36526 | 1424 |
return new AbstractAttributeVisitor<ExpectedParameterAnnotation>() { |
27853
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1425 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1426 |
@Override |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1427 |
public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1428 |
ExpectedParameterAnnotation expected) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1429 |
if (expected.matchVisibility(true)) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1430 |
if (expected.index < attr.parameter_annotations.length) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1431 |
for(Annotation anno : |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1432 |
attr.parameter_annotations[expected.index]) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1433 |
expected.matchAnnotation(cpool, anno); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1434 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1435 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1436 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1437 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1438 |
return null; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1439 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1440 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1441 |
@Override |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1442 |
public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1443 |
ExpectedParameterAnnotation expected) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1444 |
if (expected.matchVisibility(false)) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1445 |
if (expected.index < attr.parameter_annotations.length) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1446 |
for(Annotation anno : |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1447 |
attr.parameter_annotations[expected.index]) { |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1448 |
expected.matchAnnotation(cpool, anno); |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1449 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1450 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1451 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1452 |
|
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1453 |
return null; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1454 |
} |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1455 |
}; |
746c658e8d35
8065132: Parameter annotations not updated when synthetic parameters are prepended
emc
parents:
27545
diff
changeset
|
1456 |
} |
27545
9b19c6e31489
8029012: parameter_index for type annotation not updated after outer.this added
emc
parents:
diff
changeset
|
1457 |
} |