|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[ pmd-Bugs-2429017 ] Failed parsing byte[].class.hashCode()Bugs item #2429017, was opened at 2008-12-14 14:50
Message generated for change (Comment added) made by tomcopeland You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=479921&aid=2429017&group_id=56262 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: pmd Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Robert Munteanu (rombert) Assigned to: Xavier Le Vourch (xlv) Summary: Failed parsing byte[].class.hashCode() Initial Comment: The error is net.sourceforge.pmd.ast.ParseException: Encountered " "." ". "" at line 3, column 31. Was expecting: ")" ... I have attached the class and will attach the -debug output shortly. ---------------------------------------------------------------------- >Comment By: Tom Copeland (tomcopeland) Date: 2009-09-29 11:06 Message: What if we change CastLookahead like this? ======== void CastLookahead(): {} { LOOKAHEAD(3) "(" PrimitiveType() ")" | LOOKAHEAD("(" Type() "[") "(" Type() "[" "]" | "(" Type() ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal() ) } ======== That seems to work for both cases, and a scan of the JDK didn't turn up anything... can you try that? ---------------------------------------------------------------------- Comment By: Xavier Le Vourch (xlv) Date: 2009-05-14 00:43 Message: unfortunately it doesn't work for primitive types: result = negative ? new Long((long)-result.longValue()) : result; from Long.java in the SDK is not parsed correctly. Xavier ---------------------------------------------------------------------- Comment By: Tom Copeland (tomcopeland) Date: 2009-05-13 07:46 Message: Hm, I think the problem is in the cast lookahead. I think that production should be: =========== void CastLookahead(): {} { LOOKAHEAD("(" Type() "[" "]" ")") "(" Type() "[" "]" | "(" Type() ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal() ) } =========== With that change I'm able to successfully parse a test file and also all the PMD source code... Xavier, can you give that a shot? ---------------------------------------------------------------------- Comment By: Robert Munteanu (rombert) Date: 2008-12-14 17:12 Message: Extremely fast! Thank you. ---------------------------------------------------------------------- Comment By: Xavier Le Vourch (xlv) Date: 2008-12-14 16:51 Message: I've submitted a bug report for javacc as the grammar we use is similar to the one in their examples for 1.5 and their parser fails too: https://javacc.dev.java.net/issues/show_bug.cgi?id=216 Maybe somebody there will figure out the problem before us... A test case was also added in our test suite but marked as a non regression test (use "ant test" to run it). Xavier ---------------------------------------------------------------------- Comment By: Xavier Le Vourch (xlv) Date: 2008-12-14 15:08 Message: Thanks for the detailed report. I've reproduced the problem and will try to figure out where the problem is in the grammar. In the short term, it looks like if you remove the unnecessary parenthesis, the code is parsed correctly: return (byte[].class.hashCode()); fails but return byte[].class.hashCode(); works fine. Xavier ---------------------------------------------------------------------- Comment By: Robert Munteanu (rombert) Date: 2008-12-14 14:52 Message: Also, the command line was ~/apps/pmd-4.2.4/bin/pmd.sh -debug BadClass.java text basic > out ( that make the version 4.2.4 ) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=479921&aid=2429017&group_id=56262 ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Pmd-devel mailing list Pmd-devel@... https://lists.sourceforge.net/lists/listinfo/pmd-devel |
| Free embeddable forum powered by Nabble | Forum Help |