Bug 78154

Summary: It should be possible to get rid of the warning in clone() w/generics
Product: [Eclipse Project] JDT Reporter: Oyvind Harboe <oyvind.harboe>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Oyvind Harboe CLA 2004-11-09 05:50:35 EST
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();
	}
}
Comment 1 Philipe Mulet CLA 2004-11-09 07:07:06 EST
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();
	}
}
Comment 2 Philipe Mulet CLA 2004-11-09 07:07:42 EST
Not a bug, also javac -Xlint issues a similar warning.