Fix java warnings and lint errors (everything except unused variable warnings)

Reduce number of eclipse warnings, get rid of Xlint:unchecked gradle warnings.