Debugging option for javac and javafxc

I work on JavaFX compiler these days. The command line (debugging) option that I often use is -doe ("dump on error"). This option prints stack trace of the compiler when error message is printed. NOTE: This is an internal option and can be removed any time without notice! But, it is useful for debugging. This option works for javac as well as javafxc. When I misspelled "class" as "clas" and run compiler with -doe option, I got the stack trace below:


$ javac -doe t.java
t.java:1: class, interface, or enum expected
clas t {}
\^
java.lang.RuntimeException
	at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:565)
	at com.sun.tools.javac.util.Log.report(Log.java:523)
	at com.sun.tools.javac.util.Log.error(Log.java:404)
	at com.sun.tools.javac.parser.Parser.reportSyntaxError(Parser.java:282)
	at com.sun.tools.javac.parser.Parser.syntaxError(Parser.java:267)
	at com.sun.tools.javac.parser.Parser.classOrInterfaceOrEnumDeclaration(Parser.java:2206)
	at com.sun.tools.javac.parser.Parser.typeDeclaration(Parser.java:2180)
	at com.sun.tools.javac.parser.Parser.compilationUnit(Parser.java:2126)
	at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:509)
	at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550)
	at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:801)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
	at com.sun.tools.javac.main.Main.compile(Main.java:353)
	at com.sun.tools.javac.main.Main.compile(Main.java:279)
	at com.sun.tools.javac.main.Main.compile(Main.java:270)
	at com.sun.tools.javac.Main.compile(Main.java:69)
	at com.sun.tools.javac.Main.main(Main.java:54)
1 error

Comments:

Really cool.
It didn't know that.

many thanks,
Rémi

Posted by Rémi Forax on December 18, 2008 at 06:55 AM IST #

Post a Comment:
Comments are closed for this entry.
About

sundararajan

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks
Links

No bookmarks in folder

Blogroll

No bookmarks in folder

News

No bookmarks in folder