Skip to content

Commit

Permalink
HHH-17382 Walk superclasses when searching instantiation field
Browse files Browse the repository at this point in the history
  • Loading branch information
mbladel committed Nov 20, 2023
1 parent 56efddc commit 27c3078
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ public DynamicInstantiationAssemblerInjectionImpl(

private Field findField(Class<?> declaringClass, String name, Class<?> javaType) {
try {
Field field = declaringClass.getDeclaredField( name );
final Field field = declaringClass.getDeclaredField( name );
// field should never be null
if ( Compatibility.areAssignmentCompatible( field.getType(), javaType ) ) {
field.setAccessible( true );
return field;
}
}
catch (NoSuchFieldException ignore) {
if ( declaringClass.getSuperclass() != null ) {
return findField( declaringClass.getSuperclass(), name, javaType );
}
}

return null;
Expand Down

0 comments on commit 27c3078

Please sign in to comment.