ianso/rhino — comment on commit f9603b6c42d061f9a86105e41850227ed8e6bd44
File: src/org/mozilla/javascript/ConsString.java line 37
By szegedi:

I'm not even sure there's merit in serializing these. How about just implementing writeReplace() to write a java.lang.String out. Basically, a ConsString would get serialized as java.lang.String; as long as they're always stored in fields of declared type CharSequence, it should be fine.

private Object writeReplace() {
return this.toString();
}