Skip to content

@DoNotOverride for interface default methods #5719

@vorburger

Description

@vorburger

@DoNotOverride for interface default methods would be neat, e.g. for something like this, which for better composability one wouldn't want to have to create an abstract class for, and would want ensure is never changed by implementing classes:

public interface Hashable {

   @DoNotOverride
   default Multihash hash() {
        var hasher = Hasher.sha512();
        hash(hasher);
        return hasher.hash(Multihash.Type.sha2_512);
   }

   void hash(Hasher hasher);
}

Just a thought.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions