Skip to content

Instantly share code, notes, and snippets.

Avatar

Brandon Davis BetweenTwoBits

View GitHub Profile
@BetweenTwoBits
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()) {
Log.info("ErrorCodes: ${errorCode.name} ${errorCode.getCode()}")
}
private fun Component.getCode():String {
return javaClass.getDeclaredField("value").let {
it.isAccessible = true
You can’t perform that action at this time.