Skip to content

static method in base class extended by motif object class will not be honored as factory method. #204

@TonyTangAndroid

Description

@TonyTangAndroid
@motif.Scope
public interface FooScope {

  Foo foo();

  @motif.Objects
  abstract class Objects extends OptionModule {
  }
}

class Foo {
  private final Bar bar;
  public Foo(Bar bar) {
    this.bar = bar;
  }
}

class Bar {}

abstract class OptionModule {
  abstract Bar bar();
  Foo foo(Bar bar) {
    return new Foo(bar);
  }
}

The above code will compile. However, if you add a static key word in OptionModule that is working as Foo factory method, the motif compiler will fail.

abstract class OptionModule {
  abstract Bar bar();
  static Foo foo(Bar bar) {
    return new Foo(bar);
  }
}

You could stably reproduce this issue based on this repo.

TonyTangAndroid/motif_static_issue#1

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