Skip to content

Protocols with default methods in extension fail to compile #562

@madsodgaard

Description

@madsodgaard

If you have a protocol which has a default method implemented in an extension, the generated code will fail to compile because the Java compiler will complain about the extracted interface "is not abstract and does not override abstract method".

Consider the following

protocol MyProtocol {}

extension MyProtocol {
  public func myDefaultMethod() {}
}

will fail with:

error: MyProtocol is not abstract and does not override abstract method myDefaultMethod() in MyProtocol

Instead we should not generate any methods, variables and initializers defined in extensions as part of the extracted interface. But we could generate them as default methods instead. This means we need to change the analysis phase to know what decls are defined in an extension and which come from the protocol requirements themselves.

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