Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all unnecessary semicolons (at end of blocks)?

Tags:

java

eclipse

Some of our code written a while have unnecessary semi-colon. I wonder whats the easiest way to remove them. For example, the last semi-colon in the following

 if(i == 2)
   {
       System.out.println("if statement");
   }
   else
   {
       System.out.println("else statement");
   };
like image 842
sunxin8086 Avatar asked Dec 17 '22 06:12

sunxin8086


1 Answers

You can find them easily enough by going into the Java Compiler / Error and Warnings preferences, then under "Potential Programming Problems" change "Empty Statements" to warning or error. Then it'll just be a matter of going through them. There may be a way of automating it, but I wouldn't bother unless there are loads :)

like image 180
Jon Skeet Avatar answered Jan 12 '23 00:01

Jon Skeet