NoSuchMethodError: java.lang.Long.hashCode

前端 未结 4 2128
暗喜
暗喜 2020-12-15 18:28

I have the following override of method on hashCode in AbstractORM class:

var _id = Random().nextLong()

override fun getId() = _id         


        
4条回答
  •  不知归路
    2020-12-15 18:54

    I'm not sure about how to solve your problem, but I'll try to explain why are you getting this exception.

    In Java 8 a new static method was added to a Long class:

    public static int hashCode(long value)
    

    And since then hashCode() method looks like this:

    public int hashCode() {
        return hashCode(this.value); // call Long.hashCode() static method
    }
    

    So it seems that you have some issues with Java version.

提交回复
热议问题