Got this idea from this previous question.
How to create a generic array in Java?
Anyway, my code is like this:
public class Slice<E>
{
    private E[] data;
    public Slice(Class<E> elementType, int size)
    {
        //@SuppresWarnings({"unchecked"})
        data = (E[])Array.newInstance(elementType, size);
    }
}
I deleted the unnecessary stuff. This compiles fine when the suppress directive is commented out. When I uncomment it, I get
Error: <identifier> expected    
        data = (E[])Array.newInstance(elementType, size);
             ^
Any ideas? why would this be happening?
 
     
     
    