It is said that when you shake your family tree, you can sometimes be surprised with what falls out.
This is certainly true of Jesus’ family tree, and Matthew goes to lengths to make sure and include some people we would have rather not be mentioned; but God included them in Jesus’ lineage,and Matthew saw the importance of this.
God doesn’t mind associating His Son with people we would be wary of. One of those people is Judah.