Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Differences in inner class qualifiers (. vs $) #444

Open
bentatham opened this issue Oct 7, 2014 · 1 comment
Open

Differences in inner class qualifiers (. vs $) #444

bentatham opened this issue Oct 7, 2014 · 1 comment

Comments

@bentatham
Copy link

I have an inner class (enum actually), and depending on how the ModuleAdapter is generated, I get different results. The @Provides is in a separate project from the @Inject point. I all cases, I'm using dagger 1.2.2.

In the following example, Led is an inner enum of SystemLeds.

From the requirement side:

platformLeds = (Binding<ca.nanometrics.apollo.helios.system.leds.util.SystemLeds.Led[]>) linker.requestBinding("ca.nanometrics.apollo.helios.system.leds.util.SystemLeds.Led[]", HeliosDebugModule.class, getClass().getClassLoader());

and in the provides side I have:

super("ca.nanometrics.apollo.helios.system.leds.util.SystemLeds$Led[]", NOT_SINGLETON, "ca.nanometrics.apollo.centaur3.Centaur3Module", "platformLeds");

Note the difference in the . vs $ in the qualification of the inner class.

This, of course, leads to java.lang.IllegalStateException: Errors creating object graph: & ca.nanometrics.apollo.helios.system.leds.util.SystemLeds.Led[] required by class ca.nanometrics.apollo.helios.debug.HeliosDebugModule

I can't quite pin down exactly what's going on, but I suspect it may be caused by the code generation sometimes happening from the mvn command line (with a JDK 8 -> target Java 7) and running within m2e which delegates to the maven-processor-plugin. This may be using JDK 7. So perhaps this is a discrepancy in the JavaWriter between Java7 and Java8, even though the target is always Java7. In any case, I would expect the strings generated for the Inject<->Provides mapping to always match.

I assume this would not be an issue in Dagger 2, since the map-style interface will be gone?

@JakeWharton
Copy link
Collaborator

Yes this is solved in v2. Still would be nice to fix it in v1, though.

tbroyer pushed a commit to tbroyer/dagger that referenced this issue Sep 3, 2016
…c3f9f3b293085727489fa39fb1134a4d36aaf

Moe sync 08/23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants