I'm trying to create an object of a class that has the following declaration and constructor:
I'm using the following to create the object:
However, this give me the following compile warning:
Note that I cannot change anything about SomeClass. Is it possible to eliminate the compiler warning by changing the way I create the object?
I've seen numerous postings on numerous websites about this warning and I know that it is related to generics, but all the solutions say to modify the class. But as I mentioned, I cannot change the class.
I'm using jdk 1.6.0_03
Thanks.
Code:
public class SomeClass<T>
{
protected T value = null;
public SomeClass(T value)
{
this.value = value;
}
...
}
I'm using the following to create the object:
Code:
SomeClass sc = new SomeClass(0);
However, this give me the following compile warning:
Code:
warning: [unchecked] unchecked call to SomeClass(T) as a member of the raw type com.myCompany.myPackage.SomeClass
Note that I cannot change anything about SomeClass. Is it possible to eliminate the compiler warning by changing the way I create the object?
I've seen numerous postings on numerous websites about this warning and I know that it is related to generics, but all the solutions say to modify the class. But as I mentioned, I cannot change the class.
I'm using jdk 1.6.0_03
Thanks.