I have the annotation :
Code:
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.METHOD })
@Documented
@Inherited
public @interface Size {
int[] value() default {};
}
used on a pojo method like this (note:there is no compilation error) :
Code:
@Size({50,10})
public String getLibelle() {
return this.libelle;
}
ClassValidator hang up on
Code:
if ( valueMethod.getReturnType().isArray() ) {
values = (Object[]) valueMethod.invoke( annotation ); <== ClassCastException
}
It's hang up because value is an array of
primitives types (int[]) , not a (object[])
Hibernate version: hibernate-validator-3.1.0.CR1
hibernate-annotations-3.4.0.CR1
hibernate-distribution-3.3.0.CR1-dist
hibernate-entitymanager-3.4.0.CR1.tar
Full stack trace of any exception that occurs:Code:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:373)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1125)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
Code:
Caused by: java.lang.IllegalStateException: java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
at org.hibernate.validator.ClassValidator.handleAggregateAnnotations(ClassValidator.java:256)
at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:312)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:217)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:133)
... 12 more