Scala type system : basic type mismatch

Posted by SiM on Stack Overflow See other posts from Stack Overflow or by SiM
Published on 2010-04-08T23:02:00Z Indexed on 2010/04/08 23:03 UTC
Read the original article Hit count: 347

Filed under:
|

I have a basic type system type mismatch problem: I have a class with a method

def Create(nodeItem : NodeItem) = {p_nodeStart.addEndNode(nodeItem)}

where p_nodeStart is NodeCache

class NodeCache[END_T<:BaseNode] private(node: Node) extends BaseNode {
def addEndNode(endNode : END_T) = {this.CACHE_HAS_ENDNODES.Create(endNode)}

and the error its giving me is:

error: type mismatch;
found   : nodes.NodeItem
required: Nothing
    def Create(nodeItem : NodeItem) = {p_nodeStart.addEndNode(nodeItem)}

while the NodeCache is defined as

object NodeTrigger {
def Create() {
val nodeTimeCache         = NodeCache.Create[NodeItem](node)

and in object NodeCache

object NodeCache {
def Create[END_T<:BaseNode]() {
val nodeCache = new NodeCache[END_T](node);

Any ideas, how to fix the error?

© Stack Overflow or respective owner

Related posts about scala

Related posts about type-parameter