Skip to content

Add missing @Override annotations to Comparable implementations #4

Description

@LSantha

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions