# AbstractMethodError on property access

**URL:** https://discuss.kotlinlang.org/t/abstractmethoderror-on-property-access/6478
**Category:** Support
**Created:** [February 1, 2018, 3:28pm UTC](https://discuss.kotlinlang.org/t/abstractmethoderror-on-property-access/6478 "2018-02-01T15:28:29Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Inconceivable](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/inconceivable/32/4724_2.png) [@Inconceivable](https://discuss.kotlinlang.org/u/Inconceivable)
#### Post date: [February 1, 2018, 3:28pm UTC](https://discuss.kotlinlang.org/t/abstractmethoderror-on-property-access/6478/1 "2018-02-01T15:28:30Z")

</div>

Hi guys,

I’m getting a `java.lang.AbstractMethodError` when retrieving the value of a property from a Kotlin class. I have a class hierarchy like this:

```auto
class ClassA(...) : ClassB(...), InterfaceA {
...
}

abstract ClassB(...) : ClassD(...) {
...
}

abstract ClassD(...) {
   val ordinal = Counters.get().counter(this.javaClass)
}

interface InterfaceA {
   val ordinal: Int
}

```

So, `InterfaceA` declares the property “ordinal”, and my `ClassA` should have an implementation and value of this property inherited from `ClassD`. But when retrieving the value of “ordinal”, I get the `AbstractMethodError`.  
I don’t understand why the implementation and value inherited from `ClassD` are not effective. And even if it isn’t and I’m missing something, this is probably something that should be caught by the compiler.

At the moment I am using a workaround by declaring the property in `ClassD` “open” and overriding it in `ClassA` using the same assignment as in `ClassD`.  
Maybe somebody can enlighten me on what is going on?

Thanks and regards

---

<div class="post-metadata">

### Author: ![Inconceivable](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/inconceivable/32/4724_2.png) [@Inconceivable](https://discuss.kotlinlang.org/u/Inconceivable)
#### Post date: [February 7, 2018, 9:43am UTC](https://discuss.kotlinlang.org/t/abstractmethoderror-on-property-access/6478/2 "2018-02-07T09:43:58Z")

</div>

Hi guys,

I created a small demo of the issue, using the same class architecture, but unsurprisingly it works just fine in my simplified, minimal demo application. I would have been surprised if a fundamental thing like this was buggy in Kotlin.  
This means there is something about my application that is leading to this error. But I wonder what it could be. I’m not using any fancy reflection or bytecode generating features, or hacky libraries like Lombok that could be causing this. It’s just plain Java and Kotlin code.

I will try to investigate further and post if I find the underlying issue.

---

<div class="post-metadata">

### Author: ![Wasabi375](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/wasabi375/32/4741_2.png) [@Wasabi375](https://discuss.kotlinlang.org/u/Wasabi375)
#### Post date: [February 8, 2018, 7:17pm UTC](https://discuss.kotlinlang.org/t/abstractmethoderror-on-property-access/6478/3 "2018-02-08T19:17:19Z")

</div>

Could it be that some of the classes/interfaces are java and some are kotlin? I seem to remember having a similar problem a few weeks back, but can’t remember how I solved it. I think I ended up migrating some more classes to kotlin.

---

<div class="post-metadata">

### Author: ![Inconceivable](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/inconceivable/32/4724_2.png) [@Inconceivable](https://discuss.kotlinlang.org/u/Inconceivable)
#### Post date: [May 25, 2018, 9:07pm UTC](https://discuss.kotlinlang.org/t/abstractmethoderror-on-property-access/6478/4 "2018-05-25T21:07:56Z")

</div>

Yes, that is correct. My project is mostly Java (the interface and base class providing the implementation), and I have started to implement new classes in Kotlin as a way to experiment with -and learn- the language.

Sorry for radio-silence, I was busy with diapers and shit.  
Still haven’t solved the issue. At the moment I’m using the workaround described in the first post.

---

<div class="post-metadata">

### Author: ![codymikol](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@codymikol](https://discuss.kotlinlang.org/u/codymikol)
#### Post date: [November 4, 2020, 3:41pm UTC](https://discuss.kotlinlang.org/t/abstractmethoderror-on-property-access/6478/5 "2020-11-04T15:41:45Z")

</div>

Hey, I know it’s been a while, any chance you encountered this through tests using Mockk?

---

<div class="post-metadata">

### Author: ![Inconceivable](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/inconceivable/32/4724_2.png) [@Inconceivable](https://discuss.kotlinlang.org/u/Inconceivable)
#### Post date: [November 6, 2020, 11:00am UTC](https://discuss.kotlinlang.org/t/abstractmethoderror-on-property-access/6478/6 "2020-11-06T11:00:51Z")

</div>

No, no mocking going on. Just plain Java and Kotlin code.
