JDK-6481701 : annot00701.html, annot01602m3.html and intf01004m1.html hang while compiling (b102)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6,6u1
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2006-10-13
  • Updated: 2012-03-22
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u4Fixed 7 b03Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
JCK            : JCK6.0 b32, JCK1.5a b11
J2SE           : FAIL - mustang b102, since b91 PASS b90
Platform[s]    : FAIL - seems to be all
switch/Mode    : FAIL - fail with defaut keys

Three tests:

lang/ANNOT/annot007/annot00701/annot00701.html
lang/ANNOT/annot016/annot01602m3/annot01602m3.html
lang/INTF/intf010/intf01004m1/intf01004m1.html

Are wrongly determined as "passed" by JDK 1.6. Tests expect java classses to be rejected due to wrong syntax. Unfortunately real situation is that compiler shows error and then starts to collect system resources then throw error:

The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
	at java.lang.String.toLowerCase(String.java:2418)
	at java.io.Win32FileSystem.hashCode(Win32FileSystem.java:581)
	at java.io.File.hashCode(File.java:1893)
	at com.sun.tools.javac.util.DefaultFileManager$RegularFileObject.hashCode(DefaultFileManager.java:1272)
	at com.sun.tools.javac.util.Pair.hashCode(Pair.java:49)
	at java.util.HashMap.getEntry(HashMap.java:344)
	at java.util.HashMap.containsKey(HashMap.java:335)
	at java.util.HashSet.contains(HashSet.java:184)
	at com.sun.tools.javac.util.Log.shouldReport(Log.java:276)
	at com.sun.tools.javac.util.Log.report(Log.java:535)
	at com.sun.tools.javac.util.Log.error(Log.java:412)
	at com.sun.tools.javac.parser.Parser.reportSyntaxError(Parser.java:280)
	at com.sun.tools.javac.parser.Parser.syntaxError(Parser.java:267)
	at com.sun.tools.javac.parser.Parser.syntaxError(Parser.java:262)
	at com.sun.tools.javac.parser.Parser.illegal(Parser.java:319)
	at com.sun.tools.javac.parser.Parser.illegal(Parser.java:326)
	at com.sun.tools.javac.parser.Parser.term3(Parser.java:1053)
	at com.sun.tools.javac.parser.Parser.term2(Parser.java:681)
	at com.sun.tools.javac.parser.Parser.term1(Parser.java:652)
	at com.sun.tools.javac.parser.Parser.term(Parser.java:608)
	at com.sun.tools.javac.parser.Parser.term(Parser.java:590)
	at com.sun.tools.javac.parser.Parser.type(Parser.java:584)
	at com.sun.tools.javac.parser.Parser.classOrInterfaceBodyDeclaration(Parser.java:2464)
	at com.sun.tools.javac.parser.Parser.classOrInterfaceBody(Parser.java:2403)
	at com.sun.tools.javac.parser.Parser.interfaceDeclaration(Parser.java:2272)
	at com.sun.tools.javac.parser.Parser.classOrInterfaceOrEnumDeclaration(Parser.java:2188)
	at com.sun.tools.javac.parser.Parser.typeDeclaration(Parser.java:2175)
	at com.sun.tools.javac.parser.Parser.compilationUnit(Parser.java:2121)
	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)

We found this error while performing test with JCK 1.5a b11 and JDK 6.0 compiler with "-target 1.5". Tests were rejected as hung.

jdk 1.5 u9 compiler rejects these tests correctly.

jtr's attached.

Comments
SUGGESTED FIX Webrev of changes: http://sa.sfbay/projects/langtools/bugid_summary.pl?bugid=6481701 See also attachment 6481701.tar.gz.
20-10-2006

SUGGESTED FIX Index: j2se/src/share/classes/com/sun/tools/javac/parser/Parser.java --- /tmp/geta12781 2006-10-19 17:25:30.000000000 -0700 +++ Parser.java 2006-10-19 15:43:04.000000000 -0700 @@ -268,6 +268,7 @@ return toP(F.at(pos).Erroneous(errs)); } + private int errorPos = Position.NOPOS; /** * Report a syntax error at given position using the given * argument unless one was already reported at the same position. @@ -280,6 +281,9 @@ log.error(pos, key, arg); } S.errPos(pos); + if (S.pos() == errorPos) + S.nextToken(); // guarantee progress + errorPos = S.pos(); }
20-10-2006

EVALUATION No new tests have been developed for this fix since this is tested by JCK. I have verified that the affected tests complete without crash.
20-10-2006

EVALUATION The compiler should not crash or hang.
19-10-2006