list of dots

User Manual    [Previous]   [Next]   

Tracing Methods

Tracing non api methods is possible using MOTL. Entry and/or exit of methods can be traced.

  • Method Entry: trace code is injected at the method entry.
  • Method Exit: trace code is injected at method exit before return statements if exits.

Example

// this example shows how to trace
// non-generated method entry

class JavaMethod
{
  trace method();
    
  int method( int x ) {
    x += 5;
    return x;
  }
}

      

Load the above code into UmpleOnline

 

Another Example

// this example shows how to trace generated
// method exit. In case of methods with a return
// statement, trace code is injected before
// the return

class JavaMethod
{
  trace exit method();
    
  int method( int x ) {
    x += 5;
    return x;
  }
}

      

Load the above code into UmpleOnline

 

Syntax


traceDirective : trace [[Prefix]]? [[traceEntity]] [[Postfix]] ;