HV-877 Supporting type use constraints on type arguments

This applies to `PropertyMetaData`. After your feedback, I'll continue the work on parameters and return values and I'll extend `ParameterMetaData` and `ReturnValueMetaData`.
Ok, I had a closer look now.

I believe it's indeed an issue with the JDK itself,
Parameter#getAnnotatedType() fails when being invoked for methods with a
synthetic parameter (for non-static inner classes, the compiler inserts a
synthetic parameter at the first position through which an instance of the
outer class is passed). If the parameter(s) of such a constructor contain
generic types, Executable#getGenericParameterTypes() (which is invoked
underneath) doesn't return all the parameters, thus an AIOOBE is raised
when trying to access the last parameter.

There is bug [JDK-5087240](https://bugs.openjdk.java.net/browse/JDK-5087240)
which I think is the root cause.

There is not much we can do. I think we should log a warning in the catch
clause, because we won't properly validate the concerned parameter.

As a workaround, you could make the inner classes in the affected test
static (so no synthetic parameter is introduced) or you make the parameter
not a generic type.


2014-08-01 9:55 GMT+02:00 Khalid <notifications@github.com>:

> In
> engine/src/main/java/org/hibernate/validator/internal/metadata/provider/TypeUseAnnotationMetaDataProvider.java:
>
> > +
> > +		if ( member instanceof Method ) {
> > +			annotatedType = ( (Method) member ).getAnnotatedReturnType();
> > +		}
> > +
> > +		return findTypeArgumentsConstraints( member, annotatedType );
> > +	}
> > +
> > +	@Override
> > +	protected Set<MetaConstraint<?>> findTypeArgumentsConstraints(Member member, int i) {
> > +		Parameter parameter = ( (Executable) member ).getParameters()[i];
> > +		try {
> > +			return findTypeArgumentsConstraints( member, parameter.getAnnotatedType() );
> > +		}
> > +		catch ( ArrayIndexOutOfBoundsException ex ) {
> > +			// Synthetic parameter, ignore
>
> @gunnarmorling <https://github.com/gunnarmorling>, b23 didn't help.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/hibernate/hibernate-validator/pull/332/files#r15685449>
> .
>