Skip to content

Commit

Permalink
Internal Changes.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 446778315
  • Loading branch information
wanyingd1996 authored and Dagger Team committed May 5, 2022
1 parent d14a3d6 commit e793595
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,20 @@ private CodeBlock componentBuilder() {
// @CallSuper
// @Override
// public void onCreate() {
// injectApplication();
// hiltInternalInject();
// super.onCreate();
// }
private MethodSpec onCreateMethod() {
return MethodSpec.methodBuilder("onCreate")
.addAnnotation(AndroidClassNames.CALL_SUPER)
.addAnnotation(Override.class)
.addModifiers(Modifier.PUBLIC)
.addStatement("injectApplication()")
.addStatement("hiltInternalInject()")
.addStatement("super.onCreate()")
.build();
}

// public void injectApplication() {
// public void hiltInternalInject() {
// if (!injected) {
// injected = true;
// // This is a known unsafe cast but should be fine if the only use is
Expand All @@ -207,7 +207,8 @@ private MethodSpec onCreateMethod() {
// }
// }
private MethodSpec injectionMethod() {
return MethodSpec.methodBuilder("injectApplication")
return MethodSpec.methodBuilder("hiltInternalInject")
.addModifiers(Modifier.PROTECTED)
.beginControlFlow("if (!injected)")
.addStatement("injected = true")
.addCode(injectCodeBlock())
Expand All @@ -225,13 +226,13 @@ private static FieldSpec injectedField() {

// @Override
// public final void customInject() {
// injectApplication();
// hiltInternalInject();
// }
private MethodSpec customInjectMethod() {
return MethodSpec.methodBuilder("customInject")
.addAnnotation(Override.class)
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
.addStatement("injectApplication()")
.addStatement("hiltInternalInject()")
.build();
}

Expand Down

0 comments on commit e793595

Please sign in to comment.