Bug 78154 - It should be possible to get rid of the warning in clone() w/generics
Summary: It should be possible to get rid of the warning in clone() w/generics
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.1 M4   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-09 05:50 EST by Oyvind Harboe CLA
Modified: 2004-11-09 07:07 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.