Inject: Kotlin support for sets and map
See original GitHub issueHi,
Currently we have to explicity specify java.util.Set
and java.util.Map
for kotlin bindings when using @ProvidesIntoSet
or bindIntoSet
It would be great if we could support Kotlin Sets and Maps or at least this limitation is documented:
Works:
class Test @Inject constructor(val set: java.util.Set<Hej>)
Breaks:
class Test @Inject constructor(val set: Set<Hej>)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Map-specific operations - Kotlin
To perform operations on all keys or all values of a map, you can retrieve them from the properties keys and values accordingly....
Read more >Working With Maps in Kotlin - Baeldung
Maps are a powerful tool for programmers because they support fast read and write access, even with large sets of data.
Read more >Implicitly map to set in Kotlin - Stack Overflow
Looking at the library code, the only other way to do this would be to call mapTo which takes a destination collection: oldSet....
Read more >Add a map to your Android app (Kotlin) - Google Developers
1. Before You Begin · 2. Get set up · 3. Quick start · 4. Add Google Maps · 5. Cloud-based map styling...
Read more >Use collections in Kotlin - Android Developers
What you'll learn · How to create and modify arrays. · How to use List and MutableList . · How to use Set...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@richarddd Thank you for providing a test!
The problem was with Kotlin’s declaration-site variance Set in Kotlin is declared as
Set<out E>
, which leads toSet<Container>
dependency result inSet<? extends Container>
We have fixed a type resolution in the
master
branch. You can try it out by installing the latest version of ActiveJ from themaster
branch locally (using ./install.sh script from project root) and then changing the ActiveJ dependency version in pom.xml to5.0-SNAPSHOT
.This will be part of a final ActiveJ v5.0 release
@richarddd Feel free to reopen this if the issue still persists.