StackTraceElement question

Christos Zoulas christos at zoulas.com
Mon Oct 8 11:48:42 UTC 2012


On Oct 8,  7:33pm, rednaxelafx at gmail.com (Krystal Mok) wrote:
-- Subject: Re: StackTraceElement question

| > Can't you just do Class.forName(getClassName()) and then find the
| > enclosing class?
| >
| > There could be potential class loader issues to
| use Class.forName(getClassName()) in this case (most probably caused by
| reflective calls).
| But then again, giving the user a reference to instead of the name of a
| class really gives the user more information then what's been given now
| (e.g. class loader info). Which is not necessarily a good thing. I'd second
| Alan on having to do more analysis.

There is also the problem of having a class hierarchy like:

class A extends class I
class B extends class I

and then trying to figure out if it is A or B when you just have I from
that StackTraceElement.

Alan is right, there could be security issues providing the class, and
it is annoying and expensive to have to deal with them in the code
that fills in StackTraceElement, and there could be also serialization
issues. I think it is still a useful change though...

christos



More information about the core-libs-dev mailing list