according to the headline, I am struggling to find the reason for the warning of “unverified or unsafe operations” 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;
}
Now, if I change where mySet comes from , in particular, as a result of a method call, I get the warning "unchecked yadda yadda":
public void test()
{
Set<String> myNewSet = this.getSet();
}
public Set getSet()
{
Set<String> set = new HashSet<String>();
return set;
}
I tried and tried to figure out what the problem is, and I'm completely at a dead end. The problem is whether I use Sets or Lists. Why will the set returned by getSet be different from Set in the first example?
, - , !: (