Community
Participate
Working Groups
In 31RC1, in case of the following JavaDoc, /** * @param test */ JDT fails in infinit loop at at line 857 of the AbstractCommentParser.parseParam(): while (readToken() != TerminalTokens.TokenNameWHITESPACE) { this.currentTokenType = -1; end = hasMultiLines ? this.lineEnd: this.scanner.getCurrentTokenEndPosition(); } If fact, the current token is TokenNameEOF.
*** Bug 99508 has been marked as a duplicate of this bug. ***
*** Bug 99509 has been marked as a duplicate of this bug. ***
+1 for RC3 Dirk - I think we should fix this for RC3.
+1.
Can you attach your compilation unit to this bug? I'm not able to reproduce the infinite loop, thx
I got it. Here's sample which makes this loop infinite: X.java: public class X { } /** * @param test*/<EOF> IMO, example to get this infinite loop is really specific and seems not something really easy to reproduce (I really spend lot of time before get it...) So, except if you have another simple test case user can write easily, I would like you to decrease severity to major (perhaps normal would be better finally).
Created attachment 22917 [details] Patch to fix this issue Comment parser expects a separator after tag name or following identifier. When cu ends with javadoc and this comment ends with tag name or identifier *just* followed by end of comment (ie. */), it reaches EOF and falls into this infinite loop...
Created attachment 22918 [details] Test case added to ASTConverterJavadocTest
In fact, for us, it is very easy to reproduce it if you use the "method" comment template, which is defined in JDT Preferences. However, the getter and setter comment template work fine. public class Person { /** * @param test */ void test() { } }
How can you get a @param tag although your method have no argument?
I'm still unable to reproduce infinite loop with comment 9 example. I've tried many variations (Unix format, only tabs, only spaces, UTF-8 encoding, etc.) without any success. I'm confident that fix will solve this problem but I really want to understand why you easily get it and not me... May you attach a compilation with which you get this issue, perhaps this will help me? TIA
Fixed, patch released in HEAD
Here is our code: String source = "/**\n@param country*/"; ASTParser parser = ASTParser.newParser(AST.JLS3); parser.setKind(ASTParser.K_COMPILATION_UNIT); parser.setSource(source.toCharArray()); ASTNode root = (ASTNode) parser.createAST(null);
OK, but why did you reopen this bug? 1) It passes with the fix 2) It's not so different than my comment 6 sample also fixed by the code I released yesterday... As I said in this comment, your sample is really not a common test case and just add a space anywhere after "country" will avoid this issue... => modify severity and set as resolved
I've added test case #testBug99507b in ASTConverterJavadocTest for your specific comment 13 code snippet
Verified using build N20050616-0010 + JDT Core HEAD.