Author: simonetripodi Date: Tue Jan 26 11:43:20 2010 New Revision: 903184 URL: http://svn.apache.org/viewvc?rev=903184&view=rev Log: MethodArgument#getAnnotations() and MethodArgument#getDeclaredAnnotations() now return a copy of the original annotations arrays
Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/reflect/MethodArgument.java Modified: commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/reflect/MethodArgument.java URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/reflect/MethodArgument.java?rev=903184&r1=903183&r2=903184&view=diff ============================================================================== --- commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/reflect/MethodArgument.java (original) +++ commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/reflect/MethodArgument.java Tue Jan 26 11:43:20 2010 @@ -90,14 +90,27 @@ * {...@inheritdoc} */ public Annotation[] getAnnotations() { - return this.annotations; + return this.getAnnotationsArrayCopy(); } /** * {...@inheritdoc} */ public Annotation[] getDeclaredAnnotations() { - return this.annotations; + return this.getAnnotationsArrayCopy(); + } + + /** + * Returns an annotations array, copy of the declared annotations in this + * method argument. + * + * @return an annotations array, copy of the declared annotations in this + * method argument. + */ + private Annotation[] getAnnotationsArrayCopy() { + Annotation[] annotations = new Annotation[this.annotations.length]; + System.arraycopy(this.annotations, 0, annotations, 0, annotations.length); + return annotations; } /**