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

User Manual    [Previous]   [Next]   

W1512 Code Labels Inside Method Are Not Unique

Warning reporting that code labels inside methods should have unique names.

Code Labels allow aspects to inject code in specific locations inside method bodies. However, the code injection is only applied to the first encountered label. Therefore, a code label should not be reused multiple times (inside a method).

If you encounter this warning, you can easily rename code labels with unique names for each label inside the method body.

Example

class CodeLabelExample
{  
  void methodToDoSomething()
  {
    //code 
    Label1: ;
    int x=0;
    //code 
    Label1: ; 
    x++;
  }
  
  // aspect injection in a code label.
  after  Label1:methodToDoSomething
  {
   int y =0; 
  }
}
// @@@skipcompile - injects code in impossible place



      

Load the above code into UmpleOnline