Remove trailing spaces from all java and scala files.

@guillaumebort This is a followup of #701.

It removes all trailing spaces from scala and java files in `framework/`.

I ran all tests, and all that were passing before my change still seem to pass.

No functionality was changed, this just attempts to unify some of the coding style. There are other similar changes that I can make (I notice that `foo{` and `foo {` are mixed and matched a lot) if these kinds of changes are accpted.

I've already signed the CLA.