commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r903184 - /commons/sandbox/at-digester/trunk/src/java/org/apache/commons/digester/annotations/reflect/MethodArgument.java
Date Tue, 26 Jan 2010 11:43:21 GMT
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;
     }
 
     /**



Mime
View raw message