Getting a Generic array creation error on a non generic array, I think?
So, this code works fine, pretty straight-forward.
public class test {
private subTest[] subTests;
private class subTest {
}
public test(int size) {
subTests = new subTest[size];
}
}
But what I am actually trying to do is something more like this:
public class test<T> {
private subTest[] subTests;
private T[] arrayOfGenerics;
private class subTest {
}
public test(int size, int size2) {
arrayOfGenerics = (T[]) new Object[size]; //This line works fine
subTests = new subTest[size2]; //This line is the one giving me a 'Generic array creation' error
}
}