You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2014/05/27 09:20:10 UTC

[jira] [Updated] (TAP5-1754) BeanModelSource cannot introspect CGLIB proxies and anonymous classes

     [ https://issues.apache.org/jira/browse/TAP5-1754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Kemnade updated TAP5-1754:
---------------------------------

    Labels: bulk-close-candidate  (was: )

This issue has been last updated about 1.5 years ago, has no assignee, affects an old version of Tapestry that is not actively developed anymore, and is therefore prone to be bulk-closed in the near future.

If the issue still persists with the most recent development preview of Tapestry (5.4-beta-6, which is available from Maven Central), please update it as soon as possible. In the case of a feature request, please discuss it with the Tapestry developer community on the dev@tapestry.apache.org mailing list first.


> BeanModelSource cannot introspect CGLIB proxies and anonymous classes
> ---------------------------------------------------------------------
>
>                 Key: TAP5-1754
>                 URL: https://issues.apache.org/jira/browse/TAP5-1754
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.2.6
>            Reporter: Julian Vassev
>            Priority: Minor
>              Labels: bulk-close-candidate
>
> When T5 is trying to create a BeanModel for displaying a row in a <t:grid> it examines the class of (maybe) the first element of the source list.
> Sometimes I put CGLIB proxies or Anonymous classes in the source list.
> When the class is anonymous, T5 complains about not being able to access  the generated class
> java.lang.IllegalAccessError: tried to access class pkg.impl.FileSystemArchiveRepository$3$1 from class $PropertyConduit_133bd7cf475
> When accessing a CGLIB proxy:
> Render queue error in SetupRender[AddDomain:grid.columns]: Failure reading parameter 'model' of component AddDomain:grid: Exception generating conduit for expression 'exposeProxy': Class pkg.impl.DomainImpl does not contain a property (or public field) named 'exposeProxy'
> I solved the problem by using T5 AOP (really great feature) but think it should be handled by Tapestry:
>     @Match("BeanModelSource")
>     public static void adviseAll(MethodAdviceReceiver receiver) {
>         MethodAdvice advice = new MethodAdvice() {
>             @Override
>             public void advise(Invocation invocation) {
>                 if (invocation.getMethodName().startsWith("create")) {
>                     Class<?> clazz = (Class<?>) invocation.getParameter(0);
>                     if (clazz.isAnonymousClass()) {
>                         invocation.override(0, findFirstNonAnonymousParent(clazz));
>                     }
>                     //spring aop
>                     if (AopUtils.isCglibProxyClass(clazz)) {
>                         invocation.override(0, (clazz.getSuperclass()));
>                     }
>                     invocation.proceed();
>                 }
>             }
>         };
>         receiver.adviseAllMethods(advice);
>     }
>     public static Class<?> findFirstNonAnonymousParent(Class<?> clazz) {
>         while (clazz.isAnonymousClass()) {
>             clazz = clazz.getSuperclass();
>         }
>         return clazz;
>     }



--
This message was sent by Atlassian JIRA
(v6.2#6252)