StackTraceElement question (original) (raw)
Krystal Mok rednaxelafx at gmail.com
Sat Oct 6 14:58:40 UTC 2012
- Previous message: hg: jdk8/tl/jdk: 8000354: (props) Properties.storeToXML/loadFromXML need to allow for alternative implementations
- Next message: StackTraceElement question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I believe this discussion belongs to core-libs-dev list better. cc'd.
- Kris
On Sat, Oct 6, 2012 at 3:04 AM, Christos Zoulas <christos at zoulas.com> wrote:
Hi,
I don't know if this belongs to this list, but if it does not, please point me to where it does. I think that it would be nice if StackTraceElement which currently contains: boolean equals(Object obj) String getClassName() String getFileName() int getLineNumber() String getMethodName() int hashCode() boolean isNativeMethod() String toString() It would be more useful for it to also contain: Class<?> getClass() The reason I am asking, is because I have an application where I would like to find the enclosing class from where the exception is thrown not the superclass, but I cannot deduce that from the class name. If STE contained the above method, I could do: Class<?> c = ste.getClass(); while (c.getEnclosingClass() != null) { c = c.getEnclosingClass(); } return c.getName(); to find the class I want, and getClassName() could be just a wrapper: String getClassName() { return getClass().getName(); } Is there any reason to store the name instead of the Class<?>? Is it possible to fix this in a future version of the jdk? thanks christos
- Previous message: hg: jdk8/tl/jdk: 8000354: (props) Properties.storeToXML/loadFromXML need to allow for alternative implementations
- Next message: StackTraceElement question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]