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

ScopeFactory with single unused dependency ignores the given creatable instance #200

Open
yayaa opened this issue Apr 2, 2020 · 1 comment
Labels
good first issue Good for newcomers

Comments

@yayaa
Copy link
Contributor

yayaa commented Apr 2, 2020

Generated code seems to ignore given instance for the dependency source while using ScopeFactory with a single unused dependency and tries to create the instance directly.

Library version: 0.3.3-SNAPSHOT

Repro steps or stacktrace:

Scope

@Scope
public interface TestScope extends Creatable<TestScope.Dependencies> {

    interface Dependencies {
        String blah();
    }
}

Creating instance of scope

TestScope.Dependencies dependencySource = 
    new TestScope.Dependencies() {
        @Override
        public String blah() {
            return "something";
         }
   };
ScopeFactory.create(TestScope.class, dependencySource);

Generated code

@ScopeImpl(
    children = {},
    scope = TestScope.class,
    dependencies = TestScope.Dependencies.class
)
public class TestScopeImpl implements TestScope {
  private final TestScope.Dependencies dependencies;

  public TestScopeImpl(TestScope.Dependencies dependencies) {
    this.dependencies = dependencies;
  }

  public TestScopeImpl() {
    this(new TestScope.Dependencies() {});
  }

  TestScope testScope() {
    return this;
  }
}

Notice this(new TestScope.Dependencies() {}); in constructor.

@Leland-Takamine Leland-Takamine added the good first issue Good for newcomers label Apr 20, 2020
@anawara
Copy link

anawara commented Sep 30, 2020

Hi! I was wondering if there's any updates on this issue?

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

No branches or pull requests

3 participants