package Ġio . github . my ung py o . simple k sp sample . processor Ċ Ċ import Ġcom . google . devtools . k sp . processing . K SP Logger Ċ import Ġcom . google . devtools . k sp . symbol .* Ċ import Ġio . github . my ung py o . simple k sp sample . processor . Sticky State Processor . Companion . STATE _ HOLDER Ċ import Ġio . github . my ung py o . simple k sp sample . processor . Sticky State Processor . Companion . STATE _ STORE Ċ Ċ class ĠSt icky State Visitor ( ĊĠĠĠ Ġprivate Ġval Ġsave Code List : ĠMutable List < String >, ĊĠĠĠ Ġprivate Ġval Ġrestore Code List : ĠMutable List < String >, ĊĠĠĠ Ġprivate Ġval Ġlogger : ĠK SP Logger , Ċ ): ĠK S Visitor Void () Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġvisit Class Declaration ( class Declaration : ĠK S Class Declaration , Ġdata : ĠUnit ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . visit Class Declaration ( class Declaration , Ġdata ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġvisit Function Declaration ( function : ĠK S Function Declaration , Ġdata : ĠUnit ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . visit Function Declaration ( function , Ġdata ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġvisit Property Declaration ( property : ĠK S Property Declaration , Ġdata : ĠUnit ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠpropertyName Ġ= Ġproperty . simple Name . asString () ĊĠĠĠĠĠĠĠ Ġval Ġresolved Type Ġ= Ġproperty . type . resolve () ĊĠĠĠĠĠĠĠ Ġval Ġproperty Type Ġ= Ġresolved Type . declaration . simple Name . asString () ĊĠĠĠĠĠĠĠ Ġlogger . warn (" 1 Ġ: Ġ${ property . java Class . kotlin . qualified Name }") ĊĠĠĠĠĠĠĠ Ġlogger . warn (" 2 Ġ: Ġ${ resolved Type . declaration . java Class . kotlin . qualified Name }") ĊĊĠĠĠĠĠĠĠ Ġ// ĠGenerate Ġput Ġcode ĊĠĠĠĠĠĠĠ Ġvar Ġsave Code Ġ= Ġ"$ STATE _ STORE . put $ property Type (\" ${ make Property Store Key ( propertyName )}\ ", Ġ$ STATE _ HOLDER .$ propertyName )" ĊĠĠĠĠĠĠĠ Ġif Ġ( resolved Type . null ability Ġ== ĠNull ability . NULL ABLE ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsave Code Ġ= Ġ"$ propertyName ?. let { Ġ$ save Code Ġ}" ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġsave Code List . add ( save Code ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠGenerate Ġrestore Ġcode ĊĠĠĠĠĠĠĠ Ġvar Ġrestore Code Ġ= Ġ"$ STATE _ HOLDER .$ propertyName Ġ= Ġ$ STATE _ STORE . get $ property Type (\" ${ make Property Store Key ( propertyName )}\ ")" ĊĠĠĠĠĠĠĠ Ġif Ġ( resolved Type . null ability Ġ!= ĠNull ability . NULL ABLE Ġ&& Ġproperty Type Ġ== Ġ" String ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠ Ġrestore Code Ġ= Ġ"$ restore Code Ġ?: Ġ$ STATE _ HOLDER .$ propertyName " ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġrestore Code List . add ( restore Code ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġmake Property Store Key ( propertyName : ĠString ): ĠString Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġ" Sticky State _$ propertyName " ĊĠĠĠ Ġ} Ċ }