SonarQube
  1. SonarQube
  2. SONAR-312

JavaNCSS fails when a Java interface contains an annotation

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3, 1.4
    • Fix Version/s: 1.9
    • Component/s: Maven Plugin
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Thanks to Wojciech Durczynski who detected this issue. The following code can not be parsed by javancss 29.50 :

      package xxx;
      
      public interface InterfaceWithAnnotation {
      
        @Deprecated
        public static final String MY_PARAM = "param";
      
      }
      

      The error is

      Embedded error: An error has occurred in JavaNCSS Report report generation.
      Encountered "public static final String MY_PARAM =" at line 6, column 3.
      Was expecting one of:
          "boolean" ...
          "byte" ...
          "char" ...
          "double" ...
          "float" ...
          "int" ...
          "long" ...
          "short" ...
          "@" ...
          "." ...
          "(" ...
          "public" "public" ...
          "public" "static" "public" ...
          "public" "static" "static" ...
          "public" "static" "protected" ...
          "public" "static" "private" ...
          "public" "static" "final" "public" ...
          "public" "static" "final" "static" ...
          "public" "static" "final" "protected" ...
          "public" "static" "final" "private" ...
          "public" "static" "final" "final" ...
          "public" "static" "final" "abstract" ...
          "public" "static" "final" "synchronized" ...
          "public" "static" "final" "native" ...
          "public" "static" "final" "transient" ...
          "public" "static" "final" "volatile" ...
          "public" "static" "final" "strictfp" ...
          "public" "static" "final" "@" ...
          "public" "static" "final" "enum" ...
          "public" "protected" ...
          "public" "private" ...
          "public" "static" "abstract" ...
          "public" "static" "final" "<" ...
          "public" "static" "final" "void" ...
          "public" "static" "final" "boolean" ...
          "public" "static" "final" "char" ...
          "public" "static" "final" "byte" ...
          "public" "static" "final" "short" ...
          "public" "static" "final" "int" ...
          "public" "static" "final" "long" ...
          "public" "static" "final" "float" ...
          "public" "static" "final" "double" ...
          "public" "static" "final" <IDENTIFIER> "<" ...
          "public" "static" "final" <IDENTIFIER> "." ...
          "public" "static" "final" <IDENTIFIER> "[" ...
          "public" "static" "final" <IDENTIFIER> <IDENTIFIER> "(" ...
          <IDENTIFIER> ...
      
      

        Issue Links

          Activity

          Hide
          Graham Carle added a comment -

          Is there a workaround for this?

          Show
          Graham Carle added a comment - Is there a workaround for this?
          Hide
          Simon Brandhof added a comment -

          Hi Graham, I'm afraid the only workaround is not remove the annotation...

          Show
          Simon Brandhof added a comment - Hi Graham, I'm afraid the only workaround is not remove the annotation...
          Hide
          Simon Brandhof added a comment -

          Depends on JAVANCSS-4

          Show
          Simon Brandhof added a comment - Depends on JAVANCSS-4
          Hide
          Hai Phan added a comment -

          I am running sonar 1.5.1 and run into this issues. Look like it is a dead end at the moment.
          Could some one advise a quick fix for it?
          Regards,
          Hai

          Show
          Hai Phan added a comment - I am running sonar 1.5.1 and run into this issues. Look like it is a dead end at the moment. Could some one advise a quick fix for it? Regards, Hai
          Hide
          Freddy Mallet added a comment -

          Hello Hai, we're currently working on javancss but I can't give you any dates of availability. Sorry.
          Freddy

          Show
          Freddy Mallet added a comment - Hello Hai, we're currently working on javancss but I can't give you any dates of availability. Sorry. Freddy
          Hide
          Jim Sellers added a comment -

          The supplied work around is to change the code. Is there any way to disable / turn off the JavaNCSS report?

          Show
          Jim Sellers added a comment - The supplied work around is to change the code. Is there any way to disable / turn off the JavaNCSS report?
          Hide
          Freddy Mallet added a comment -

          There's currently no way to workaround this issue. We're working on a new version of JavaNCSS.

          Show
          Freddy Mallet added a comment - There's currently no way to workaround this issue. We're working on a new version of JavaNCSS .
          Hide
          Jim Sellers added a comment -

          Thanks for the quick response!

          Show
          Jim Sellers added a comment - Thanks for the quick response!

            People

            • Assignee:
              Unassigned
              Reporter:
              Simon Brandhof
            • Votes:
              5 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: