I'm going to stick my hand up here and be labelled a do gooder. I'm not talking about homes which are lived in which are taken over, but many landlords myself included on occasions leave properties empty that ought not to be. Criminalising homeless poor people in favour of landowining middle classes is a law straight out of the middle ages and we should all hang our heads in shame that we allow such callous stupidity by our law makers.
I have had squatters 3 times, once they became tenants after we all had a chat, once I circumvented the law and removed them myself and once after some negotiation they left after a specific period of time. Most people squat because they have other social issues, these need addressing not by adding a criminal conviction but by actually helping to solve the underlying problems.