'How to Pass vararg to a varag function or constructor in Kotlin?

Kotlin does not allow my subclass to pass vararg to my super class constuctor Here is my Operation class:

package br.com.xp.operation

import java.util.ArrayList

abstract class Operation(vararg values: Value) : Value {
    protected var values: MutableList<Value> = ArrayList()

    internal abstract val operator: String
}

and here is my SubtractionOperation class:

package br.com.xp.operation

class SubtractionOperation private constructor(vararg values: Value) : Operation(values) {
    override val operator: String
        get() = "-"
}

The compile says:

Type mismatch Required Value found Array

Can anyone explain why this is not possible?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source