title: Compare values of common properties of objects in kotlin
body: <p>I'm trying to write a method that will compare the 'common properties' (sharing the same name/type) of two objects in Kotlin. Its intended to be used in tests, for comparing 'expected' with 'actual' objects that aren't of the same type.</p>
  
  <p>This is a simplified version on the code so far:</p>
  
  <pre><code>val obj1Props = obj1::class.memberProperties
  val obj2Props = obj2::class.memberProperties
  
  val commonPropertyPairs  = obj1Props.map { obj1Prop -&gt;
          obj1Prop to obj2Props.find { obj2Prop -&gt; obj1Prop.name == obj2Prop.name } }
      .filter { pair -&gt; pair.second != null }
  
  commonPropertyPairs.forEach { pair -&gt;
    pair.first.get(obj1)
  }
  </code></pre>
  
  <p>I'm currently getting this error message under 'pair.first.get' near the bottom:</p>
  
  <blockquote>
    <p>out-projected type <code>KProperty1&lt;out Any, Any?&gt;</code> prohibits the use of <code>public abstract fun get(receiver: T): R defined in kotlin.reflect.KProperty1</code></p>
  </blockquote>
  
  <p>I understand that I obviously cannot use abstract methods, what should I be doing instead?</p>