google-code-export / umple

Automatically exported from code.google.com/p/umple
1 stars 0 forks source link

Code Injection for not Generated API methods doesn't work. #619

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Add a code injection to a method (not generated method) like in the 
following example:

class Test {

  before methodNotInApi {
    if (aName != null && aName.length() > 20) { return false; }
  }

  methodNotInApi(){
     return null;
  }
}

What is the expected output? What do you see instead?

In java, this should be the output:
public  methodNotInApi(){
   if (aName != null && aName.length() > 20) { return false; }
  return null;
}

The code injection, however, works if you put the star after the method name:

 before methodNotInApi* {
    if (aName != null && aName.length() > 20) { return false; }
  }

Original issue reported on code.google.com by asopa...@gmail.com on 19 Aug 2014 at 5:35

GoogleCodeExporter commented 9 years ago
In addition, after code injection doesn't work in mentioned above case:

after methodNotInApi* {
    if (aName != null && aName.length() > 20) { return false; }
  }

Original comment by hjam...@gmail.com on 19 Aug 2014 at 10:19

GoogleCodeExporter commented 9 years ago
It works fine if you say before methodNotInApi()

with the parentheses. Not sure if there are any side-effects of removing the 
requirement for parentheses here but seems reasonable and a very quick fix.

Original comment by TimothyCLethbridge on 21 Sep 2014 at 2:01