Correct? Wow! That is unexpected.
Like Martin said, this is defined behaviour if you read the spec. To counter the surprise, look at it this way - in the class hierarchy, if you focus on implementation types, those can oftentimes classify as unproxyable types. It can be due to final methods, constructors and so on.... This would ultimately mean, that the proxy cannot be created at all because some type you do not even own (maybe it comes from another 3rd party library) is unproxyable. I'd say that is far more unfortunate than the current design. |