title: Kotlin reflection on inbuilt classes
body: <p>I am trying to read the "value" field of a String in Kotlin. I am not very familiar with reflection in Kotlin, so I can't get it to work. This is what I have:</p>
  
  <pre><code>var str: String = "Some string"
  
  val field = String::class.java.getDeclaredField("value")
  field.isAccessible = true
  
  println(field) // This prints "private final char[] java.lang.String.value"
  
  println(field.get(str)) // This prints [C@66d3c617
  </code></pre>
  
  <p>When trying to cast char[] to Array, I get this exception:</p>
  
  <pre><code>java.lang.ClassCastException: [C cannot be cast to [Ljava.lang.Character;
  </code></pre>
  
  <p>What am I doing wrong?</p>