Skip to content

Commit

Permalink
Merge pull request #2904 from mernst/parameter-varargs-fix
Browse files Browse the repository at this point in the history
Fix LOOKAHEAD for ReferenceType; fixes #2879
  • Loading branch information
MysterAitch authored Nov 12, 2020
2 parents e3240fc + e931cdd commit 5c2646a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -308,4 +308,13 @@ void parseTypeDeclaration() {
void xxx(){
YamlPrinter.print(StaticJavaParser.parse("class X{}"));
}

@Test
void issue2879() {
StaticJavaParser.parse(
"public class Test {" +
" public void method(int @MyAnno ... param) {}" +
"}" +
"@Target(java.lang.annotation.ElementType.TYPE_USE) @interface MyAnno {}");
}
}
2 changes: 1 addition & 1 deletion javaparser-core/src/main/javacc/java.jj
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ Type Type(NodeList<AnnotationExpr> annotations):
}
{
(
LOOKAHEAD(2) ret = ReferenceType(annotations)
LOOKAHEAD(PrimitiveType(annotations) Annotations() "[" | ClassOrInterfaceType(annotations)) ret = ReferenceType(annotations)
|
ret = PrimitiveType(annotations )
)
Expand Down

0 comments on commit 5c2646a

Please sign in to comment.