Sometimes reviewers make mistakes. That may well be what happened in this case. I don't know, I am not qualified to judge the veracity of your edit, as I am not a Java programmer nor do I know anything about the framework that is used by the code in the answer. As a result, I would have chosen to "Skip" while reviewing that edit, not "Reject".
If I were knowledgeable about the answer's domain, I would have made a decision regarding the veracity of your edit. If it were correct or otherwise an improvement over the original answer, I would have clicked "Accept". If it were incorrect or merely stylistic with no apparent practical benefit, I would have clicked "Reject" and typed a custom rejection reason that explained my rationale.
I have no idea if the people who reviewed and voted on your edit made the right call or not. I don't know if they're knowledgeable in the answer's domain, I don't know if they read and considered the suggested code improvement carefully, and I don't know enough to second-guess their decision for myself.
But I do know that this same type of mistake is commonly made. Consider this edit, proposed yesterday to one of my answers by the user Zurb while I was away. Three different people rejected this edit for the same reason that they rejected your suggested edit:
This edit is incorrect or an attempt to reply to or comment on the existing post.
But they were wrong. The edit was certainly not incorrect—it was the original answer that was incorrect. I bungled my closing braces (a common problem when writing code in a simple textbox, without auto-completion or syntax checking), and the resulting code was just straight up wrong. The base class method should always be called in this example, and it wasn't the way I had written the code. A simple fix, just rearrange the braces. I had also forgotten that the IntPtr type can't be directly compared to a bool, likely a result of spending more time working in C++ lately. The editor caught that as well, submitting a perfectly valid and appropriate fix: an explicit conversion to an integer.
Nor was the edit an "attempt to reply to or comment on the existing post". There are no "replies" to answers, just additional answers. And it would have been the height of insanity to post these corrections as a new answer. It would have plagiarized far too much of my work, and added nothing whatsoever to the question. It also would have left my answer in a poor state, demonstrating wrong code, which was especially bad considering that my answer had already been accepted by the asker.
Sure, I guess Zurb could have posted this as a comment to my answer. But why? Then I would have had to go through the typical parade of comment notifications in my inbox, find his comment, read and understand what he was saying, reevaluate my own code, and fix the problem myself. All for what? Certainly not because my answers are "off limits" to other people. That would contradict the FAQ, which says that the site is collaboratively edited, with the goal to make the content as useful and accurate as possible. I don't have the option of making my answers "off limits" to others even if I wanted to, and I certainly wouldn't want to, because that just makes more work for myself. It's not a homework assignment, I'm not learning anything by being forced to go back and fix my own bone-headed mistakes. I already know better, I just mistyped. No different than had eye mispelled a wod. (Please fix those if you see them, they make me look dumb.)
At least the system notifies me of when people have made an attempt to improve my contributions. That way, even if the editor doesn't get the credit, I still have a way to fix my mistakes and make the site a little bit better resource for everyone.