The type and amount of debug information included within a compiled .class file depends upon the defaults of the build tool and the explicitly specified debug options.
These are the relevant debug options for the IBM javac compiler:
javac -g:source,lines,vars <class files>
The result of this option is that any stack traces that appear because of exceptions will include location information of each stack entry. For example:
Exception in thread "main" java.lang.NullPointerException
at com.example.Book.getTitle(Book.java:16)
at com.example.Author.getBookTitles(Author.java:25)
at com.example.Bootstrap.main(Bootstrap.java:14)
If the debug options are not specified or the -g:none
option is used, much less
information is available for problem determination:
Exception in thread "main" java.lang.NullPointerException
at com.example.Book.getTitle(Unknown location)
at com.example.Author.getBookTitles(Unknown location)
at com.example.Bootstrap.main(Unknown location)
Not only does this reduce the value of stack traces, it prevents the names of local variables
from appearing when debugging programs. Instead, all variables simply appear as <local
variable>
or a similarly unhelpful name, depending on the development environment.