Field (@Nullable Type t) { if (t instanceof ClassType cls) { if (myTargetClassFilter.acceptClass(cls)) { return cls.fieldByName(myFieldName); } for (final InterfaceType interfaceType : cls.interfaces()) { final Field field = findField(interfaceType); if (field != null) { return field; } } return findField(cls.superclass()); } else if (t instanceof InterfaceType iface) { if (myTargetClassFilter.acceptClass(iface)) { return iface.fieldByName(myFieldName); } for (final InterfaceType interfaceType : iface.superinterfaces()) { final Field field = findField(interfaceType); if (field != null) { return field; } } } return null; }