[hibernate-issues] [Hibernate-JIRA] Resolved: (HV-257) ReflectionHelper.getValue fails to retrieve values from methods defined on a parent interface
Hardy Ferentschik (JIRA)
noreply at atlassian.com
Mon Oct 26 12:14:13 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HV-257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hardy Ferentschik resolved HV-257.
----------------------------------
Resolution: Fixed
Fix Version/s: 4.0.1
Added a fix to ReflectionHelper.setAccessibility.
Now we also call setAccessible in case of public abstract members. If you proxy an interface using java.lang.reflect.Proxy
per default you will get a IllegalAccessException since you are not allowed to access abstract methods.
Seems odd. One could argue that the proxy 'is' the implementation for the interface method and hence they
should be accessible. Maybe this is a JVM bug !?
> ReflectionHelper.getValue fails to retrieve values from methods defined on a parent interface
> ---------------------------------------------------------------------------------------------
>
> Key: HV-257
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-257
> Project: Hibernate Validator
> Issue Type: Bug
> Components: validators
> Affects Versions: Bundle 3.2.1, 3.0.0.ga, 3.1.0.CR1, 3.1.0.CR2, 3.1.0.GA, 4.0.0.Alpha1, 4.0.0.Alpha2, 4.0.0.Alpha3, 4.0.0.Beta1, 4.0.0.Beta2, 4.0.0.Beta3, 4.0.0.CR1, 4.0.0.GA
> Environment: hibernate-validator 4.0.0.CR1
> Reporter: Amir Kibbar
> Fix For: 4.0.1
>
> Attachments: validator-test-case.tar.gz
>
>
> I've defined an interface A with method foo with a constraint annotation on it.
> I've then defined an interface B that extends interface A.
> I've created a proxy (invocation handler) that implements interface B at runtime.
> When I try to validate the proxy object I get an IllegalAccessException because the modifier on the method the ReflectionHelper.getValue() is trying to invoke has the "public abstract" modifiers.
> This can easily be solved if the getValue() will set method.setAccesible(true) before attempting to invoke it (and then reset it to the previous value obviously).
> thanks,
> Amir
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list