Fri, 24 May 2013 15:27:12 +0100
8014649: Regression: bug in Resolve.resolveOperator
Summary: Missing curly braces causes Resolve.findMethod to be called spuriously
Reviewed-by: jjg, vromero
duke@1 | 1 | /* |
duke@1 | 2 | * @test /nodynamiccopyright/ |
duke@1 | 3 | * @bug 4906100 |
duke@1 | 4 | * @summary detect empty statement after if |
jjg@611 | 5 | * @compile/ref=T4906100.out -XDrawDiagnostics -Xlint:empty T4906100.java |
duke@1 | 6 | */ |
duke@1 | 7 | |
duke@1 | 8 | class T4906100 { |
duke@1 | 9 | void f1(int a, int b) { |
duke@1 | 10 | if (a == b); |
duke@1 | 11 | System.out.println("a == b"); |
duke@1 | 12 | } |
duke@1 | 13 | |
duke@1 | 14 | @SuppressWarnings("empty") |
duke@1 | 15 | void f2(int a, int b) { |
duke@1 | 16 | if (a == b); |
duke@1 | 17 | System.out.println("a == b"); |
duke@1 | 18 | } |
duke@1 | 19 | |
duke@1 | 20 | // check that { } is not treated as an empty statement |
duke@1 | 21 | void f3(int a, int b) { |
duke@1 | 22 | if (a == b) { } |
duke@1 | 23 | System.out.println("a == b"); |
duke@1 | 24 | } |
duke@1 | 25 | } |