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 \n with 2 \n characters
Check 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
You can go to Window -> Preferences and expand the trees Java -> Code Style -> Formatter and change/enforce many rules, but I don't think you can check/enforce a new line before 'return' as a built in option in Eclipse.
Instead you'll have to follow Josiah's advice and write your own nifty check-style tool (which are really fun to have).
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论