Would it be useful to be able to mark objects where the value ofString.valueOf() would included in any stack trace. In my example below I used "trace". Variables that aren't declared at the point of the stack trace would just be ingored. It would make debugging much easier and make it much easier to write programs that are easy to debug.
Example stack trace for the code below:
java.lang.NullPointerException:
at Test.main(Test.java:7) index=0, sum=3, obj=null
public class Test {
Object obj;
public void main(String[] args) trace obj {
trace int sum = 0;
for(trace int index = 0; index < args.length; index++) {
sum += Integer.parseInt(args[index]);
sum += obj.hashCode();//Will cause NullPointerException
}
}
}
From: http://jamesjava.blogspot.com/2005/04/extra-info-in-stack-traces.html