pmd: fixed #1007 Parse Exception with annotation

This commit is contained in:
Andreas Dangel
2013-01-26 14:28:29 +01:00
parent 26fa85a9fa
commit 61c0b4ea7f
3 changed files with 23 additions and 2 deletions

View File

@ -2,6 +2,7 @@
Fixed bug 878: False positive: UnusedFormalParameter for abstract methods
Fixed bug 913: SignatureDeclareThrowsException is raised twice
Fixed bug 1007: Parse Exception with annotation
Fixed bug 1012: False positive: Useless parentheses.
Fixed bug 1020: Parsing Error
Fixed bug 1026: PMD doesn't handle 'value =' in SuppressWarnings annotation

View File

@ -1,4 +1,8 @@
/**
* Fix ForStatement to allow Annotations within the initializer.
*
* Andreas Dangel 01/2013
* ===================================================================
* Fix wrong consumption of modifiers (e.g. "final") in a for-each loop.
*
* Andreas Dangel 12/2012
@ -1932,7 +1936,7 @@ void ForStatement() :
void ForInit() :
{}
{
LOOKAHEAD( [ "final" ] Type() <IDENTIFIER> )
LOOKAHEAD( LocalVariableDeclaration() )
LocalVariableDeclaration()
|
StatementExpressionList()

View File

@ -123,3 +123,19 @@ class SimpleBeanUser2 extends SimpleBeanUser {
}});
}
}
/*
* Test case for bug #1007 Parse Exception with annotation
*/
class TestParseAnnototation {
void parse() {
for (@SuppressWarnings("unchecked") int i = 0; i < 10; i++) {
}
for (@SuppressWarnings("unchecked") Iterator it = Fachabteilung.values().iterator(); it.hasNext();) {
}
List<String> l = new ArrayList<String>();
for (@SuppressWarnings("unchecked") String s : l) {
}
}
}