Animation error

I’m using Java-GI bindings library and I’m getting an error when I use Adw.Animation:

private void fadeWidget(Widget widget, DoneCallback onDone) { // widget is a Gtk.Image
	AnimationTarget target = new CallbackAnimationTarget(widget::setOpacity);
	Animation animation = new TimedAnimation(widget, 1.0, 0, 2000, target);
	animation.onDone(onDone);
	animation.play();
}

On startup, I’m getting in console:
(java:66340): Adwaita-CRITICAL **: 10:27:14.383: adw_animation_set_target: assertion 'ADW_IS_ANIMATION_TARGET (target)' failed

It’s not fatal and the application continues without problem, including the animation.
Any help appreciated.
Craig