Have you tried:
new MySerializableObject<Integer[]>(new Integer[] {1});? On Feb 10, 4:13 am, jsegal <[email protected]> wrote: > You're correct that primitives themselves will not work, but they can > be autoboxed using their Object versions. My problem is with *arrays* > of primitive types, which *can* be used as parameters for for generic > classes, and should (according to everything I've found on the > subject) be serializable. > > You're right that this will not compile: > new MySerializableObject<int>(1); > > This will compile, however: > new MySerializableObject<int[]>(new int[]{1}); > > As will this (due to autoboxing): > new MySerializableObject<Integer>(1); > > On the other hand, arrays cannot be autoboxed, so this will not > compile: > new MySerializableObject<Integer[]>(new int[]{1}); > > On Feb 6, 6:10 pm, Ben Tilford <[email protected]> wrote: > > > Primitives do not extend Object and cannot implement Serializable. You > > should use the Object versions of primitives (i.e. use Integer instead of > > int) > > I don't think the code would even compile if you tried to use a primitive > > with generics. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
