Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Currently Throwable.backtrace is treated by Class.getDeclaredField like an injected field; it is not reported back to the caller. The reason it is hidden is because a crash that was reported (JDK-4496456) when a user tries to get the contents of the backtrace Object array. Without knowing the history here JDK-4496456 was very likely because of the specific representation behind Throwable.backtrace back then. This changed. The Object[] looks now like: Object[] backtrace = { short[] method_ids, int[] bcis, Object[] mirrors }; and it's perfectly sane to do: // Retrieve the class of throwable.backtrace[0][0]. Class class2 = ((Object[]) ((Object[]) backtrace)[0])[0].getClass(); (although it will bail out with a ClassCastException). To make sure this doesn't break again we could take the test case of JDK-4496456 and make a regression test.
|