On 12 August 2010 07:47,  <joe...@apache.org> wrote:
> Author: joehni
> Date: Thu Aug 12 06:47:43 2010
> New Revision: 984655
>
> URL: http://svn.apache.org/viewvc?rev=984655&view=rev
> Log:
> Fix wrong cast.

What was wrong with the cast?

>
> Modified:
>    
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
>
> Modified: 
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java?rev=984655&r1=984654&r2=984655&view=diff
> ==============================================================================
> --- 
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
>  (original)
> +++ 
> commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
>  Thu Aug 12 06:47:43 2010
> @@ -265,14 +265,13 @@ public class ConstructorUtils {
>         }
>         Constructor<T> result = null;
>         /*
> -         * Class.getConstructors() is documented to return Constructor<T> so 
> as
> -         * long as the array is not subsequently modified, everything's fine:
> +         * (1) Class.getConstructors() is documented to return 
> Constructor<T> so as
> +         * long as the array is not subsequently modified, everything's fine.
>          */
> -       �...@suppresswarnings("unchecked") // cls is of type T
> -        Constructor<T>[] ctors = cls.getConstructors();
> +        Constructor<?>[] ctors = cls.getConstructors();
>
>         // return best match:
> -        for (Constructor<T> ctor : ctors) {
> +        for (Constructor<?> ctor : ctors) {
>             // compare parameters
>             if (ClassUtils.isAssignable(parameterTypes, 
> ctor.getParameterTypes(), true)) {
>                 // get accessible version of constructor
> @@ -282,7 +281,10 @@ public class ConstructorUtils {
>                     if (result == null
>                             || 
> MemberUtils.compareParameterTypes(ctor.getParameterTypes(), result
>                                     .getParameterTypes(), parameterTypes) < 
> 0) {
> -                        result = ctor;
> +                        // temporary variable for annotation, see comment 
> above (1)
> +                       �...@suppresswarnings("unchecked")
> +                        Constructor<T> constructor = (Constructor<T>)ctor;
> +                        result = constructor;
>                     }
>                 }
>             }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to