I have the following class definition in Scala:
class AppendErrorMessageCommand private(var m_type: Byte) {
def this() = this(0x00)
def this(errorType: ErrorType) = this(getErrorTypeValue(errorType))
private def getErrorTypeValue(errorType: ErrorType) = {
if(errorType == USER_OFFLINE)
0x01
else if(errorType == PM_TO_SELF)
0x02
0x00
}
}
ErrorType is the following enum:
object ErrorType extends Enumeration {
type ErrorType = Value
val USER_OFFLINE, PM_TO_SELF = Value
}
I think something is wrong with the constructor definitions in the class. My IDE (which is the Scala IDE for Eclipse) tells me it cannot find getErrorTypeValue. It also tells me that the overloaded constructor is has alternatives. One being the byte and the other the enum.
Don't take these error messages of the IDE seriously though. They might be wrong, as this often happens with the IDE. But nonetheless, when the IDE tells me something is wrong, it usually is wrong.
So, what is the problem with my class/constructor definitions?