bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/43049] New: ClassCastException when trying to serialize e


From: lorban at bitronix dot be
Subject: [Bug classpath/43049] New: ClassCastException when trying to serialize enum arrays
Date: 12 Feb 2010 00:58:47 -0000

Take any simple enum, for instance:

enum MyEnum {
    A, B, C
}

then create an array of them:

Object o = new MyEnum[] {MyEnum.A, MyEnum.B, MyEnum.C};

then try to serialize it with an ObjectOutputStream:

ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(o);

the oos.writeObject(o) line will then throw this exception:

Exception in thread "main" java.lang.ClassCastException: [Lmain/MyEnum;
   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:332)
   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:186)
   at ( the oos.writeObject(o) line )


-- 
           Summary: ClassCastException when trying to serialize enum arrays
           Product: classpath
           Version: 0.98
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lorban at bitronix dot be


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43049





reply via email to

[Prev in Thread] Current Thread [Next in Thread]