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.
Add a test for Kotlin nullable field injection.
PiperOrigin-RevId: 676595690
- Loading branch information
1 parent
f8a09b2
commit 8d9f082
Showing
3 changed files
with
132 additions
and
0 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
55 changes: 55 additions & 0 deletions
55
...mbersInjectionTest_kotlinNullableFieldInjection_DEFAULT_MODE_test.MyClass_MembersInjector
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,55 @@ | ||
package test; | ||
|
||
import dagger.MembersInjector; | ||
import dagger.internal.DaggerGenerated; | ||
import dagger.internal.InjectedFieldSignature; | ||
import dagger.internal.QualifierMetadata; | ||
import javax.annotation.processing.Generated; | ||
import javax.inject.Provider; | ||
|
||
@QualifierMetadata | ||
@DaggerGenerated | ||
@Generated( | ||
value = "dagger.internal.codegen.ComponentProcessor", | ||
comments = "https://dagger.dev" | ||
) | ||
@SuppressWarnings({ | ||
"unchecked", | ||
"rawtypes", | ||
"KotlinInternal", | ||
"KotlinInternalInJava", | ||
"cast", | ||
"deprecation" | ||
}) | ||
public final class MyClass_MembersInjector implements MembersInjector<MyClass> { | ||
private final Provider<String> nullableStringProvider; | ||
|
||
private final Provider<Object> nullableObjectProvider; | ||
|
||
public MyClass_MembersInjector(Provider<String> nullableStringProvider, | ||
Provider<Object> nullableObjectProvider) { | ||
this.nullableStringProvider = nullableStringProvider; | ||
this.nullableObjectProvider = nullableObjectProvider; | ||
} | ||
|
||
public static MembersInjector<MyClass> create(Provider<String> nullableStringProvider, | ||
Provider<Object> nullableObjectProvider) { | ||
return new MyClass_MembersInjector(nullableStringProvider, nullableObjectProvider); | ||
} | ||
|
||
@Override | ||
public void injectMembers(MyClass instance) { | ||
injectNullableString(instance, nullableStringProvider.get()); | ||
injectNullableObject(instance, nullableObjectProvider.get()); | ||
} | ||
|
||
@InjectedFieldSignature("test.MyClass.nullableString") | ||
public static void injectNullableString(MyClass instance, String nullableString) { | ||
instance.nullableString = nullableString; | ||
} | ||
|
||
@InjectedFieldSignature("test.MyClass.nullableObject") | ||
public static void injectNullableObject(MyClass instance, Object nullableObject) { | ||
instance.nullableObject = nullableObject; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...ersInjectionTest_kotlinNullableFieldInjection_FAST_INIT_MODE_test.MyClass_MembersInjector
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,55 @@ | ||
package test; | ||
|
||
import dagger.MembersInjector; | ||
import dagger.internal.DaggerGenerated; | ||
import dagger.internal.InjectedFieldSignature; | ||
import dagger.internal.QualifierMetadata; | ||
import javax.annotation.processing.Generated; | ||
import javax.inject.Provider; | ||
|
||
@QualifierMetadata | ||
@DaggerGenerated | ||
@Generated( | ||
value = "dagger.internal.codegen.ComponentProcessor", | ||
comments = "https://dagger.dev" | ||
) | ||
@SuppressWarnings({ | ||
"unchecked", | ||
"rawtypes", | ||
"KotlinInternal", | ||
"KotlinInternalInJava", | ||
"cast", | ||
"deprecation" | ||
}) | ||
public final class MyClass_MembersInjector implements MembersInjector<MyClass> { | ||
private final Provider<String> nullableStringProvider; | ||
|
||
private final Provider<Object> nullableObjectProvider; | ||
|
||
public MyClass_MembersInjector(Provider<String> nullableStringProvider, | ||
Provider<Object> nullableObjectProvider) { | ||
this.nullableStringProvider = nullableStringProvider; | ||
this.nullableObjectProvider = nullableObjectProvider; | ||
} | ||
|
||
public static MembersInjector<MyClass> create(Provider<String> nullableStringProvider, | ||
Provider<Object> nullableObjectProvider) { | ||
return new MyClass_MembersInjector(nullableStringProvider, nullableObjectProvider); | ||
} | ||
|
||
@Override | ||
public void injectMembers(MyClass instance) { | ||
injectNullableString(instance, nullableStringProvider.get()); | ||
injectNullableObject(instance, nullableObjectProvider.get()); | ||
} | ||
|
||
@InjectedFieldSignature("test.MyClass.nullableString") | ||
public static void injectNullableString(MyClass instance, String nullableString) { | ||
instance.nullableString = nullableString; | ||
} | ||
|
||
@InjectedFieldSignature("test.MyClass.nullableObject") | ||
public static void injectNullableObject(MyClass instance, Object nullableObject) { | ||
instance.nullableObject = nullableObject; | ||
} | ||
} |