U
Ulrich Scholz
Dear all,
I have legacy code which uses an array with parameterized components.
Below you find an example. Although it works, eclipse gives me a
warning: "Type safety: The expression of type Vector[] needs unchecked
conversion to conform to Vector<Fact>[]".
I tried to dig in the topic, e.g., by reading generics in the Java
Programming Language by Gilda Bracha. But I have to admit: I didn't
get it fully. How to get rid of the warning without massive changes on
the legacy code?
Thank you,
Ulrich
public static Vector<Fact>[] convertState(Vector<JSHOP2_Term>[]
stateJSHOP2)
{
Vector<Fact>[] statePPlanner = new Vector[nbPredicates]; //
gives warining
for(int head=0; head < nbPredicates; head++)
{
// do something
}
return statePPlanner;
}
I have legacy code which uses an array with parameterized components.
Below you find an example. Although it works, eclipse gives me a
warning: "Type safety: The expression of type Vector[] needs unchecked
conversion to conform to Vector<Fact>[]".
I tried to dig in the topic, e.g., by reading generics in the Java
Programming Language by Gilda Bracha. But I have to admit: I didn't
get it fully. How to get rid of the warning without massive changes on
the legacy code?
Thank you,
Ulrich
public static Vector<Fact>[] convertState(Vector<JSHOP2_Term>[]
stateJSHOP2)
{
Vector<Fact>[] statePPlanner = new Vector[nbPredicates]; //
gives warining
for(int head=0; head < nbPredicates; head++)
{
// do something
}
return statePPlanner;
}