< prev index next >

src/java.base/share/classes/java/lang/reflect/Parameter.java

Print this page

        

*** 73,82 **** --- 73,83 ---- * Compares based on the executable and the index. * * @param obj The object to compare. * @return Whether or not this is equal to the argument. */ + @Override public boolean equals(Object obj) { if(obj instanceof Parameter) { Parameter other = (Parameter)obj; return (other.executable.equals(executable) && other.index == index);
*** 88,97 **** --- 89,99 ---- * Returns a hash code based on the executable's hash code and the * index. * * @return A hash code based on the executable's hash code. */ + @Override public int hashCode() { return executable.hashCode() ^ index; } /**
*** 118,127 **** --- 120,130 ---- * parameter. * * @return A string representation of the parameter and associated * information. */ + @Override public String toString() { final StringBuilder sb = new StringBuilder(); final Type type = getParameterizedType(); final String typename = type.getTypeName();
*** 278,296 **** --- 281,305 ---- } /** * {@inheritDoc} + * <p>Note that any annotation returned by this method is a + * declaration annotation. * @throws NullPointerException {@inheritDoc} */ + @Override public <T extends Annotation> T getAnnotation(Class<T> annotationClass) { Objects.requireNonNull(annotationClass); return annotationClass.cast(declaredAnnotations().get(annotationClass)); } /** * {@inheritDoc} + * <p>Note that any annotations returned by this method are + * declaration annotations. + * * @throws NullPointerException {@inheritDoc} */ @Override public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) { Objects.requireNonNull(annotationClass);
*** 298,323 **** --- 307,344 ---- return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass); } /** * {@inheritDoc} + * <p>Note that any annotations returned by this method are + * declaration annotations. */ + @Override public Annotation[] getDeclaredAnnotations() { return executable.getParameterAnnotations()[index]; } /** + * {@inheritDoc} + * <p>Note that any annotation returned by this method is a + * declaration annotation. + * * @throws NullPointerException {@inheritDoc} */ + @Override public <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) { // Only annotations on classes are inherited, for all other // objects getDeclaredAnnotation is the same as // getAnnotation. return getAnnotation(annotationClass); } /** + * {@inheritDoc} + * <p>Note that any annotations returned by this method are + * declaration annotations. + * * @throws NullPointerException {@inheritDoc} */ @Override public <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass) { // Only annotations on classes are inherited, for all other
*** 326,336 **** --- 347,360 ---- return getAnnotationsByType(annotationClass); } /** * {@inheritDoc} + * <p>Note that any annotations returned by this method are + * declaration annotations. */ + @Override public Annotation[] getAnnotations() { return getDeclaredAnnotations(); } private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
< prev index next >