We ran into this issue with ktfmt, and solved it by replacing the last of the trailing spaces with a special tombstone to prevent GJF from removing all trailing whitespace.
facebook/ktfmt@a4fdd39
I'm filing this issue so ktfmt can revert to using the supported method once it's available in GJF :)
(assuming multiline strings in Java are going to be a thin soon-ish)