Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TonyTangAndroid opened this issue May 15, 2020 · 0 comments

Comments

@TonyTangAndroid
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant