commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r966838 - in /commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2: DefaultProxyFactory.java impl/AbstractProxyFactory.java invoker/recorder/InvocationRecorder.java
Date Thu, 22 Jul 2010 20:14:06 GMT
Author: mbenson
Date: Thu Jul 22 20:14:05 2010
New Revision: 966838

URL: http://svn.apache.org/viewvc?rev=966838&view=rev
Log:
more of the bounds-related compiler errors + the proxytoys way of casting to a local variable
and reducing the scope of the unchecked suppresswarnings annotation to the variable declaration

Modified:
    commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/DefaultProxyFactory.java
    commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/impl/AbstractProxyFactory.java
    commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/invoker/recorder/InvocationRecorder.java

Modified: commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/DefaultProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/DefaultProxyFactory.java?rev=966838&r1=966837&r2=966838&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/DefaultProxyFactory.java
(original)
+++ commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/DefaultProxyFactory.java
Thu Jul 22 20:14:05 2010
@@ -49,65 +49,71 @@ class DefaultProxyFactory implements Pro
      * {@inheritDoc}
      */
     @Override
-    @SuppressWarnings("unchecked")
     public <T> T createDelegatorProxy(ObjectProvider<?> delegateProvider,
             Class<?>... proxyClasses) {
-        return (T) getCapableProxyFactory(proxyClasses).createDelegatorProxy(
+        @SuppressWarnings("unchecked")
+        final T result = (T) getCapableProxyFactory(proxyClasses).createDelegatorProxy(
                 delegateProvider, proxyClasses);
+        return result;
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    @SuppressWarnings("unchecked")
     public <T> T createDelegatorProxy(ClassLoader classLoader,
             ObjectProvider<?> delegateProvider, Class<?>... proxyClasses) {
-        return (T) getCapableProxyFactory(proxyClasses).createDelegatorProxy(
+        @SuppressWarnings("unchecked")
+        final T result = (T) getCapableProxyFactory(proxyClasses).createDelegatorProxy(
                 classLoader, delegateProvider, proxyClasses);
+        return result;
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    @SuppressWarnings("unchecked")
     public <T> T createInterceptorProxy(Object target, Interceptor interceptor,
             Class<?>... proxyClasses) {
-        return (T) getCapableProxyFactory(proxyClasses).createInterceptorProxy(
+        @SuppressWarnings("unchecked")
+        final T result = (T) getCapableProxyFactory(proxyClasses).createInterceptorProxy(
                 target, interceptor, proxyClasses);
+        return result;
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    @SuppressWarnings("unchecked")
     public <T> T createInterceptorProxy(ClassLoader classLoader, Object target,
             Interceptor interceptor, Class<?>... proxyClasses) {
-        return (T) getCapableProxyFactory(proxyClasses).createInterceptorProxy(
+        @SuppressWarnings("unchecked")
+        final T result = (T) getCapableProxyFactory(proxyClasses).createInterceptorProxy(
                 classLoader, target, interceptor, proxyClasses);
+        return result;
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    @SuppressWarnings("unchecked")
     public <T> T createInvokerProxy(Invoker invoker, Class<?>... proxyClasses)
{
-        return (T) getCapableProxyFactory(proxyClasses).createInvokerProxy(
+        @SuppressWarnings("unchecked")
+        final T result = (T) getCapableProxyFactory(proxyClasses).createInvokerProxy(
                 invoker, proxyClasses);
+        return result;
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    @SuppressWarnings("unchecked")
     public <T> T createInvokerProxy(ClassLoader classLoader, Invoker invoker,
             Class<?>... proxyClasses) {
-        return (T) getCapableProxyFactory(proxyClasses).createInvokerProxy(
+        @SuppressWarnings("unchecked")
+        final T result = (T) getCapableProxyFactory(proxyClasses).createInvokerProxy(
                 classLoader, invoker, proxyClasses);
+        return result;
     }
 
     private ProxyFactory getCapableProxyFactory(Class<?>... proxyClasses) {

Modified: commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/impl/AbstractProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/impl/AbstractProxyFactory.java?rev=966838&r1=966837&r2=966838&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/impl/AbstractProxyFactory.java
(original)
+++ commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/impl/AbstractProxyFactory.java
Thu Jul 22 20:14:05 2010
@@ -57,7 +57,9 @@ public abstract class AbstractProxyFacto
      */
     public <T> T createDelegatorProxy( ObjectProvider<?> delegateProvider, Class<?>...
proxyClasses )
     {
-        return createDelegatorProxy(Thread.currentThread().getContextClassLoader(), delegateProvider,
proxyClasses);
+        @SuppressWarnings("unchecked")
+        final T result = (T) createDelegatorProxy(Thread.currentThread().getContextClassLoader(),
delegateProvider, proxyClasses);
+        return result;
     }
 
     /**
@@ -73,8 +75,10 @@ public abstract class AbstractProxyFacto
     public <T> T createInterceptorProxy( Object target, Interceptor interceptor,
                                           Class<?>... proxyClasses )
     {
-        return createInterceptorProxy(Thread.currentThread().getContextClassLoader(), target,
interceptor,
+        @SuppressWarnings("unchecked")
+        final T result = (T) createInterceptorProxy(Thread.currentThread().getContextClassLoader(),
target, interceptor,
                                       proxyClasses);
+        return result;
     }
 
     /**
@@ -87,8 +91,10 @@ public abstract class AbstractProxyFacto
      */
     public <T> T createInvokerProxy( Invoker invoker, Class<?>... proxyClasses
)
     {
-        return createInvokerProxy(Thread.currentThread().getContextClassLoader(), invoker,
+        @SuppressWarnings("unchecked")
+        final T result = (T) createInvokerProxy(Thread.currentThread().getContextClassLoader(),
invoker,
                                   proxyClasses);
+        return result;
     }
 
 }

Modified: commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/invoker/recorder/InvocationRecorder.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/invoker/recorder/InvocationRecorder.java?rev=966838&r1=966837&r2=966838&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/invoker/recorder/InvocationRecorder.java
(original)
+++ commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/invoker/recorder/InvocationRecorder.java
Thu Jul 22 20:14:05 2010
@@ -78,7 +78,9 @@ public class InvocationRecorder
     {
         if( proxyFactory.canProxy(type) )
         {
-            return proxyFactory.createInvokerProxy(new InvocationRecorderInvoker(genericType),
type);
+            @SuppressWarnings("unchecked")
+            final T result = (T) proxyFactory.createInvokerProxy(new InvocationRecorderInvoker(genericType),
type);
+            return result;
         }
         return ProxyUtils.nullValue(type);
     }
@@ -98,11 +100,10 @@ public class InvocationRecorder
         /**
          * {@inheritDoc}
          */
-        @SuppressWarnings("unchecked")
         public Object invoke( Object o, Method method, Object[] args ) throws Throwable
         {
             recordedInvocations.add(new RecordedInvocation(method, args));
-            final Class returnType = getReturnType(targetType, method);
+            final Class<?> returnType = getReturnType(targetType, method);
             return proxy(method.getGenericReturnType(), returnType);
         }
     }



Mime
View raw message