@@ -459,9 +459,14 @@ private void transformFieldAnnotation(
459459 transform (fieldEntry );
460460 }
461461
462- field .set (result , instanceCache .get (fieldEntry .id ()));
462+ try {
463+ field .set (result , instanceCache .get (fieldEntry .id ()));
464+ } catch (IllegalArgumentException e ) {
465+ // Field doesn't exist on the result object, skip it and continue
466+ }
463467 } else if (value instanceof Collection ) {
464- @ SuppressWarnings ("unchecked" ) final Collection <Object > collection = (Collection ) value ;
468+ @ SuppressWarnings ("unchecked" ) final Collection <Object > collection
469+ = (Collection <Object >) value ;
465470
466471 final ArrayList <Object > transformedList = new ArrayList <>(collection .size ());
467472 for (final Object element : collection ) {
@@ -475,11 +480,18 @@ private void transformFieldAnnotation(
475480 } else {
476481 transformedList .add (element );
477482 }
478-
483+ }
484+ try {
479485 field .set (result , transformedList );
486+ } catch (IllegalArgumentException e ) {
487+ // Field doesn't exist on the result object, skip it and continue
480488 }
481489 } else {
482- field .set (result , value );
490+ try {
491+ field .set (result , value );
492+ } catch (IllegalArgumentException e ) {
493+ // Field doesn't exist on the result object, skip it and continue
494+ }
483495 }
484496 } catch (IllegalAccessException e ) {
485497 throw new IllegalStateException ("Cannot set custom field " + key + "." );
0 commit comments