Hello,
I am trying to work with package visibility Entity classes (why I do this is out of the scope of this post, but I can answer any questions if you're curious)
Note: the JSR220 - section 2.1 does not state that being a public class is a requirement of the Entity classes.
I have a @NotNull hibernate annotation on a given getter method.
I am facing an issue in Hibernate Validator:
As of Hibernate Validator 3.0.0.GA the method
org.hibernate.validator.ClassValidator.setAccessible(XMember member)
looks like:
private static void setAccessible(XMember member) {
if ( !Modifier.isPublic( member.getModifiers() ) ) {
member.setAccessible( true );
}
}
The issue is that my getter method is public, so that setAccessible(true) is never called, while the package visibility of the Entity class prevents calling the method, so that I get an IllegalAccessException.
If I change the getter method to package-visibility (i.e. remove public) the validator works fine.
Shouldn't the code above check for actual accessibility instead of looking at the modifiers?
Thanks in advance
Best regards
Jan
|