You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Franta Mejta (JIRA)" <ji...@apache.org> on 2017/06/08 10:41:18 UTC

[jira] [Commented] (WICKET-4324) [wicket-ioc] LazyInitProxyFactory CGLIB proxies naming strategy may cause java.lang.IllegalAccessError

    [ https://issues.apache.org/jira/browse/WICKET-4324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16042534#comment-16042534 ] 

Franta Mejta commented on WICKET-4324:
--------------------------------------

[~mgrigorov] Modified test available at https://github.com/FrantaM/wicket/commit/0e4c9ba0a4d143ae1e081ff013f9e38b31ff4b69

Output:
{noformat}
testConcreteProxy(org.apache.wicket.proxy.LazyInitProxyFactoryTest)  Time elapsed: 0 s  <<< ERROR!
net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
	at org.apache.wicket.proxy.LazyInitProxyFactoryTest.testCGLibInterceptorReplacement(LazyInitProxyFactoryTest.java:186)
Caused by: java.lang.reflect.InvocationTargetException
	at org.apache.wicket.proxy.LazyInitProxyFactoryTest.testCGLibInterceptorReplacement(LazyInitProxyFactoryTest.java:186)
Caused by: java.lang.IllegalAccessError: class WICKET_org.apache.wicket.proxy.ConcreteObject$$EnhancerByCGLIB$$2e664c88 cannot access its superclass org.apache.wicket.proxy.ConcreteObject
	at org.apache.wicket.proxy.LazyInitProxyFactoryTest.testCGLibInterceptorReplacement(LazyInitProxyFactoryTest.java:186)
{noformat}

Note that the original description is _slightly_ wrong: the target class itself or its ctor has to be package private for this to happen.

> [wicket-ioc] LazyInitProxyFactory CGLIB proxies naming strategy may cause java.lang.IllegalAccessError
> ------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4324
>                 URL: https://issues.apache.org/jira/browse/WICKET-4324
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>            Reporter: S Mathez
>              Labels: proxy
>
> A CGLib proxy created by LazyInitProxyFactory may cause java.lang.IllegalAccessError when the target class has "package-private" method.
> I think the root cause of this problem is the choosen strategy for naming proxies (see WICKET-1162) : after adding "WICKET_" before the package name of the target class, the proxy becomes a member of a new package. (This behaviour is different as which is used by CGLib DefaultNamingPolicy).
> Why not adding "_WICKET" *after* the name of the target class ?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)