571 } 572 573 /** 574 * {@inheritDoc} 575 * @since 1.5 576 */ 577 public Annotation[] getDeclaredAnnotations() { 578 return super.getDeclaredAnnotations(); 579 } 580 581 /** 582 * {@inheritDoc} 583 * @since 1.5 584 */ 585 @Override 586 public Annotation[][] getParameterAnnotations() { 587 return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations); 588 } 589 590 @Override 591 void handleParameterNumberMismatch(int resultLength, int numParameters) { 592 Class<?> declaringClass = getDeclaringClass(); 593 if (declaringClass.isEnum() || 594 declaringClass.isAnonymousClass() || 595 declaringClass.isLocalClass() ) 596 return ; // Can't do reliable parameter counting 597 else { 598 if (!declaringClass.isMemberClass() || // top-level 599 // Check for the enclosing instance parameter for 600 // non-static member classes 601 (declaringClass.isMemberClass() && 602 ((declaringClass.getModifiers() & Modifier.STATIC) == 0) && 603 resultLength + 1 != numParameters) ) { 604 throw new AnnotationFormatError( 605 "Parameter annotations don't match number of parameters"); 606 } 607 } 608 } 609 610 /** 611 * {@inheritDoc} 612 * @since 1.8 613 */ 614 @Override 615 public AnnotatedType getAnnotatedReturnType() { 616 return getAnnotatedReturnType0(getDeclaringClass()); 617 } 618 619 /** 620 * {@inheritDoc} 621 * @since 1.8 622 */ 623 @Override | 571 } 572 573 /** 574 * {@inheritDoc} 575 * @since 1.5 576 */ 577 public Annotation[] getDeclaredAnnotations() { 578 return super.getDeclaredAnnotations(); 579 } 580 581 /** 582 * {@inheritDoc} 583 * @since 1.5 584 */ 585 @Override 586 public Annotation[][] getParameterAnnotations() { 587 return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations); 588 } 589 590 @Override 591 boolean handleParameterNumberMismatch(int resultLength, int numParameters) { 592 Class<?> declaringClass = getDeclaringClass(); 593 if (declaringClass.isEnum() || 594 declaringClass.isAnonymousClass() || 595 declaringClass.isLocalClass() ) 596 return false; // Can't do reliable parameter counting 597 else { 598 if (declaringClass.isMemberClass() && 599 ((declaringClass.getModifiers() & Modifier.STATIC) == 0) && 600 resultLength + 1 == numParameters) { 601 return true; 602 } else { 603 throw new AnnotationFormatError( 604 "Parameter annotations don't match number of parameters"); 605 } 606 } 607 } 608 609 /** 610 * {@inheritDoc} 611 * @since 1.8 612 */ 613 @Override 614 public AnnotatedType getAnnotatedReturnType() { 615 return getAnnotatedReturnType0(getDeclaringClass()); 616 } 617 618 /** 619 * {@inheritDoc} 620 * @since 1.8 621 */ 622 @Override |