[Checkers] bug in Log when outputing tabs

Mahmood Ali mahmood at MIT.EDU
Fri Aug 15 01:40:48 EDT 2008


Greetings,

The changeset 72:1cf29847eb6e (whose parent is 70:41fb91c70d47), dated  
July 15th, 2008 and described as '6724071: refactor Log into a front  
end and back end', makes the compiler unstable when compiling a file  
containing tabs.

Consider the file TestTabs.java containing:
	t
(note beginning white space is a tab)

When compiling with any successor changeset that is a child of the  
given one, the compiling outputs an Exception stack trace (while  
outputing ^).  The expected result is the compiler would output '^' in  
the proper location and continue to parse the rest of the file (or  
stop) without an exception!

Sorry for sending this to the mailing list instead of open a bug  
report.  I decided to email, since I didn't know if the Sun database  
accepts bugs associated with OpenJDK javac 7.

Attached below is my transcript of my compilation and determining the  
revision causing the error:

Thanks,
Mahmood

mahmood-mac:langtools mahmood$ hg up
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
mahmood-mac:langtools mahmood$ hg tip
changeset:   84:1c4a97a661b9
tag:         tip
user:        xdono
date:        Thu Aug 14 09:26:42 2008 -0700
summary:     Added tag jdk7-b33 for changeset 0a5f04fb7282

mahmood-mac:langtools mahmood$ ./dist/bin/javac ~/TestTabs.java
mahmood-mac:langtools mahmood$ ant -f make/build.xml clean build-javac  
 > /dev/null
mahmood-mac:langtools mahmood$ ./dist/bin/javac ~/ 
TestTabs.javaTestTabs.java:1: reached end of file while parsing
	t
	 An exception has occurred in the compiler (1.7.0-internal). Please  
file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport 
)  after checking the Bug Parade for duplicates. Include your program  
and the following diagnostic in your report.  Thank you.
java.lang.StringIndexOutOfBoundsException: String index out of range: 2
	at java.lang.String.charAt(String.java:687)
	at com.sun.tools.javac.util.Log.printErrLine(Log.java:251)
	at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:343)
	at com.sun.tools.javac.util.Log.report(Log.java:315)
	at com.sun.tools.javac.util.AbstractLog.error(AbstractLog.java:96)
	at com.sun.tools.javac.parser.Parser.reportSyntaxError(Parser.java:293)
	at com.sun.tools.javac.parser.Parser.syntaxError(Parser.java:281)
	at  
com 
.sun 
.tools 
.javac.parser.Parser.classOrInterfaceOrEnumDeclaration(Parser.java:2238)
	at com.sun.tools.javac.parser.Parser.typeDeclaration(Parser.java:2212)
	at com.sun.tools.javac.parser.Parser.compilationUnit(Parser.java:2158)
	at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:549)
	at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:590)
	at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java: 
841)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:767)
	at com.sun.tools.javac.main.Main.compile(Main.java:386)
	at com.sun.tools.javac.main.Main.compile(Main.java:312)
	at com.sun.tools.javac.main.Main.compile(Main.java:303)
	at com.sun.tools.javac.Main.compile(Main.java:82)
	at com.sun.tools.javac.Main.main(Main.java:67)
mahmood-mac:langtools mahmood$ hg up
7284 files updated, 0 files merged, 14 files removed, 0 files unresolved
mahmood-mac:langtools mahmood$ ant -f make/build.xml clean build-javac  
 > /dev/null
mahmood-mac:langtools mahmood$ ./dist/bin/javac ~/TestTabs.java/Users/ 
mahmood/TestTabs.java:1: reached end of file while parsing
	t
	 An exception has occurred in the compiler (1.7.0-internal). Please  
file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport 
)  after checking the Bug Parade for duplicates. Include your program  
and the following diagnostic in your report.  Thank you.
java.lang.StringIndexOutOfBoundsException: String index out of range: 2
	at java.lang.String.charAt(String.java:687)
	at com.sun.tools.javac.util.Log.printErrLine(Log.java:251)
	at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:343)
	at com.sun.tools.javac.util.Log.report(Log.java:315)
	at com.sun.tools.javac.util.AbstractLog.error(AbstractLog.java:96)
	at com.sun.tools.javac.parser.Parser.reportSyntaxError(Parser.java:293)
	at com.sun.tools.javac.parser.Parser.syntaxError(Parser.java:281)
	at  
com 
.sun 
.tools 
.javac.parser.Parser.classOrInterfaceOrEnumDeclaration(Parser.java:2243)
	at com.sun.tools.javac.parser.Parser.typeDeclaration(Parser.java:2217)
	at com.sun.tools.javac.parser.Parser.compilationUnit(Parser.java:2163)
	at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:530)
	at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:571)
	at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java: 
822)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:748)
	at com.sun.tools.javac.main.Main.compile(Main.java:386)
	at com.sun.tools.javac.main.Main.compile(Main.java:312)
	at com.sun.tools.javac.main.Main.compile(Main.java:303)
	at com.sun.tools.javac.Main.compile(Main.java:82)
	at com.sun.tools.javac.Main.main(Main.java:67)
mahmood-mac:langtools mahmood$ hg up
703 files updated, 0 files merged, 2 files removed, 0 files unresolved
mahmood-mac:langtools mahmood$ ant -f make/build.xml clean build-javac  
 > /dev/null
mahmood-mac:langtools mahmood$ ./dist/bin/javac ~/TestTabs.java/Users/ 
mahmood/TestTabs.java:1: reached end of file while parsing
	t
	^
1 error
mahmood-mac:langtools mahmood$




More information about the checkers mailing list