list of dots

User Manual    [Previous]   [Next]   

E3505 Template Reference Cycle

Umple semantic error raised when a template reference causes a cycle

A template reference cannot be used in a cyclically referring way, creating an indirect reference to itself. The issue might come from a flaw in the templates' design.

Example

//The error arises as temp refers
//to temp3, referring to temp2, which
//causes a cycle due to temp2 referring
//to temp
class A {
  temp <<! <<@temp3>> !>>
  temp2 <<! <<@temp>> !>>
  temp3 <<! <<@temp2>> !>>
    
  emit method()(temp);
}
      

Load the above code into UmpleOnline

 

Solution to The Above So the Message No Longer Appears

//There is no longer a cycle,
//the error is resolved
class A {
  temp <<! <<@temp3>> !>>
  temp2 <<! <<@temp>> !>>
  temp3 <<! output !>>
    
  emit method()(temp);
}
      

Load the above code into UmpleOnline