Fixes #793 [java] Parser error with private method in nested classes in interfaces
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
/**
|
||||
* Fixes #793 [java] Parser error with private method in nested classes in interfaces
|
||||
* Andreas Dangel 12/2017
|
||||
*====================================================================
|
||||
* Add support for Java 9 changes:
|
||||
* Private interface methods are only allowed with java9.
|
||||
* A single underscore "_" is an invalid identifier in java9.
|
||||
@ -340,6 +343,7 @@ public class JavaParser {
|
||||
* Keeps track whether we are dealing with an interface or not. Needed since the tree is
|
||||
* is not fully constructed yet, when we check for private interface methods.
|
||||
* The flag is updated, if entering ClassOrInterfaceDeclaration and reset when leaving.
|
||||
* The flag is also reset, if entering a anonymous inner class.
|
||||
*/
|
||||
private boolean inInterface = false;
|
||||
private void checkForBadPrivateInterfaceMethod(ASTMethodDeclaration node) {
|
||||
@ -2009,7 +2013,7 @@ void AllocationExpression():
|
||||
(
|
||||
ArrayDimsAndInits()
|
||||
|
|
||||
Arguments() [ ClassOrInterfaceBody() ]
|
||||
Arguments() [ {inInterface = false;} ClassOrInterfaceBody() ]
|
||||
)
|
||||
)
|
||||
{ checkForBadAnonymousDiamondUsage(); }
|
||||
|
Reference in New Issue
Block a user