#1788 Range Serialization from Fantom1.0.60 -> Fantom1.0.61

SlimerDude Sat 25 Feb 2012

The following when run with Fantom 1.0.60 works just fine:

@Serializable
const class Sausage {
  const Range target := 0..100

  new make(|This|? f := null) {
    f?.call(this) 
  }

  static Void main(Str[] args) {
    sausage := Sausage()
    buff := StrBuf()
    buff.out.writeObj(sausage)
    echo( buff.toStr )  
    Sausage s2 := buff.toStr.in.readObj
  }
}

but with Fantom 1.0.61 (and Fantom 1.0.62) I get the following Err when Sausage is read in:

sys::Err: Cannot emitFinish: sys::Range.start
  fan.sys.ClassType.finish (ClassType.java:572)
  fanx.serial.ObjDecoder.readSimple (ObjDecoder.java:178)
  fanx.serial.ObjDecoder.readObj (ObjDecoder.java:140)
  fanx.serial.ObjDecoder.readComplexSet (ObjDecoder.java:320)
  fanx.serial.ObjDecoder.readComplexFields (ObjDecoder.java:293)
  fanx.serial.ObjDecoder.readComplex (ObjDecoder.java:218)
  fanx.serial.ObjDecoder.readObj (ObjDecoder.java:146)
  fanx.serial.ObjDecoder.readObj (ObjDecoder.java:55)
  fan.sys.InStream.readObj (InStream.java:560)
  fan.sys.InStream.readObj (InStream.java:557)
  afalife::Sausage.main (SerialTest.fan:60)
Cause:
  sys::IndexErr: java.lang.ArrayIndexOutOfBoundsException: -1
  fan.sys.ClassType.finishMethod (ClassType.java:653)
  fan.sys.ClassType.finishSlots (ClassType.java:595)
  fan.sys.ClassType.finish (ClassType.java:550)
  fanx.serial.ObjDecoder.readSimple (ObjDecoder.java:178)
  fanx.serial.ObjDecoder.readObj (ObjDecoder.java:140)
  fanx.serial.ObjDecoder.readComplexSet (ObjDecoder.java:320)
  fanx.serial.ObjDecoder.readComplexFields (ObjDecoder.java:293)
  fanx.serial.ObjDecoder.readComplex (ObjDecoder.java:218)
  fanx.serial.ObjDecoder.readObj (ObjDecoder.java:146)
  fanx.serial.ObjDecoder.readObj (ObjDecoder.java:55)
  fan.sys.InStream.readObj (InStream.java:560)
  fan.sys.InStream.readObj (InStream.java:557)
  afalife::Sausage.main (SerialTest.fan:60)
  3 More...

Is this a bug or is my environment goosed?

(As this seems rather fundamental I thought I'd break this post out of the Serialization shenanigans thread.)

brian Sat 25 Feb 2012

Promoted to ticket #1788 and assigned to brian

Looks like that is a problem I introduced in Oct of last year, when I made some package private methods public for IntArray.

brian Sat 25 Feb 2012

Ticket resolved in 1.0.63

I pushed a fix and added a test case for that.

changeset

Login or Signup to reply.