SemanticDiff icon indicating copy to clipboard operation
SemanticDiff copied to clipboard

Do not report Java `@Override` annotations as “Moved without changes”

Open jglick opened this issue 10 months ago • 0 comments

Consider https://app.semanticdiff.com/gh/jenkinsci/jenkins/pull/9688/changes#cli/src/main/java/hudson/cli/CLI.java?ignore_comments=true as an example. (https://github.com/jenkinsci/jenkins/pull/9688) In two places (as of this writing) there are entries in the diff which are highlighted with boxes

@Override

and called out as Moved without changes. This is silly because the annotation was clearly not “moved”, it is associated directly with the method declaration on the following line, and was written independently.

(In Java, this annotation serves a special purpose more akin to a modifier, which is how it is treated in C#. So it would logically belong on the same line as the rest of the method declaration. Yet typical Java formatting tools insist on placing every annotation on a separate line.)

It would be nice if the SemanticDiff module for Java syntax understood that an @Override annotation is not unique content that might have come from elsewhere, any more than a void keyword in a method return type was “copied” from some unrelated method in the original code.

jglick avatar Feb 21 '25 17:02 jglick