Re: 1.3.0alpha5: gen-class, java.io.Serializable, readObject, writeObject....

2011-04-14 Thread Jules
I could :-) At the moment I have a hack() method which I call explicitly post-deserialisation. This allows me to remain pure-Clojure. I'm not sure that the necessary complexity required to do it right is worthwhile in my particualr usecase - but thanks for all your suggestions. Jules -- You

Re: 1.3.0alpha5: gen-class, java.io.Serializable, readObject, writeObject....

2011-04-13 Thread Armando Blancas
You're right, I didn't consider that those methods are public. I don't think you're making any mistakes; that's just not supported. In you case I'd probably write a Java class with all the requirements and internally consume Clojure functions done with a simpler usage of gen- class or deftype. I cu

Re: 1.3.0alpha5: gen-class, java.io.Serializable, readObject, writeObject....

2011-04-13 Thread Jules
hhh... I discovered a mistake in my last attempt, which accounted for the IncompatibleClassChangeError- but I just ended up with a class without the two required methods. Do you actually have a working example from which you can post snippets ? I can't get the :private metadata tag to gene

Re: 1.3.0alpha5: gen-class, java.io.Serializable, readObject, writeObject....

2011-04-13 Thread Jules
good idea but : you can't define private methods in an interface, so I tried with public methods, but these are unsurprisingly ignore by the serialisation runtime. I tried extending an abstract class with these methods - but you are not allowed to define something as private and abstract - whic

Re: 1.3.0alpha5: gen-class, java.io.Serializable, readObject, writeObject....

2011-04-11 Thread Armando Blancas
Write a Java interface with these two methods and have your gen'ed class implement it. The gen'ed methods won't have a throws clause but will work with the serialization mechanism all the same. On Apr 11, 12:50 pm, Jules wrote: > I'd like to provide : > >  private void writeObject(java.io.ObjectO

1.3.0alpha5: gen-class, java.io.Serializable, readObject, writeObject....

2011-04-11 Thread Jules
I'd like to provide : private void writeObject(java.io.ObjectOutputStream out) throws IOException private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException; methods on a gen-classed class to handle my own serialisation. I can get around the immu