Enable some additional PMD rules, and fix sources to satisfy them.

Reviewed at https://reviews.apache.org/r/21849/