HHH-10419 Detect if the user inappropriately left @Convert.converter to void
This commit is contained in:
parent
bb7cb7636b
commit
0c38cfc9d7
|
@ -94,10 +94,24 @@ public abstract class AbstractPropertyHolder implements PropertyHolder {
|
|||
}
|
||||
|
||||
protected IllegalStateException buildExceptionFromInstantiationError(AttributeConversionInfo info, Exception e) {
|
||||
return new IllegalStateException(
|
||||
String.format( "Unable to instantiate AttributeConverter [%s]", info.getConverterClass().getName() ),
|
||||
e
|
||||
);
|
||||
if ( void.class.equals( info.getConverterClass() ) ) {
|
||||
// the user forgot to set @Convert.converter
|
||||
// we already know it's not a @Convert.disableConversion
|
||||
return new IllegalStateException(
|
||||
"Unable to instantiate AttributeConverter: you left @Convert.converter to its default value void.",
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
else {
|
||||
return new IllegalStateException(
|
||||
String.format(
|
||||
"Unable to instantiate AttributeConverter [%s]",
|
||||
info.getConverterClass().getName()
|
||||
),
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected AttributeConverterDescriptor makeAttributeConverterDescriptor(AttributeConversionInfo conversion) {
|
||||
|
|
Loading…
Reference in New Issue