-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added warnings about usage of GlobalDI
- Loading branch information
Showing
5 changed files
with
30 additions
and
2 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
11 changes: 11 additions & 0 deletions
11
android/src/main/kotlin/app/meetacy/di/android/annotation/AndroidGlobalApi.kt
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,11 @@ | ||
package app.meetacy.di.android.annotation | ||
|
||
@RequiresOptIn( | ||
message = "Be careful when using such API. " + | ||
"First of all it's immutable (and it will be), so you initialize it's value only once. " + | ||
"That already means, that you can't use global DI if you plan testing things. " + | ||
"It was made primarily meant for integrations between modules where there is no " + | ||
"another option, but to use a Global singleton", | ||
level = RequiresOptIn.Level.WARNING | ||
) | ||
annotation class AndroidGlobalApi() |
2 changes: 2 additions & 0 deletions
2
global/src/commonMain/kotlin/app/meetacy/di/global/GlobalDI.kt
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
11 changes: 11 additions & 0 deletions
11
global/src/commonMain/kotlin/app/meetacy/di/global/annotation/GlobalApi.kt
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,11 @@ | ||
package app.meetacy.di.global.annotation | ||
|
||
@RequiresOptIn( | ||
message = "Be careful when using such API. " + | ||
"First of all it's immutable (and it will be), so you initialize it's value only once. " + | ||
"That already means, that you can't use global DI if you plan testing things. " + | ||
"It was made primarily for Android where global singleton is the only way to transfer dependencies " + | ||
"between modules", | ||
level = RequiresOptIn.Level.WARNING | ||
) | ||
public annotation class GlobalApi |
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