I would prefer to have an empty line prior to the last return statement of any Java method. How do I find and replace such lines using Eclipse?
public int foo() {
...
...
System.out.println("end of foo");
return 1;
}
In this case , I would prefer an empty line before the return statement, do note that there could be any statement before return. How do I find and replace in such occurences.
You could use a regular expression to search for the pattern
"; *\n[ \t]*return"and replace the\nwith 2\ncharactersCheck out this overview of regular expressions in java (only if you need it. You could be a regexp pro for all I know 😉 )
http://www.regular-expressions.info/java.html