Mon, 08 Apr 2013 15:53:08 +0100
8010404: Lambda debugging: redundant LineNumberTable entry for lambda capture
Summary: Ignore indy entries in LineNumberTable
Reviewed-by: jjg
duke@1 | 1 | /* |
duke@1 | 2 | * @test /nodynamiccopyright/ |
duke@1 | 3 | * @bug 6227617 |
duke@1 | 4 | * @summary Lint option for redundant casts |
duke@1 | 5 | * @compile -Werror T6227617.java |
jjg@611 | 6 | * @compile/ref=T6227617.out -XDrawDiagnostics -Xlint:cast T6227617.java |
duke@1 | 7 | */ |
duke@1 | 8 | import java.util.HashMap; |
duke@1 | 9 | import java.util.Map; |
duke@1 | 10 | |
duke@1 | 11 | class T6227617 { |
duke@1 | 12 | void m() { |
duke@1 | 13 | int i1 = 2; |
duke@1 | 14 | int i2 = (int) i1; // warn |
duke@1 | 15 | |
duke@1 | 16 | float f1 = 1f; |
duke@1 | 17 | int i3 = (int) f1; |
duke@1 | 18 | |
duke@1 | 19 | String s = (String) ""; // warn |
duke@1 | 20 | Object o = (Object) ""; |
duke@1 | 21 | |
duke@1 | 22 | Map<String, Integer> m = new HashMap<String, Integer>(); |
duke@1 | 23 | Integer I1 = (Integer) m.get(""); // warn |
duke@1 | 24 | } |
duke@1 | 25 | |
duke@1 | 26 | // The following cause NPE in Attr with an Attr-based solution for -Xlint:cast |
duke@1 | 27 | static final int i1 = Foo.i1; |
duke@1 | 28 | static final String s = Foo.s; |
duke@1 | 29 | } |
duke@1 | 30 | |
duke@1 | 31 | class Foo |
duke@1 | 32 | { |
duke@1 | 33 | static final int i1 = (int) 1; |
duke@1 | 34 | static final int i2 = (int) 1L; |
duke@1 | 35 | |
duke@1 | 36 | static final String s = (String) "abc"; |
duke@1 | 37 | } |