On 16 August 2010 15:21, Matt Benson <gudnabr...@gmail.com> wrote:
>
> On Aug 16, 2010, at 4:50 AM, sebb wrote:
>
>> 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?
>>
>
> Only that it was preventing the CI build from compiling.  ;)

I see now.

It is a Java 1.5/1.6 incompatibility.

Compiles fine with Eclipse when the compiler is set to 1.5 (which is
what I was using)

Also compiles OK with Sun Java 1.5:
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) Client VM (build 1.5.0_22-b03, mixed mode)

However, it fails when compiled with Sun Java 1.6:
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

>
> -Matt
>
>>>
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

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

Reply via email to