Hello, as per the title I am struggling to find the cause of an "unchecked or unsafe operations" warning in some code.
If I have the following code, it compiles without any warnings:
public void test()
{
Set<String> mySet = new HashSet<String>();
Set<String> myNewSet = mySet;
//do stuff
}
Now, if I change where mySet comes from, specifically as the result of a method call, I get the "unchecked yadda yadda" warning:
public void test()
{
Set<String> myNewSet = this.getSet();
//do stuff
}
public Set getSet()
{
Set<String> set = new HashSet<String>();
return set;
}
I have tried and tried to work out what the problem is and I am completely stumped. The issue is present whether I use Sets or Lists. Why would the Set returned by the getSet method be any different to the Set in the first example?
Any help would be greatly appreciated as while the warning isn't the end of the world, it is bugging the hell out of me! :(
Regards