From ab9e189988c47ed01dca87037863b70ffd547b5b Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Mon, 16 Apr 2018 18:05:53 -0500 Subject: [PATCH] Fix for index out-of-bounds on incomplete static import #412 --- .../src/org/apache/groovy/parser/antlr4/AstBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/org.codehaus.groovy26/src/org/apache/groovy/parser/antlr4/AstBuilder.java b/base/org.codehaus.groovy26/src/org/apache/groovy/parser/antlr4/AstBuilder.java index db840ed31e..d8b764cf1e 100644 --- a/base/org.codehaus.groovy26/src/org/apache/groovy/parser/antlr4/AstBuilder.java +++ b/base/org.codehaus.groovy26/src/org/apache/groovy/parser/antlr4/AstBuilder.java @@ -710,7 +710,7 @@ public ImportNode visitImportDeclaration(ImportDeclarationContext ctx) { // GRECLIPSE edit //configureAST(classNode, ctx); ASTNode typeNode = PositionConfigureUtils.configureAST(classNode instanceof ImmutableClassNode ? new ClassExpression(classNode) : classNode, ctx.qualifiedName()); - PositionConfigureUtils.configureEndPosition(typeNode, identifierList.get(identifierListSize - 2).getStop()); + PositionConfigureUtils.configureEndPosition(typeNode, identifierList.get(Math.max(0, identifierListSize - 2)).getStop()); configureAST(typeNode); // GRECLIPSE end