Doing Java serialization without reflection

While digging around old stuff I found a small project which was part of one of our computer science lectures during summer 2005. The project was done by two friends of mine and me.

The task was to get serialization to a JVM that does not support reflection (which normally is needed to do serialization). These types of JVMs can be found on mobile or embedded devices with very limited resources.

Our solution was to develop a preprocessor using static meta programming with OpenJava (now OJ). Basically this preprocessor adds a serialize() and a deserialize() method to all serializable classes which then take care of the actual serialization process. Sounds easy. Well actually it’s not that easy, if you’re interested just have have a look at the code or the documentation.

The project is called SWREnhancer and licensed under the Apache License, Version 2.0.

Here are the files: src jar doc [de]