Discover · handstandsam.com

Using Java Reflection with Kotlin Companion Objects

Handstand Sam handstandsam.com

Kotlin companion objects allow you to add static data and methods associated with a class. This is similar to how Java has static fields and methods. The problem is that Java doesn’t really know what a companion object it, so trying to access one using standard Java reflection might make you go crazy.

The decompiled Java class (created by the Kotlin Compiler) results in this:

More ways to use this
Open on another device
Scan this QR code to open the same public page

Scan to open this page. Your saved notes and account access are not included.

Download QR code

Open the page link

In the piece

Named in it

Keep going

Each of these is read from what this estate already kept: the feed a piece came through, the publisher behind it, the credits and topics the publisher printed. None of it is a recommendation, an identity or a record kept anywhere else.

Also from Handstand Sam

  1. How I’m Using Agents for Development – January 2026Sam Edwards handstandsam.com
  2. Running Specific Android UI Tests using TestParameterInjector via a RegexSam Edwards handstandsam.com
  3. LLM Based Android UI Testing – “Journeys with Gemini”Sam Edwards handstandsam.com
  4. Demystifying Maestro’s UI Testing ImplementationSam Edwards handstandsam.com
  5. Parameterized Android Tests with Burst 2.0Sam Edwards handstandsam.com
  6. Kotlin K2 FIR Quickstart GuideSam Edwards handstandsam.com