# Synthetic Accessors in Kotlin

DevFeed: [Synthetic Accessors in Kotlin](<https://devfeed.tech/articles/synthetic-accessors-in-kotlin-25648.md>)

Original publisher: [Read original article](<https://adambennett.dev/2017/07/synthetic-accessors-in-kotlin/>)

Published: 2017-07-10T18:46:03Z

Content type: article

Language: en

Sources: [Posts on Adam Bennett](<https://devfeed.tech/sources/posts-on-adam-bennett.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Android](<https://devfeed.tech/topics/android.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [android](<https://devfeed.tech/tags/android.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [blog](<https://devfeed.tech/tags/blog.md>), [career](<https://devfeed.tech/tags/career.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [compose](<https://devfeed.tech/tags/compose.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [finance](<https://devfeed.tech/tags/finance.md>), [functional](<https://devfeed.tech/tags/functional.md>), [growth](<https://devfeed.tech/tags/growth.md>), [java](<https://devfeed.tech/tags/java.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [money](<https://devfeed.tech/tags/money.md>), [opinions](<https://devfeed.tech/tags/opinions.md>), [software](<https://devfeed.tech/tags/software.md>), [startups](<https://devfeed.tech/tags/startups.md>), [thoughts](<https://devfeed.tech/tags/thoughts.md>), [training](<https://devfeed.tech/tags/training.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

## AI overview

The article examines synthetic accessor methods generated when Kotlin code accesses private properties or methods from nested or anonymous inner classes. It explains that Kotlin's generated Java bytecode can create these methods, adding methods to Android applications, and shows how changing members to public can avoid some accessors while Kotlin still generates property getters and setters.

## Source excerpt

So this is a pretty nerdy blog and should be a quick one, but I just wanted to share my findings. As you may know, accessing private methods or fields in Java from nested or anonymous inner classes results in the creation of synthetic accessor methods. Jake Wharton's talk on Java's hidden costs is worth a watch here if you have no idea what I'm talking about.