105
109
// escape the @ (pr249216c9)
106
110
handle.append("declare \\@").append(ipe.getName().substring(9)).append(getParameters(ipe));
108
handle.append(ipe.getName()).append(getParameters(ipe));
112
if (ipe.getFullyQualifiedName() != null) {
113
handle.append(ipe.getFullyQualifiedName());
115
handle.append(ipe.getName());
117
handle.append(getParameters(ipe));
123
132
if (ipe.getParameterSignatures() == null || ipe.getParameterSignatures().isEmpty()) {
126
List sourceRefs = ipe.getParameterSignaturesSourceRefs();
127
List parameterTypes = ipe.getParameterSignatures();
135
List<String> sourceRefs = ipe.getParameterSignaturesSourceRefs();
136
List<char[]> parameterTypes = ipe.getParameterSignatures();
128
137
StringBuffer sb = new StringBuffer();
129
138
if (sourceRefs != null) {
130
139
for (int i = 0; i < sourceRefs.size(); i++) {
131
String sourceRef = (String) sourceRefs.get(i);
140
String sourceRef = sourceRefs.get(i);
132
141
sb.append(HandleProviderDelimiter.getDelimiter(ipe));
133
142
sb.append(sourceRef);
136
for (Iterator iter = parameterTypes.iterator(); iter.hasNext();) {
137
char[] element = (char[]) iter.next();
145
for (char[] element : parameterTypes) {
138
146
sb.append(HandleProviderDelimiter.getDelimiter(ipe));
139
147
sb.append(NameConvertor.createShortName(element, false, false));
156
164
if (ipe.getKind().isInterTypeMember()) {
158
List kids = ipe.getParent().getChildren();
160
for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
161
IProgramElement object = (IProgramElement) iterator.next();
166
List<IProgramElement> kids = ipe.getParent().getChildren();
167
for (Iterator<IProgramElement> iterator = kids.iterator(); iterator.hasNext();) {
168
IProgramElement object = iterator.next();
162
169
if (object.equals(ipe)) {
180
187
return CharOperation.concat(countDelim, new Integer(count).toString().toCharArray());
182
} else if (ipe.getKind().isDeclareAnnotation()) {
183
// look at peer declares
185
List kids = ipe.getParent().getChildren();
187
for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
188
IProgramElement object = (IProgramElement) iterator.next();
189
if (object.equals(ipe)) {
192
if (object.getKind() == ipe.getKind()) {
193
if (object.getKind().toString().equals(ipe.getKind().toString())) {
194
String existingHandle = object.getHandleIdentifier();
195
int suffixPosition = existingHandle.indexOf('!');
196
if (suffixPosition != -1) {
197
count = new Integer(existingHandle.substring(suffixPosition + 1)).intValue() + 1;
207
return CharOperation.concat(countDelim, new Integer(count).toString().toCharArray());
209
189
} else if (ipe.getKind().isDeclare()) {
210
int index = CharOperation.lastIndexOf('_', byteCodeName);
212
return convertCount(CharOperation.subarray(byteCodeName, index + 1, byteCodeName.length));
190
// // look at peer declares
191
int count = computeCountBasedOnPeers(ipe);
193
return CharOperation.concat(countDelim, new Integer(count).toString().toCharArray());
214
195
} else if (ipe.getKind().equals(IProgramElement.Kind.ADVICE)) {
215
196
// Look at any peer advice
217
List kids = ipe.getParent().getChildren();
198
List<IProgramElement> kids = ipe.getParent().getChildren();
218
199
String ipeSig = ipe.getBytecodeSignature();
219
200
// remove return type from the signature - it should not be included in the comparison
221
if (ipeSig != null && ((idx = ipeSig.indexOf(")")) != -1)) {
222
ipeSig = ipeSig.substring(0, idx);
224
if (ipeSig != null) {
225
if (ipeSig.indexOf("Lorg/aspectj/lang") != -1) {
226
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
227
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
229
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint;")) {
230
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint;"));
232
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
233
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
237
for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
238
IProgramElement object = (IProgramElement) iterator.next();
202
ipeSig = shortenIpeSig(ipeSig);
203
for (IProgramElement object : kids) {
239
204
if (object.equals(ipe)) {
282
247
// return String.valueOf(++initializerCounter).toCharArray();
283
248
// Look at any peer advice
285
List kids = ipe.getParent().getChildren();
250
List<IProgramElement> kids = ipe.getParent().getChildren();
286
251
String ipeSig = ipe.getBytecodeSignature();
287
252
// remove return type from the signature - it should not be included in the comparison
289
if (ipeSig != null && ((idx = ipeSig.indexOf(")")) != -1)) {
290
ipeSig = ipeSig.substring(0, idx);
292
if (ipeSig != null) {
293
if (ipeSig.indexOf("Lorg/aspectj/lang") != -1) {
294
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
295
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
297
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint;")) {
298
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint;"));
300
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
301
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
305
for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
306
IProgramElement object = (IProgramElement) iterator.next();
254
ipeSig = shortenIpeSig(ipeSig);
255
for (IProgramElement object : kids) {
307
256
if (object.equals(ipe)) {
355
304
} else if (ipe.getKind() == IProgramElement.Kind.CLASS) {
356
305
// depends on previous children
358
List kids = ipe.getParent().getChildren();
307
List<IProgramElement> kids = ipe.getParent().getChildren();
359
308
if (ipe.getName().endsWith("{..}")) {
360
309
// only depends on previous anonymous children, name irrelevant
361
for (Iterator iterator = kids.iterator(); iterator.hasNext();) {
362
IProgramElement object = (IProgramElement) iterator.next();
310
for (IProgramElement object : kids) {
363
311
if (object.equals(ipe)) {
357
private String shortenIpeSig(String ipeSig) {
359
if (ipeSig != null && ((idx = ipeSig.indexOf(")")) != -1)) {
360
ipeSig = ipeSig.substring(0, idx);
362
if (ipeSig != null) {
363
if (ipeSig.indexOf("Lorg/aspectj/lang") != -1) {
364
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
365
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
367
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint;")) {
368
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint;"));
370
if (ipeSig.endsWith("Lorg/aspectj/lang/JoinPoint$StaticPart;")) {
371
ipeSig = ipeSig.substring(0, ipeSig.lastIndexOf("Lorg/aspectj/lang/JoinPoint$StaticPart;"));
378
private int computeCountBasedOnPeers(IProgramElement ipe) {
380
for (IProgramElement object : ipe.getParent().getChildren()) {
381
if (object.equals(ipe)) {
384
if (object.getKind() == ipe.getKind()) {
385
if (object.getKind().toString().equals(ipe.getKind().toString())) {
386
String existingHandle = object.getHandleIdentifier();
387
int suffixPosition = existingHandle.indexOf('!');
388
if (suffixPosition != -1) {
389
count = new Integer(existingHandle.substring(suffixPosition + 1)).intValue() + 1;
411
402
* Only returns the count if it's not equal to 1