tylerwilson
10/14/2016, 8:20 PMclass Sounds {
private static class Style {
static final String Version1 = "path/to/resource";
}
}`
Kotlin converted it to:
object Sounds {
private class Style {
companion object {
internal val Version1 = "path/to/resource"
}
}
}
The tricky thing on the Java side was to look up the values dynamically, using the field names like so:
result = (String)Style.class.getDeclaredField(key).get(null);
which was converted to Kotlin:
Style::class.java.getDeclaredField(key).get(null) as String
but the Kotlin version always returns null. Is there some special magic sauce to make getDeclaredField working? Does that make sense?