forked from phoedos/pmd
pmd: fixed #1007 Parse Exception with annotation
This commit is contained in:
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user