HTC's are great devices. Charp, elegant and very durable. And as for Xperia devices, they're very premium look sharp and offer great durability.
For development, I've noticed the Xperia has been getting lots of support. I also have a feeling it'll keep getting ota updates when Sony prepares them, since it is a recently released device.
The HTC M8 is great, the development community is good too. Just take a look at their sub forms to make out the development.
But if you wish to remain stock or have a stock like experience with good features. I would go for HTC since Sense 6 looks amazing. TimeScape UI is Sony's way if making things look right. But it isn't as great as Sense. But if you wish to run original developed ROMs then you must go for the Xperia Z2.
They're both great devices, but its your choice.
Sent from my Nexus 5 using Tapatalk