Skip to content

Instantly share code, notes, and snippets.


Brandon Davis BetweenTwoBits

View GitHub Profile
BetweenTwoBits / enumReflection.kt
Created Nov 5, 2019
Get Enum values using reflection hacks
View enumReflection.kt
// This code is for obtaining values from Enums that exist in an SDK and are obfuscated for some reason.
for (errorCode in ErrorCode.values()) {"ErrorCodes: ${} ${errorCode.getCode()}")
private fun Component.getCode():String {
return javaClass.getDeclaredField("value").let {
it.isAccessible = true