]> git.uio.no Git - ifi-stolz-refaktor.git/blobdiff - software/no.uio.ifi.refaktor.examples/examples/src/legal/Main.java
IllegalStatementsChecker: now handling continue in while, do, for and with label
[ifi-stolz-refaktor.git] / software / no.uio.ifi.refaktor.examples / examples / src / legal / Main.java
index f9bfab989e3122b1657906d84068707d46bfb8a3..65f3c232740b7f4346d50c3472dae938f2ed0a02 100644 (file)
@@ -2,6 +2,7 @@ package legal;
 
 public abstract class Main extends SuperMain {
        int i;
+       int j;
 
        public Main() {
                super();
@@ -67,4 +68,44 @@ public abstract class Main extends SuperMain {
                                }
                        }
        }
+
+       private void iHaveAContinueStatementWithoutALabelInWhile() {
+               // Do not touch me
+               while (i < 3) {
+                       if (i++ == 1)
+                               continue;
+                       System.out.println("test");
+               }
+       }
+
+       private void iHaveAContinueStatementWithoutALabelInDo() {
+               // Do not touch me
+               do {
+                       if (i++ == 1)
+                               continue;
+                       System.out.println("test");
+               } while (i < 3);
+       }
+
+       private void iHaveAContinueStatementWithoutALabelInFor() {
+               // Do not touch me
+               for (int i = 0; i < 3; i++) {
+                       if (i == 1)
+                               continue;
+                       System.out.println("test");
+               }
+       }
+
+       private void iHaveAContinueStatementWithALabelInNestedWhile() {
+               // Do not touch me
+               lbl:
+                       while (j++ < 5) {
+                               while (i < 3) {
+                                       if (i++ == 1)
+                                               continue lbl;
+                                       System.out.println("test");
+                               }
+                               i = 0;
+                       }
+       }
 }
\ No newline at end of file