Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 31.52
-
Component/s: None
-
Labels:None
-
Environment:javancss 29.50
-
Number of attachments :
Description
The following code
public interface InterfaceWithAnnotation { @Deprecated public static final String MY_PARAM = "param"; }
causes the error :
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> ...
I originally started down a path of trying to merge the 1.5 JavaCC grammar with the Java 1.1 grammar JavaNCSS uses, but that turned into a mess fast, and since I really only wanted to fix this particular problem so I could use JavaNCSS on interfaces with functional annotations (JAX-WS/JAXB), I instead took the lazy way out and just made a patch to fix the very specific issue with annotations on interface field declarations.
Attached is the subversion patch to allow annotations on interface field declarations. I created the patch against trunk revision 132.
I tested the patch against the sample interface InterfaceWithAnnotation from this issue, and my project with annotated interface fields, but didn't write a unit test.