Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
Fixes serviceLoaderDebug variant
Browse files Browse the repository at this point in the history
Fix: #1
  • Loading branch information
wojtek-kalicinski committed May 13, 2019
1 parent a214ad7 commit 36a30e8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ class MainViewModel(app: Application) : AbstractMainViewModel(app) {

// Ask ServiceLoader for concrete implementations of StorageFeature.Provider
// Explicitly use the 2-argument version of load to enable R8 optimization.
val serviceLoader = ServiceLoader.load(StorageFeature.Provider::class.java, null)
val serviceLoader = ServiceLoader.load(
StorageFeature.Provider::class.java,
StorageFeature.Provider::class.java.classLoader
)

// Explicitly ONLY use the .iterator() method on the returned ServiceLoader to enable R8 optimization.
// When these two conditions are met, R8 replaces ServiceLoader calls with direct object instantiation.
Expand Down

0 comments on commit 36a30e8

Please sign in to comment.