Lines 436-477
Link Here
|
436 |
return originalMethod.declaringClass.retrieveAnnotations(originalMethod); |
436 |
return originalMethod.declaringClass.retrieveAnnotations(originalMethod); |
437 |
} |
437 |
} |
438 |
/** |
438 |
/** |
439 |
* @param index the index of the parameter of interest |
439 |
* @return the annotations for each of the method parameters or <code>null></code> |
440 |
* @return the annotations on the <code>index</code>th parameter |
440 |
* if there's no parameter. |
441 |
* @throws ArrayIndexOutOfBoundsException when <code>index</code> is not valid |
|
|
442 |
*/ |
441 |
*/ |
443 |
public AnnotationBinding[] getParameterAnnotations(int index) { |
442 |
public AnnotationBinding[][] getParameterAnnotations() { |
|
|
443 |
int length = this.parameters.length; |
444 |
if (this.parameters == null || length == 0) { |
445 |
return null; |
446 |
} |
444 |
MethodBinding originalMethod = this.original(); |
447 |
MethodBinding originalMethod = this.original(); |
445 |
AnnotationHolder holder = originalMethod.declaringClass.retrieveAnnotationHolder(originalMethod, true); |
448 |
AnnotationHolder holder = originalMethod.declaringClass.retrieveAnnotationHolder(originalMethod, true); |
446 |
AnnotationBinding[][] allParameterAnnotations = holder == null ? null : holder.getParameterAnnotations(); |
449 |
AnnotationBinding[][] allParameterAnnotations = holder == null ? null : holder.getParameterAnnotations(); |
447 |
if (allParameterAnnotations == null && (this.tagBits & TagBits.HasParameterAnnotations) != 0) { |
450 |
if (allParameterAnnotations == null && (this.tagBits & TagBits.HasParameterAnnotations) != 0) { |
|
|
451 |
allParameterAnnotations = new AnnotationBinding[length][]; |
448 |
// forward reference to method, where param annotations have not yet been associated to method |
452 |
// forward reference to method, where param annotations have not yet been associated to method |
449 |
if (this.declaringClass instanceof SourceTypeBinding) { |
453 |
if (this.declaringClass instanceof SourceTypeBinding) { |
450 |
SourceTypeBinding sourceType = (SourceTypeBinding) this.declaringClass; |
454 |
SourceTypeBinding sourceType = (SourceTypeBinding) this.declaringClass; |
451 |
if (sourceType.scope != null) { |
455 |
if (sourceType.scope != null) { |
452 |
AbstractMethodDeclaration methodDecl = sourceType.scope.referenceType().declarationOf(this); |
456 |
AbstractMethodDeclaration methodDecl = sourceType.scope.referenceType().declarationOf(this); |
453 |
if (methodDecl.arguments != null) { |
457 |
for (int i = 0; i < length; i++) { |
454 |
for (int i = 0, length = methodDecl.arguments.length; i < length; i++) { |
458 |
Argument argument = methodDecl.arguments[i]; |
455 |
Argument argument = methodDecl.arguments[i]; |
459 |
if (argument.annotations != null) { |
456 |
if (argument.annotations != null) { |
460 |
ASTNode.resolveAnnotations(methodDecl.scope, argument.annotations, argument.binding); |
457 |
ASTNode.resolveAnnotations(methodDecl.scope, argument.annotations, argument.binding); |
461 |
allParameterAnnotations[i] = argument.binding.getAnnotations(); |
458 |
if (allParameterAnnotations == null) { |
|
|
459 |
allParameterAnnotations = new AnnotationBinding[length][]; |
460 |
} |
461 |
allParameterAnnotations[i] = argument.binding.getAnnotations(); |
462 |
} |
463 |
} |
462 |
} |
464 |
if (allParameterAnnotations != null) |
|
|
465 |
this.setParameterAnnotations(allParameterAnnotations); |
466 |
} |
463 |
} |
|
|
464 |
this.setParameterAnnotations(allParameterAnnotations); |
465 |
} else { |
466 |
for (int i = 0; i < length; i++) { |
467 |
allParameterAnnotations[i] = Binding.NO_ANNOTATIONS; |
468 |
} |
469 |
} |
470 |
} else { |
471 |
for (int i = 0; i < length; i++) { |
472 |
allParameterAnnotations[i] = Binding.NO_ANNOTATIONS; |
467 |
} |
473 |
} |
468 |
} |
474 |
} |
469 |
} |
475 |
} |
470 |
AnnotationBinding[] resultParameterAnnotations = allParameterAnnotations == null ? null : allParameterAnnotations[ index]; |
476 |
return allParameterAnnotations; |
471 |
if (resultParameterAnnotations != null) { |
|
|
472 |
return resultParameterAnnotations; |
473 |
} |
474 |
return Binding.NO_ANNOTATIONS; |
475 |
} |
477 |
} |
476 |
public final int getAccessFlags() { |
478 |
public final int getAccessFlags() { |
477 |
return modifiers & ExtraCompilerModifiers.AccJustFlag; |
479 |
return modifiers & ExtraCompilerModifiers.AccJustFlag; |