Description
Several classes in the codebase implement the Comparable interface but are missing @Override annotations on their compareTo(), equals(), and hashCode() methods. The presence of @see Javadoc tags in these methods confirms they should have @Override annotations.
Affected Files
| File |
Methods Missing @OverRide |
builder/src/builder/org/jnode/build/documentation/LicenseEntry.java:68 |
compareTo(LicenseEntry o) |
builder/src/builder/org/jnode/ant/taskdefs/classpath/PackageDirectory.java:42,61,72 |
compareTo(Object obj), equals(Object obj), hashCode() |
builder/src/builder/org/jnode/ant/taskdefs/classpath/SourceFile.java |
compareTo, equals, hashCode |
core/src/core/org/jnode/assembler/Label.java:60,73,84 |
equals(Object o), hashCode(), compareTo(Object o) |
core/src/driver/org/jnode/driver/system/acpi/aml/NameString.java |
compareTo, equals |
Example Fix
Before (Label.java:84):
public int compareTo(Object o) {
After:
@Override
public int compareTo(Object o) {
Task
Add @Override annotation before each method that overrides/implements a parent method in the classes listed above.
Difficulty
Easy - Pure annotation addition with no logic changes. The Java compiler will verify correctness (won't compile if added incorrectly). Multiple files with same pattern make this suitable for batch fixing.
Additional Notes
- Many of these methods already have
@see Javadoc tags referencing the parent method, confirming they should have @Override
- This improves code clarity and enables compiler checking
- Similar fixes may be needed for other classes implementing interfaces like
Runnable, Comparator, etc.
Description
Several classes in the codebase implement the
Comparableinterface but are missing@Overrideannotations on theircompareTo(),equals(), andhashCode()methods. The presence of@seeJavadoc tags in these methods confirms they should have@Overrideannotations.Affected Files
builder/src/builder/org/jnode/build/documentation/LicenseEntry.java:68compareTo(LicenseEntry o)builder/src/builder/org/jnode/ant/taskdefs/classpath/PackageDirectory.java:42,61,72compareTo(Object obj),equals(Object obj),hashCode()builder/src/builder/org/jnode/ant/taskdefs/classpath/SourceFile.javacompareTo,equals,hashCodecore/src/core/org/jnode/assembler/Label.java:60,73,84equals(Object o),hashCode(),compareTo(Object o)core/src/driver/org/jnode/driver/system/acpi/aml/NameString.javacompareTo,equalsExample Fix
Before (Label.java:84):
After:
Task
Add
@Overrideannotation before each method that overrides/implements a parent method in the classes listed above.Difficulty
Easy - Pure annotation addition with no logic changes. The Java compiler will verify correctness (won't compile if added incorrectly). Multiple files with same pattern make this suitable for batch fixing.
Additional Notes
@seeJavadoc tags referencing the parent method, confirming they should have@OverrideRunnable,Comparator, etc.