list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

W9222 JavaScript No JavaScript Code

A method has a body only for other languages

A method written in the model has a body only for languages other than JavaScript, for example a Java body, and no untagged body. The JavaScript generator has no code to use for it, so it leaves the method out of the generated class and this warning names it. The class itself is still generated, and the warning does not make the compilation fail.

Add a JavaScript body, written as String describe() JavaScript { ... }, if the generated classes need that behaviour. A body with no language tag is used by every generator, JavaScript included, so it must be valid JavaScript when JavaScript is generated.

Example

// describe has a Java body only, so the generated JavaScript
// leaves it out and W9222 names it
generate JavaScript;
class Book {
  title;
  String describe() Java { return "Book " + getTitle(); }
}

      

Load the above code into classic UmpleOnline
Load the above code into UmpleOnline V2

 

Solution to The Above So the Message No Longer Appears

// With a JavaScript body as well, each generator uses its own
generate JavaScript;
class Book {
  title;
  String describe() Java { return "Book " + getTitle(); }
  String describe() JavaScript { return "Book " + this.getTitle(); }
}

      

Load the above code into classic UmpleOnline
Load the above code into UmpleOnline V2