jme
04/20/2020, 12:23 AMR.java
using Kotlin's experimental Inline Classes, giving us better compile-time type safety over resource referencing. For example: R.color.red
is of type Int
, whereas K.color.red
is of type ColorRes
.
Is this something that people would be interested in? There's more work to be done to make it production-ready, and it feels like this should be somewhere more central (like AGP), but you can find more examples and the code in this Github repoemmano
04/20/2020, 1:02 AMjw
04/20/2020, 1:02 AMandroid.jar
and all libraries where they accept a resource int to have an overload which accepts the new inline classes. This also means synthesizing the Kotlin metadata annotation, to be clear.jme
04/20/2020, 1:14 AMandroid.jar
- essentially a collection of extension functions which act as overloads, using the inline types. This would make using them a bit more tedious, as it would be another module to include, and of course be backwards incompatible, but would be much cleaner and lower effort. The API signature .txt
files include everything needed to generate these extensionjw
04/20/2020, 12:21 PMjme
04/20/2020, 9:05 PMjw
04/21/2020, 12:49 AMjme
04/21/2020, 1:13 AM