question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reflect compiler not generating default builder class.

See original GitHub issue

By default, dagger-compiler generates a default Builder class.

With setup such as this:

interface Host {
  fun myDependency(): MyDependency
}

@Component(dependencies = [Host::class])
interface MyFeatureComponent {
  fun feature(): MyFeature
}

there will be a generated method

DaggerMyFeatureComponent.builder().dependencies(myDependencies).build()

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Laimiuxcommented, Aug 15, 2019

We declared @Component.Factory interface to workaround.

On Wed, Aug 14, 2019, 4:59 PM Rohan Dhruva notifications@github.com wrote:

Is there any workaround that can be used in the meantime for this? Can I provide the dependencies some other way?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JakeWharton/dagger-reflect/issues/145?email_source=notifications&email_token=AAWYO27KTCPMSZOGEXMJXDLQESL5FA5CNFSM4IEUY4DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4KOFXA#issuecomment-521462492, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWYO23JZ7S324YHMR5FYOLQESL5FANCNFSM4IEUY4DA .

1reaction
JakeWhartoncommented, Jul 18, 2019

We have a bunch of ignored functional tests for the same reason:

  // TODO reflect-compiler bug! Not generating builder method.
  exclude 'dagger/functional/builder/BuilderTest.java'
  exclude 'dagger/functional/cycle/DoubleCheckCycleTest.java'
  exclude 'dagger/functional/membersinject/MembersInjectionOrderingTest.java'
  exclude 'dagger/functional/nullables/NullabilityTest.java'
  exclude 'dagger/functional/MultibindingTest.java'
  exclude 'dagger/functional/NonComponentDependencyTest.java'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Java: newInstance of class that has no default constructor
Call Class.getConstructor() and then Constructor.newInstance() passing in the appropriate arguments. Sample code: import java.lang.reflect.
Read more >
Issues with Builder.Default on jdk9 #1547 - GitHub
It seems like there's an issue with Builder.Default on jdk9. These examples compile fine: @Builder class SomeClassWithLombokBuilder ...
Read more >
Why Default or No Argument Constructor is Important in Java ...
Almost all Java developers know that compiler adds a default constructor or better known as a no-argument constructor in every Java class, but...
Read more >
Protocol Buffer Basics: Java - Google Developers
The message classes generated by the protocol buffer compiler are all immutable. Once a message object is constructed, it cannot be modified, just...
Read more >
Java Reflection Example Tutorial - DigitalOcean
//because ConcreteClass is not available at compile time concreteClass = Class.forName("com.journaldev.reflection.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found