How do I prevent a field from serialization in a PersistentStateComponent?

Answered

I have a     

private volatile ScheduledFuture<?> timerFuture;

in my implementation of PersistentStateComponent and it is saving it out to the xml, but then it can't read it in.  I don't need it saved though and if I could stop that, then it would load fine (as it loads fine if I remove timerFuture).  I tried:

private transient volatile ScheduledFuture<?> timerFuture;

But that did not prevent it.  Is there a way?

0
3 comments

Hi Karol Lewandowski ,

I actually tried that, but it seems to have no effect.



I still end up with this in the xml:
```
    <option name="timerFuture">
     <ScheduledFuture />
   </option>
```

0

It was lombok @Gettter/@Setter on the class instead of the 3 fields I care about.

This line is what helped me figure it out:

https://github.com/JetBrains/intellij-community/blob/master/platform/util/src/com/intellij/util/xmlb/XmlSerializerUtil.java#L17
 

0

Please sign in to leave a comment.