Fixed parsing bug: constant fields in annotation classes

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6071 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch 2008-04-27 23:47:59 +00:00
parent 99348a8582
commit 411cf2826f
4 changed files with 79 additions and 77 deletions

View File

@ -1,6 +1,7 @@
???? - 4.2.2:
Fixed false positive in UnusedImports: javadoc comments are parsed to check @see and other tags
Fixed parsing bug: constant fields in annotation classes
April 11, 2008 - 4.2.1:

View File

@ -2076,7 +2076,7 @@ void AnnotationTypeMemberDeclaration():
|
ClassOrInterfaceDeclaration(modifiers)
|
LOOKAHEAD (<IDENTIFIER> <IDENTIFIER>) EnumDeclaration(modifiers)
LOOKAHEAD(3) EnumDeclaration(modifiers)
|
AnnotationTypeDeclaration(modifiers)
|

View File

@ -117,6 +117,8 @@ public class JDKVersionTest {
p.CompilationUnit();
p = new TargetJDK1_5().createParser(new StringReader(ANNOTATIONS_BUG));
p.CompilationUnit();
p = new TargetJDK1_5().createParser(new StringReader(CONSTANT_FIELD_IN_ANNOTATION_BUG));
p.CompilationUnit();
p = new TargetJDK1_5().createParser(new StringReader(GENERIC_IN_FIELD));
p.CompilationUnit();
}
@ -286,6 +288,11 @@ public class JDKVersionTest {
"public @interface Foo {" + PMD.EOL +
"}";
private static final String CONSTANT_FIELD_IN_ANNOTATION_BUG =
"public @interface Foo {" + PMD.EOL +
" String CONST = \"foo\";" + PMD.EOL +
"}";
private static final String GENERIC_IN_FIELD =
"public class Foo {" + PMD.EOL +
" Class<Double> foo = (Class<Double>)clazz;" + PMD.EOL +

File diff suppressed because it is too large Load Diff