Community
Participate
Working Groups
How can I get rid of the warning in the code below? import java.util.ArrayList; public class Foo { public void bar() { ArrayList<Byte> x=new ArrayList<Byte>(); ArrayList<Byte> y=(ArrayList<Byte>)x.clone(); } }
Remove parameterization from cast type, since the compiler tells you it is irrelevant at runtime. import java.util.ArrayList; public class X { public void bar() { ArrayList<Byte> x=new ArrayList<Byte>(); ArrayList<Byte> y=(ArrayList)x.clone(); } }
Not a bug, also javac -Xlint issues a similar warning.