You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2013/05/05 23:04:17 UTC
[jira] [Resolved] (OWB-768) add support for proxying protected
methods in NormalScopedProxyFactory
[ https://issues.apache.org/jira/browse/OWB-768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Struberg resolved OWB-768.
-------------------------------
Resolution: Fixed
already implemented
> add support for proxying protected methods in NormalScopedProxyFactory
> -----------------------------------------------------------------------
>
> Key: OWB-768
> URL: https://issues.apache.org/jira/browse/OWB-768
> Project: OpenWebBeans
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.2.0
> Reporter: Mark Struberg
> Assignee: Mark Struberg
> Fix For: 1.2.0
>
>
> Our Normalscoping proxies now roughly look like the following. For a
> public class User {
> public String getName() { return "Hans"; }
> }
> we create a dynamic subclass with ASM:
> public class User$OwbNormalscopeProxy extends User {
> private Provider<User> owbContextualInstanceProvider; // will be set by the proxy factory
> public String getName() {
> return owbContextualInstanceProvider.get().getName();
> }
> }
> The problem arises when getName() is not public but protected. In this case various access restrictions for protected variables kick in. For more details please read Java Langspec 3.0 ยง6.6.2 [1]. Especially take note of the second sample in 6.6.2.2.
> There are additional restrictions listed in the JVM spec becaues 2 packages technically are only counted as equals if they get loaded by the same ClassLoader.
> For those reasons I currently disabled proxying of protected methods for now. The long time solution might be to use reflection to invoke the proxied methods. I will introduce a static method in the NormalScopeProxyFactory which will contain all the necessary handling and can easily be used concurrently by all generated proxies.
> [1] http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.6.2
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira