1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
/* *******************************************************************
* Copyright (c) 2005 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Adrian Colyer Initial implementation
* ******************************************************************/
package org.aspectj.weaver;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.weaver.AjAttribute.EffectiveSignatureAttribute;
/**
* @author colyer Instances of this class are created by ResolvedMember.getSignatures() when collating all of the signatures for a
* member. We need to create entries in the set for the "gaps" in the hierarchy. For example:
*
* class A { void foo(); }
*
* class B extends A {}
*
* Join Point : call(* B.foo())
*
* has signatures:
*
* B.foo() AND A.foo() B.foo() will be created as a ResolvedMemberWithSubstituteDeclaringType
*
* Oh for a JDK 1.4 dynamic proxy.... we have to run on 1.3 :(
*/
public class JoinPointSignature implements ResolvedMember {
public static final JoinPointSignature[] EMPTY_ARRAY = new JoinPointSignature[0];
private ResolvedMember realMember;
private ResolvedType substituteDeclaringType;
public JoinPointSignature(ResolvedMember backing, ResolvedType aType) {
this.realMember = backing;
this.substituteDeclaringType = aType;
}
public UnresolvedType getDeclaringType() {
return substituteDeclaringType;
}
public int getModifiers(World world) {
return realMember.getModifiers(world);
}
public int getModifiers() {
return realMember.getModifiers();
}
public UnresolvedType[] getExceptions(World world) {
return realMember.getExceptions(world);
}
public UnresolvedType[] getExceptions() {
return realMember.getExceptions();
}
public ShadowMunger getAssociatedShadowMunger() {
return realMember.getAssociatedShadowMunger();
}
public boolean isAjSynthetic() {
return realMember.isAjSynthetic();
}
public boolean hasAnnotation(UnresolvedType ofType) {
return realMember.hasAnnotation(ofType);
}
public ResolvedType[] getAnnotationTypes() {
return realMember.getAnnotationTypes();
}
public AnnotationAJ getAnnotationOfType(UnresolvedType ofType) {
return realMember.getAnnotationOfType(ofType);
}
public void setAnnotationTypes(ResolvedType[] annotationtypes) {
realMember.setAnnotationTypes(annotationtypes);
}
public void setAnnotations(AnnotationAJ[] annotations) {
realMember.setAnnotations(annotations);
}
public void addAnnotation(AnnotationAJ annotation) {
realMember.addAnnotation(annotation);
}
public boolean isBridgeMethod() {
return realMember.isBridgeMethod();
}
public boolean isVarargsMethod() {
return realMember.isVarargsMethod();
}
public boolean isSynthetic() {
return realMember.isSynthetic();
}
public void write(CompressingDataOutputStream s) throws IOException {
realMember.write(s);
}
public ISourceContext getSourceContext(World world) {
return realMember.getSourceContext(world);
}
public String[] getParameterNames() {
return realMember.getParameterNames();
}
public void setParameterNames(String[] names) {
realMember.setParameterNames(names);
}
public String[] getParameterNames(World world) {
return realMember.getParameterNames(world);
}
public EffectiveSignatureAttribute getEffectiveSignature() {
return realMember.getEffectiveSignature();
}
public ISourceLocation getSourceLocation() {
return realMember.getSourceLocation();
}
public int getEnd() {
return realMember.getEnd();
}
public ISourceContext getSourceContext() {
return realMember.getSourceContext();
}
public int getStart() {
return realMember.getStart();
}
public void setPosition(int sourceStart, int sourceEnd) {
realMember.setPosition(sourceStart, sourceEnd);
}
public void setSourceContext(ISourceContext sourceContext) {
realMember.setSourceContext(sourceContext);
}
public boolean isAbstract() {
return realMember.isAbstract();
}
public boolean isPublic() {
return realMember.isPublic();
}
public boolean isDefault() {
return realMember.isDefault();
}
public boolean isVisible(ResolvedType fromType) {
return realMember.isVisible(fromType);
}
public void setCheckedExceptions(UnresolvedType[] checkedExceptions) {
realMember.setCheckedExceptions(checkedExceptions);
}
public void setAnnotatedElsewhere(boolean b) {
realMember.setAnnotatedElsewhere(b);
}
public boolean isAnnotatedElsewhere() {
return realMember.isAnnotatedElsewhere();
}
public UnresolvedType getGenericReturnType() {
return realMember.getGenericReturnType();
}
public UnresolvedType[] getGenericParameterTypes() {
return realMember.getGenericParameterTypes();
}
public ResolvedMemberImpl parameterizedWith(UnresolvedType[] typeParameters, ResolvedType newDeclaringType,
boolean isParameterized) {
return realMember.parameterizedWith(typeParameters, newDeclaringType, isParameterized);
}
public ResolvedMemberImpl parameterizedWith(UnresolvedType[] typeParameters, ResolvedType newDeclaringType,
boolean isParameterized, List<String> aliases) {
return realMember.parameterizedWith(typeParameters, newDeclaringType, isParameterized, aliases);
}
public void setTypeVariables(TypeVariable[] types) {
realMember.setTypeVariables(types);
}
public TypeVariable[] getTypeVariables() {
return realMember.getTypeVariables();
}
public TypeVariable getTypeVariableNamed(String name) {
return realMember.getTypeVariableNamed(name);
}
public boolean matches(ResolvedMember aCandidateMatch, boolean ignoreGenerics) {
return realMember.matches(aCandidateMatch, ignoreGenerics);
}
public ResolvedMember resolve(World world) {
return realMember.resolve(world);
}
public int compareTo(Member other) {
return realMember.compareTo(other);
}
public MemberKind getKind() {
return realMember.getKind();
}
public UnresolvedType getReturnType() {
return realMember.getReturnType();
}
public UnresolvedType getType() {
return realMember.getType();
}
public String getName() {
return realMember.getName();
}
public UnresolvedType[] getParameterTypes() {
return realMember.getParameterTypes();
}
public AnnotationAJ[][] getParameterAnnotations() {
return realMember.getParameterAnnotations();
}
public ResolvedType[][] getParameterAnnotationTypes() {
return realMember.getParameterAnnotationTypes();
}
public String getSignature() {
return realMember.getSignature();
}
public int getArity() {
return realMember.getArity();
}
public String getParameterSignature() {
return realMember.getParameterSignature();
}
public boolean isCompatibleWith(Member am) {
return realMember.isCompatibleWith(am);
}
public boolean canBeParameterized() {
return realMember.canBeParameterized();
}
public AnnotationAJ[] getAnnotations() {
return realMember.getAnnotations();
}
public Collection<ResolvedType> getDeclaringTypes(World world) {
throw new UnsupportedOperationException("Adrian doesn't think you should be calling this...");
}
public JoinPointSignatureIterator getJoinPointSignatures(World world) {
return realMember.getJoinPointSignatures(world);
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append(getReturnType().getName());
buf.append(' ');
buf.append(getDeclaringType().getName());
buf.append('.');
buf.append(getName());
if (getKind() != FIELD) {
buf.append("(");
UnresolvedType[] parameterTypes = getParameterTypes();
if (parameterTypes.length != 0) {
buf.append(parameterTypes[0]);
for (int i = 1, len = parameterTypes.length; i < len; i++) {
buf.append(", ");
buf.append(parameterTypes[i].getName());
}
}
buf.append(")");
}
return buf.toString();
}
public String toGenericString() {
return realMember.toGenericString();
}
public String toDebugString() {
return realMember.toDebugString();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof JoinPointSignature)) {
return false;
}
JoinPointSignature other = (JoinPointSignature) obj;
if (!realMember.equals(other.realMember)) {
return false;
}
if (!substituteDeclaringType.equals(other.substituteDeclaringType)) {
return false;
}
return true;
}
@Override
public int hashCode() {
return 17 + (37 * realMember.hashCode()) + (37 * substituteDeclaringType.hashCode());
}
public boolean hasBackingGenericMember() {
return realMember.hasBackingGenericMember();
}
public ResolvedMember getBackingGenericMember() {
return realMember.getBackingGenericMember();
}
public void evictWeavingState() {
realMember.evictWeavingState();
}
public ResolvedMember parameterizedWith(Map m, World w) {
return realMember.parameterizedWith(m, w);
}
public String getAnnotationDefaultValue() {
return realMember.getAnnotationDefaultValue();
}
public String getParameterSignatureErased() {
return realMember.getParameterSignatureErased();
}
public String getSignatureErased() {
return realMember.getSignatureErased();
}
public boolean isDefaultConstructor() {
return realMember.isDefaultConstructor();
}
public boolean equalsApartFromDeclaringType(Object other) {
return realMember.equalsApartFromDeclaringType(other);
}
}
|