[java] Allow more than 1 annotation in local classes

- This fixes #208
This commit is contained in:
Juan Martín Sotuyo Dodero
2017-01-25 14:42:25 -03:00
committed by Andreas Dangel
parent 926d1c3fbc
commit c53e1790e1
3 changed files with 23 additions and 1 deletions

View File

@ -1,4 +1,9 @@
/**
* Allow local classes to carry more than one annotation.
* Bug #208
*
* Juan Martin Sotuyo Dodero 01/2017
*====================================================================
* Change lookahead for AnnotationMethodDeclaration in AnnotationTypeMemberDeclaration.
* Bug #206
*
@ -1978,7 +1983,7 @@ void BlockStatement():
ClassOrInterfaceDeclaration, but that seems like a hack that
could break other things...
*/
LOOKAHEAD( [Annotation()] ["final"|"abstract"] "class") [Annotation()] ClassOrInterfaceDeclaration(0)
LOOKAHEAD( (Annotation())* ["final"|"abstract"] "class") (Annotation())* ClassOrInterfaceDeclaration(0)
}
void LocalVariableDeclaration() :

View File

@ -152,6 +152,12 @@ public class ParserCornersTest extends ParserTst {
parseJava18(code);
}
@Test
public void testGitHubBug208ParseError() throws Exception {
String c = IOUtils.toString(this.getClass().getResourceAsStream("GitHubBug208.java"));
parseJava15(c);
}
/**
* This triggered bug #1484 UnusedLocalVariable - false positive - parenthesis
* @throws Exception

View File

@ -0,0 +1,11 @@
public class GitHubBug208 {
public void testMethod() {
@Lazy
@Configuration
class LocalClass {
@Bean Object foo() {
return null;
}
}
}
}