You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2013/10/25 21:37:45 UTC

svn commit: r1535836 - /commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java

Author: oheger
Date: Fri Oct 25 19:37:44 2013
New Revision: 1535836

URL: http://svn.apache.org/r1535836
Log:
Made the Java 1.5 compiler happy.

Obviously, the compiler needs another reference to T in the method signature.
Otherwise, the type cannot be determined.

Modified:
    commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java

Modified: commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java?rev=1535836&r1=1535835&r2=1535836&view=diff
==============================================================================
--- commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java (original)
+++ commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/converters/AbstractConverter.java Fri Oct 25 19:37:44 2013
@@ -129,7 +129,7 @@ public abstract class AbstractConverter 
     public <T> T convert(Class<T> type, Object value) {
 
         if (type == null) {
-            return convertToDefaultType(value);
+            return convertToDefaultType(type, value);
         }
 
         Class<?> sourceType  = value == null ? null : value.getClass();
@@ -480,10 +480,12 @@ public abstract class AbstractConverter 
      * Therefore, we can cast to it (which is required to fulfill the contract
      * of the method signature).
      *
+     * @param <T> the type of the result object
+     * @param targetClass the target class of the conversion
      * @param value the value to be converted
      * @return the converted value
      */
-    private <T> T convertToDefaultType(Object value) {
+    private <T> T convertToDefaultType(Class<T> targetClass, Object value) {
         @SuppressWarnings("unchecked")
         T result = (T) convert(getDefaultType(), value);
         return result;