Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala type system : basic type mismatch

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?

like image 828
SiM Avatar asked May 22 '26 15:05

SiM


1 Answers

where p_nodeStart is NodeCache

NodeCache-what? NodeCache is parameterized, and it looks like p_nodeStart is NodeCache[Nothing]. How was it defined?

like image 111
Daniel C. Sobral Avatar answered May 24 '26 09:05

Daniel C. Sobral