package Ġit . pure orig ins . common Ċ Ċ import Ġsun . misc . Unsafe Ċ import Ġjava . lang . reflect . Field Ċ Ċ fun Ġunsafe GetField ( field : ĠField , Ġinstance : ĠAny ): ĠAny ? Ġ{ ĊĠĠĠ Ġreturn Ġunsafe . getObject ( instance , Ġunsafe . object Field Offset ( field )) Ċ } Ċ Ċ fun Ġunsafe GetField (` class `: ĠClass <* >, Ġfield : ĠString , Ġinstance : ĠAny ): ĠAny ? Ġ{ ĊĠĠĠ Ġreturn Ġunsafe GetField (` class `. getDeclared Field ( field ), Ġinstance ) Ċ } Ċ Ċ fun Ġunsafe Get Static Field ( field : ĠField ): ĠAny ? Ġ{ ĊĠĠĠ Ġreturn Ġunsafe . getObject ( unsafe . static Field Base ( field ), Ġunsafe . static Field Offset ( field )) Ċ } Ċ Ċ fun Ġunsafe Get Static Field (` class `: ĠClass <* >, Ġfield : ĠString ): ĠAny ? Ġ{ ĊĠĠĠ Ġreturn Ġunsafe Get Static Field (` class `. getDeclared Field ( field )) Ċ } Ċ Ċ fun Ġunsafe Set Field ( field : ĠField , Ġinstance : ĠAny , Ġvalue : ĠAny ?) Ġ{ ĊĠĠĠ Ġunsafe . put Object ( instance , Ġunsafe . object Field Offset ( field ), Ġvalue ) Ċ } Ċ Ċ fun Ġunsafe Set Field (` class `: ĠClass <* >, Ġfield : ĠString , Ġinstance : ĠAny , Ġvalue : ĠAny ?) Ġ{ ĊĠĠĠ Ġunsafe Set Field (` class `. getDeclared Field ( field ), Ġinstance , Ġvalue ) Ċ } Ċ Ċ fun Ġunsafe Set Static Field ( field : ĠField , Ġvalue : ĠAny ?) Ġ{ ĊĠĠĠ Ġunsafe . put Object ( unsafe . static Field Base ( field ), Ġunsafe . static Field Offset ( field ), Ġvalue ) Ċ } Ċ Ċ fun Ġunsafe Set Static Field (` class `: ĠClass <* >, Ġfield : ĠString , Ġvalue : ĠAny ?) Ġ{ ĊĠĠĠ Ġreturn Ġunsafe Set Static Field (` class `. getDeclared Field ( field ), Ġvalue ) Ċ } Ċ Ċ private Ġval Ġunsafe Ġby Ġlazy Ġ{ ĊĠĠĠ Ġval Ġfield Ġ= ĠUnsafe :: class . java . getDeclared Field (" the Unsafe ") ĊĠĠĠ Ġfield . is Accessible Ġ= Ġtrue ĊĠĠĠ Ġfield [ null ] Ġas ĠUnsafe Ċ } Ċ