forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor]: Move members injection optimization into its RequestRepre…
…sentation. I've also added tests for this optimization, since nothing failed when I removed it. This CL moves the logic for a members injection optimization into its corresponding RequestRepresentation (`MembersInjectionRequestRepresentation`). The benefit of this refactor is 1. Consolidates the logic for members injection requests into a single location. 2. Simplifies `ComponentRequestRepresentations` and allows us to share more of the code between members injection and contribution component methods. RELNOTES=N/A PiperOrigin-RevId: 702018277
- Loading branch information
Showing
5 changed files
with
170 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...nTest_testMembersInjectionBindingWithNoInjectionSites_DEFAULT_MODE_test.DaggerMyComponent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package test; | ||
|
||
import dagger.internal.DaggerGenerated; | ||
import javax.annotation.processing.Generated; | ||
|
||
@DaggerGenerated | ||
@Generated( | ||
value = "dagger.internal.codegen.ComponentProcessor", | ||
comments = "https://dagger.dev" | ||
) | ||
@SuppressWarnings({ | ||
"unchecked", | ||
"rawtypes", | ||
"KotlinInternal", | ||
"KotlinInternalInJava", | ||
"cast", | ||
"deprecation", | ||
"nullness:initialization.field.uninitialized" | ||
}) | ||
public final class DaggerMyComponent { | ||
private DaggerMyComponent() { | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
public static MyComponent create() { | ||
return new Builder().build(); | ||
} | ||
|
||
public static final class Builder { | ||
private Builder() { | ||
} | ||
|
||
public MyComponent build() { | ||
return new MyComponentImpl(); | ||
} | ||
} | ||
|
||
private static final class MyComponentImpl implements MyComponent { | ||
private final MyComponentImpl myComponentImpl = this; | ||
|
||
private MyComponentImpl() { | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void inject(Foo foo) { | ||
} | ||
|
||
@Override | ||
public Foo injectAndReturn(Foo foo) { | ||
return foo; | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...est_testMembersInjectionBindingWithNoInjectionSites_FAST_INIT_MODE_test.DaggerMyComponent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package test; | ||
|
||
import dagger.internal.DaggerGenerated; | ||
import javax.annotation.processing.Generated; | ||
|
||
@DaggerGenerated | ||
@Generated( | ||
value = "dagger.internal.codegen.ComponentProcessor", | ||
comments = "https://dagger.dev" | ||
) | ||
@SuppressWarnings({ | ||
"unchecked", | ||
"rawtypes", | ||
"KotlinInternal", | ||
"KotlinInternalInJava", | ||
"cast", | ||
"deprecation", | ||
"nullness:initialization.field.uninitialized" | ||
}) | ||
public final class DaggerMyComponent { | ||
private DaggerMyComponent() { | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
public static MyComponent create() { | ||
return new Builder().build(); | ||
} | ||
|
||
public static final class Builder { | ||
private Builder() { | ||
} | ||
|
||
public MyComponent build() { | ||
return new MyComponentImpl(); | ||
} | ||
} | ||
|
||
private static final class MyComponentImpl implements MyComponent { | ||
private final MyComponentImpl myComponentImpl = this; | ||
|
||
private MyComponentImpl() { | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void inject(Foo foo) { | ||
} | ||
|
||
@Override | ||
public Foo injectAndReturn(Foo foo) { | ||
return foo; | ||
} | ||
} | ||
} |