Issue 52: With final classes, check for non-final interfaces or base classes to proxy instead of always failing
Status:  WontFix
Owner:
Closed:  May 2012
Cc:
Project Member Reported by kandpwel...@gmail.com, May 20, 2012
Since none of the proxying frameworks (Javassist, CGLIB, or Java Dynamic Proxies) can proxy a final class, Funcito currently fails to be able to wrap methods on those classes.  However, sometimes the method you want to wrap may actually exist on a interface or parent class (non-final) of the final class.

Funcito should be able to create the proxy for those interfaces or base classes instead, and then the method-wrapping would be successful.

For more informative error reporting, we would probably want to retain the identity of the original final class when proxying interfaces or parent classes, so in case the method-wrapping still fails there will be more information as to what happened.
May 21, 2012
Project Member #1 kandpwel...@gmail.com
(No comment was entered for this change.)
Labels: -Type-Defect Type-Enhancement
May 26, 2012
Project Member #2 kandpwel...@gmail.com
When I examined the possibility closer, I realized that it would not be possible to implement this without abandoning type-safety, and hence forcing the user to cast everything.  So it would be simpler for the user to continue to just declare the function-objects to have a source type of the non-final base class or implemented interface of interest (i.e., the type that does declare the non-final method(s) to be wrapped).  In other words, while the goal was to be able to do:
   Function<String,Integer> f = functionFor(callsTo(String.class).length());
... they will instead have to continue to use:
   Function<CharSequence,Integer> f = functionFor(callsTo(CharSequence.class).length());

Status: WontFix
Labels: -Milestone-R1.1