<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Serialization on JAVAPRO International</title><link>https://javapro-en.svenruppert.com/tags/serialization/</link><description>Recent content in Serialization on JAVAPRO International</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Tue, 26 May 2026 07:00:00 +0000</lastBuildDate><atom:link href="https://javapro-en.svenruppert.com/tags/serialization/index.xml" rel="self" type="application/rss+xml"/><item><title>Destructoring is the future of Javas Encapsulation</title><link>https://javapro-en.svenruppert.com/destructoring-is-the-future-of-javas-encapsulation/</link><pubDate>Tue, 26 May 2026 07:00:00 +0000</pubDate><guid>https://javapro-en.svenruppert.com/destructoring-is-the-future-of-javas-encapsulation/</guid><description>&lt;p&gt;Encapsulation in Java has been broken &lt;a href="https://openjdk.org/jeps/500#Serialization-libraries-should-use-sun-reflect-ReflectionFactory"&gt;since the Java Development Kit (JDK) 5&lt;/a&gt;. Objects &lt;em&gt;should&lt;/em&gt; guarantee that their inner state matches what we cast into code, but at runtime any &lt;code&gt;private&lt;/code&gt; and &lt;code&gt;final&lt;/code&gt; state can be set from the outside to any value — bypassing any checks and asserts. This is possible through the Reflection Api, which allows to &lt;code&gt;setAccessible&lt;/code&gt; any &lt;code&gt;private&lt;/code&gt; field and then &lt;code&gt;set&lt;/code&gt; the value of any &lt;code&gt;final&lt;/code&gt; field. This specific use of the Reflection Api to mutate an immutable &lt;code&gt;final&lt;/code&gt; field is called &lt;em&gt;deep reflection&lt;/em&gt;.&lt;/p&gt;</description></item></channel></rss>