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

Factory ProcessorModule not picked up with dagger 1.2.1 #76

Open
Zubnix opened this issue Feb 20, 2014 · 13 comments
Open

Factory ProcessorModule not picked up with dagger 1.2.1 #76

Zubnix opened this issue Feb 20, 2014 · 13 comments
Assignees
Labels
Component: factory P3 type=defect Bug, not working as expected

Comments

@Zubnix
Copy link

Zubnix commented Feb 20, 2014

I'm still quite new to dagger and the auto tools (great libs btw!) and I'm trying out auto factory. However I get an error that I don't know how to fix? I use dagger 1.2.1. and afaik I'm doing nothing fancy. (just annotating a class with autofactory). All these types seem to be defined by the ProcessorModule, so I'm a bit puzzled as to why they're not picked up.

java: java.lang.IllegalStateException: Errors creating object graph:
javax.annotation.processing.Messager could not be bound with key javax.annotation.processing.Messager required by class com.google.auto.factory.processor.AutoFactoryProcessor
javax.lang.model.util.Elements could not be bound with key javax.lang.model.util.Elements required by class com.google.auto.factory.processor.AutoFactoryProcessor
javax.lang.model.util.Types could not be bound with key javax.lang.model.util.Types required by class com.google.auto.factory.processor.AutoFactoryProcessor
javax.annotation.processing.Filer could not be bound with key javax.annotation.processing.Filer required by class com.google.auto.factory.processor.FactoryWriter

@Zubnix
Copy link
Author

Zubnix commented Feb 22, 2014

Caused when using dagger 1.2.1

It works when using dagger 1.2.0

@gk5885
Copy link
Contributor

gk5885 commented Feb 25, 2014

Using dagger in the processor was a bit of an experiment. I'll try to reproduce this error and get a fix in, but if it doesn't work out we can just ditch DI for this.

@gk5885 gk5885 self-assigned this Feb 25, 2014
@Zubnix
Copy link
Author

Zubnix commented Feb 26, 2014

If you remove the DI, will I still be able to use the generated factory as-is (no special provider method)? My gut feeling is that it's probably just the 'addsTo' that should be replaced by an 'includes', iirc the 'addsTo' behavior has changed with dagger 1.2.1.

@cgruber
Copy link
Contributor

cgruber commented Feb 26, 2014

 'addsTo' behavior has changed with dagger 1.2.1.

Um... what?

@Zubnix
Copy link
Author

Zubnix commented Feb 27, 2014

From the almost non existing documentation of dagger, it was my understanding that addsTo was more of a hint that you'll plus() the module, and instead you should use include(?).

square/dagger#370

"Dev note:

From an implementation perspective, addsTo= and includes= both permit analysis to be performed across the module boundary (takes into account bindings from the referred-to module) but addsTo won't instantiate module instances the way includes= does, since it assumes the module and its inclusions to exist in the parent."

If you check the source code of auto factory processor module:
https://github.com/google/auto/blob/master/factory/src/main/java/com/google/auto/factory/processor/AutoFactoryProcessorModule.java

You'll see that it 'addsTo' and thus will not instantiate the ProcessorModule(?).

It's mostly guessing from my position, so forgive me if I'm wrong. :)

@gk5885
Copy link
Contributor

gk5885 commented Feb 27, 2014

In any case, addsTo is definitely incorrect for the processor module. I think there might have been a separate ObjectGraph once upon a time, but when that went away the module wasn't updated. I'll definitely fix that and we'll see if it addresses the issue.

@pyricau
Copy link

pyricau commented May 2, 2014

Just tried playing with AutoFactory, got the same error. Reverting to Dagger 1.2.0 fixed it. (not really though, I really want to use 1.2.1).

@yogurtearl
Copy link

Just ran into this error...

@runningcode
Copy link

Ran in to this error as well with Dagger 1.2.2.

@adrian-chang
Copy link

Does downgrading to 1.2.0 @pyricau or anyone cause any negative effects if going from 1.2.0 -> 1.2.1? I'm at the point where I should start using auto otherwise codebase quality will degrade... Unless there will be an auto update or dagger update to fix this issue....

@serandel
Copy link

It also happens with Dagger 1.2.2

@svenjacobs
Copy link

Any news on this? Compatibility with Dagger 1.2.2 (or 2.0 for that matter) would be really nice.

@raghsriniv raghsriniv added the P3 label Jun 24, 2019
@kluever kluever added the type=defect Bug, not working as expected label Aug 13, 2019
@kluever
Copy link
Member

kluever commented Aug 13, 2019

Has this been resolved in the past 4 years?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: factory P3 type=defect Bug, not working as expected
Projects
None yet
Development

No branches or pull requests