A companion object for a trait in Scala has no visibility problems in Scala:
trait ProtocolPacket extends Serializable {
def toByteArray: Array[Byte]
}
object ProtocolPacket {
def getStreamType( streamBytes: Array[Byte] ) = {
// ...
}
}
However on Java side (e.g. gets the above in a jar), a ProtocolPacket.getStreamType
is not visible. In fact a (decompiled by IDEA) source does not have a getStreamType
method defined for a ProtocolPacket
EDIT:
I found similar hits on SO regarding Companion$MODULE$
, but was tricked by IDEA :) as shown below:
The above compiles and runs fine (shell and/or IDEA itself), in case anybody else gets trapped.