ProxyHelper and ProxyBuilder methods generate warnings and are pretty much 
unusable
-----------------------------------------------------------------------------------

                 Key: CAMEL-3889
                 URL: https://issues.apache.org/jira/browse/CAMEL-3889
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
            Reporter: Daniel Kulp



The ProxyHelper/Builder methods that look like:

<T> T createProxy(Endpoint endpoint, Class<T>... interfaceClasses)

will generate a compile warning whenever you try to use them.   Part of the 
reason is that they are completely broken when written that way.   The 
intention is to be able to specify multiple interface classes.  However, you 
cannot with the above signature  as you can ONLY pass the T.class.     Thus, 
something like createProxy(ep, Foo.class, Foo.class) will work (but is 
useless), but something like createProxy(ep, Foo.class, Bar.class) will not, 
even if Bar extends Foo.    THUS, the way it's written, you can really only 
effectively pass in a single interfaceClass and have it work.

There are three alternatives (I'll attach patches for all three for 
consideration) (all three would require javadoc updates, let me know which 
alternative is preferred and I'll happily provide the javadoc updates):

1) Change to:   <T> T createProxy(Endpoint endpoint, Class<?>... 
interfaceClasses)
Very simple, it works.   No warnings.  

2) Add a method like:   <T> T createProxy(Endpoint endpoint, Class<T> 
interfaceClass)
to really handle the single interface case (which is all of the cases in Camel) 
and @Deprecate the broken version.

3) <T> T createProxy(Endpoint endpoint, Class<T> interfaceClass, Class<?> ... 
otherInterfaces)
to separate out the "primary" interface and the "extras".

I personally prefer either 1 or 2, leaning toward #2.  Maybe move to #1 for 3.0.












--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to