StackOverflowError when serializing an object in Java

后端 未结 8 1667
眼角桃花
眼角桃花 2020-11-28 13:56

I am writing an application in Java using Swing. I am trying to implement functionality to save and load simulation states for at simulation i am running. The entire simulat

8条回答
  •  半阙折子戏
    2020-11-28 14:17

    You've got some deeply nested ArrayLists.

    I think maybe it's just going depth first, and that means it's going for the bottom Sensor, which is too deep.

    Maybe you could create a custom structure with Sensors starting with the bottom Sensor?

    Or maybe you'll have to provide your own serialisation to handle it? http://java.sun.com/developer/technicalArticles/Programming/serialization/

提交回复
热议问题