Monday, December 20, 2004

Ant default debug level

The javac compiler generates the line numbers while compiling so that in case of an exception the stack trace can tell what line number the error happened.

Example

java.lang.NullPointerException
at ThreadCallB.run(ThreadCallB.java:7)

java.lang.NullPointerException
at ThreadCallA.run(ThreadCallA.java:7)

So I know I should look at line 7 of ThreadCallA.java and ThreadCallB.java .

However if I say "javac –g:none" while compiling then I will not get the above line numbers. Not so helpful, right ?

But that is what ant defaults to. Look at this doc: http://ant.apache.org/manual/CoreTasks/javac.html.

“Debug: Indicates whether source should be compiled with debug information; defaults to off. If set to off, -g:none will be passed on the command line for compilers that support it (for other compilers, no command line argument will be used). If set to true, the value of the debuglevel attribute determines the command line argument.”

Maybe there is solid reason for this, but it sure beats me if there is one!

0 Comments:

Post a Comment

<< Home