Why is android.os.Bundle a final class?
<p>I recently ran into some issues with <code>android.os.Bundle</code> that I hoped to fix by simply extending the class and making it more loosely-typed.  The specific problem that I ran into was errors like:</p>

<pre><code>W/Bundle  ( 6782): Key access_token expected byte[] but value was a java.lang.String.  The default value &lt;null&gt; was returned.
W/Bundle  ( 6782): Attempt to cast generated internal exception:
W/Bundle  ( 6782): java.lang.ClassCastException: java.lang.String
W/Bundle  ( 6782):  at android.os.Bundle.getByteArray(Bundle.java:1305)
</code></pre>

<p>Of course, conversion from <code>String</code> to <code>byte[]</code> is trivial, so my thought was to just have the <code>Bundle</code> do this conversion automatically if it's looking for a <code>byte[]</code> but finds a <code>String</code> instead.  It's silly that it doesn't do this already (and also that it has specific getters and setters for pretty much <em>every</em> primitive type and a few different <code>Object</code> types instead of generic ones that just work in terms of <code>Object</code>, or at worst <code>Number</code>, <code>String</code>, and <code>Parcelable</code>), in my opinion.</p>

<p>But anyways, I quickly discovered that I can't fix the problem by extending <code>Bundle</code>, because it is declared <code>final</code>.  Is there any known/specific reason for this?  There are other classes in <code>android.os</code> that are not <code>final</code>, so what makes <code>Bundle</code> worthy of this assignation?</p>

<p>Also, any ideas on how to work around this?  A wrapper class is out as there is no common <code>interface</code> for it to implement (the code that actually causes the issue is part of a third-party library, so I can't just update it to refer directly to a wrapper class).  </p>

<p>I guess that leaves the only option hunting down all the places in the code that happen to be setting up <code>String</code> values for things that the third-party code expects to be passed as byte arrays.</p>
