Using any POSIX sort and awk with the OPs original grep -R:
$ grep -R serialVersionUID | sort -k2 -b |
awk '
{ curr=$0;currKey=$0; sub(/^[^[:space:]]+[[:space:]]+/,"",currcurrKey) }
currcurrKey == prevprevKey { print firstfirstLine $0; first="";firstLine=""; next }
{ prev=curr;prevKey=currKey; first=$0firstLine=$0 ORS }
'
./path/to/Another.java: private static final long serialVersionUID = 111L;
./path/to/Some.java: private static final long serialVersionUID = 111L;
Regarding [ ][ ] - blanks are already literal in a regexp, you don't need to put them inside a bracket expression. /[ ][ ]*/ is identical to / */. Maybe you meant to use /[ \t][ \t]*/ to match repetitions of blanks or tabs? You don't need that sed at all though, just add the -b option to sort as I did above to tell it to ignore leading spaces in a field.
The above assumes the file names output by grep -R don't contain white space. If they can then we'd need a different solution that doesn't start with grep -R.