[ 
http://jira.codehaus.org/browse/MJNCSS-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=130359#action_130359
 ] 

Peter Franzen commented on MJNCSS-16:
-------------------------------------

I stumbled upon this bug report while searching the Web for a solution to the 
problem with JavaNCSS and
annotations inside a method. When I didn't find any solution out there, I tried 
modifying the JavaCC grammar
used by JavaNCSS found in the file Java1.1.jj. Haven't done much testing yet, 
but these modifications solved
my problem, which was similar to the example in the description.

I don't use the Maven plugin, but run JavaNCSS as a standalone tool as part of 
my build process.
However, perhaps my modifications will work for the Maven plugin, or at least 
be a starting point
for resolving this issue.

I've attached a diff between the version of Java1.1.jj found in the JavaNCSS 
28.49 distribution
and my modifications.


> java annotations (within a method) cannot be parsed correctly
> -------------------------------------------------------------
>
>                 Key: MJNCSS-16
>                 URL: http://jira.codehaus.org/browse/MJNCSS-16
>             Project: Maven 2.x JavaNCSS Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-beta-2
>            Reporter: Roman Cerny
>            Assignee: Jean-Laurent de Morlhon
>
> the following code segment cannot be parsed correctly:
> public int myMethod()
> {
>     int i = 1;
>     @SuppressWarnings("unused")
>     int notUsedVariable = 2;
>     return i;
> }
> leads to following error:
> Encountered "@ SuppressWarnings ( \"unused\" ) int notUsedVariable =" at line 
> xxx, column yyy.
> Was expecting one of:
>     "assert" ...
>     "boolean" ...
>     "byte" ...
>     "char" ...
>     "double" ...
>     "enum" ...
>     "final" ...
>     "float" ...
>     "int" ...
>     "long" ...
>     "short" ...
>      ...
>     "public" ...
>     "static" ...
>     "protected" ...
>     "private" ...
>     "abstract" ...
>     "synchronized" ...
>     "native" ...
>     "transient" ...
>     "volatile" ...
>     "strictfp" ...
>     "@" "enum" ...
>     "@"  "." ...
>     "@"  "("  ...
>     "@"  "(" ")" ...
>     "@"  "(" "@" ...
>     "@"  "(" "{" ...
>     "@"  "(" "+" ...
>     "@"  "(" "-" ...
>     "@"  "(" "++" ...
>     "@"  "(" "--" ...
>     "@"  "(" "~" ...
>     "@"  "(" "!" ...
>     "@"  "(" "(" ...
>     "@"  "("  ...
>     "@"  "("  ...
>     "@"  "("  ...
>     "@"  "("  "." ...
>     "@"  "("  "[" ...
>     "@"  "("  "(" ...
>     "@"  "("  "++" ...
>     "@"  "("  "--" ...
>     "@"  "("  "*" ...
>     "@"  "("  "/" ...
>     "@"  "("  "%" ...
>     "@"  "("  "+" ...
>     "@"  "("  "-" ...
>     "@"  "("  "<<" ...
>     "@"  "("  ">>" ...
>     "@"  "("  ">>>" ...
>     "@"  "("  "<" ...
>     "@"  "("  ">" ...
>     "@"  "("  "<=" ...
>     "@"  "("  ">=" ...
>     "@"  "("  "instanceof" ...
>     "@"  "("  "==" ...
>     "@"  "("  "!=" ...
>     "@"  "("  "&" ...
>     "@"  "("  "^" ...
>     "@"  "("  "|" ...
>     "@"  "("  "&&" ...
>     "@"  "("  "||" ...
>     "@"  "("  "?" ...
>     "@"  "("  ")" "public" ...
>     "@"  "("  ")" "static" ...
>     "@"  "("  ")" "protected" ...
>     "@"  "("  ")" "private" ...
>     "@"  "("  ")" "final" ...
>     "@"  "("  ")" "abstract" ...
>     "@"  "("  ")" "synchronized" ...
>     "@"  "("  ")" "native" ...
>     "@"  "("  ")" "transient" ...
>     "@"  "("  ")" "volatile" ...
>     "@"  "("  ")" "strictfp" ...
>     "@"  "("  ")" "@" ...
>     "@"  "("  ")" "boolean" ...
>     "@"  "("  ")" "char" ...
>     "@"  "("  ")" "byte" ...
>     "@"  "("  ")" "short" ...
>     "@"  "("  ")" "int" ...
>     "@"  "("  ")" "long" ...
>     "@"  "("  ")" "float" ...
>     "@"  "("  ")" "double" ...
>     "@"  "("  ")" "enum" ...
>     "@"  "("  ")"  "." ...
>     "@"  "("  ")"  "<" ...
>     "@"  "("  ")"  "[" ...
>     "@"  "("  ")"  "enum" ...
>     "@"  "("  ")"   ";" ...
>     "@"  "("  ")"   "=" ...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to