Hi,
I have a class that needs to use a Class<T>
parameter (see my previous semi-related question). It is:
public class BaseTable<T extends TableEntry>
{
protected Class<T> mClass;
...
public BaseTable(int rows, int cols, Class<T> clasz)
{
...
mClass = clasz;
}
public BaseTable(int rows, int cols)
{
this(rows, cols, StringTableEntry.class);
//Does NOT compile:
//expected [int, int, Class<T>], but got
//[int, int, Class<blah.blah.StringTableEntry>]
}
...
}
I am wondering why the constructor (with 2 parameters) does not work, but when I am invoking the exact same thing from an external class, like this:
mSomeTable = new BaseTable<StringTableEntry>(2, 2, StringTableEntry.class);
It compiles and runs without complaining. Why so, and how to work around this?
Thanks!