test/tools/javac/T4906100.java

changeset 1
9a66ca7c79fa
child 611
4172cfff05f0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/T4906100.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,25 @@
     1.4 +/*
     1.5 + * @test  /nodynamiccopyright/
     1.6 + * @bug 4906100
     1.7 + * @summary detect empty statement after if
     1.8 + * @compile/ref=T4906100.out -XDstdout -XDrawDiagnostics -Xlint:empty T4906100.java
     1.9 + */
    1.10 +
    1.11 +class T4906100 {
    1.12 +    void f1(int a, int b) {
    1.13 +        if (a == b);
    1.14 +            System.out.println("a == b");
    1.15 +    }
    1.16 +
    1.17 +    @SuppressWarnings("empty")
    1.18 +    void f2(int a, int b) {
    1.19 +        if (a == b);
    1.20 +            System.out.println("a == b");
    1.21 +    }
    1.22 +
    1.23 +    // check that { } is not treated as an empty statement
    1.24 +    void f3(int a, int b) {
    1.25 +        if (a == b) { }
    1.26 +            System.out.println("a == b");
    1.27 +    }
    1.28 +}

mercurial