From 7c0d5cd726394d8ea403a057f7ddec220a851c0e Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 22 Feb 2012 15:44:17 -0600 Subject: [PATCH] Fix use of v3 runtime generics --- tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java b/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java index 824346574..bf23a6e02 100644 --- a/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java +++ b/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java @@ -159,7 +159,7 @@ public class GrammarTransformPipeline { tokensRoot.g = rootGrammar; root.insertChild(1, tokensRoot); // ^(GRAMMAR ID TOKENS...) } - tokensRoot.addChildren(imp_tokensRoot.getChildren()); + tokensRoot.addChildren(Arrays.asList(imp_tokensRoot.getChildren().toArray(new Tree[0]))); } List all_actionRoots = new ArrayList(); @@ -263,7 +263,7 @@ public class GrammarTransformPipeline { GrammarRootAST combinedAST = combinedGrammar.ast; //tool.log("grammar", "before="+combinedAST.toStringTree()); GrammarASTAdaptor adaptor = new GrammarASTAdaptor(combinedAST.token.getInputStream()); - List elements = combinedAST.getChildren(); + GrammarAST[] elements = combinedAST.getChildren().toArray(new GrammarAST[0]); // MAKE A GRAMMAR ROOT and ID String lexerName = combinedAST.getChild(0).getText()+"Lexer"; @@ -279,7 +279,7 @@ public class GrammarTransformPipeline { if ( optionsRoot!=null ) { GrammarAST lexerOptionsRoot = (GrammarAST)adaptor.dupNode(optionsRoot); lexerAST.addChild(lexerOptionsRoot); - List options = optionsRoot.getChildren(); + GrammarAST[] options = optionsRoot.getChildren().toArray(new GrammarAST[0]); for (GrammarAST o : options) { String optionName = o.getChild(0).getText(); if ( !Grammar.doNotCopyOptionsToLexer.contains(optionName) ) { @@ -313,7 +313,7 @@ public class GrammarTransformPipeline { (GrammarAST)adaptor.create(ANTLRParser.RULES, "RULES"); lexerAST.addChild(lexerRulesRoot); List rulesWeMoved = new ArrayList(); - List rules = combinedRulesRoot.getChildren(); + GrammarASTWithOptions[] rules = combinedRulesRoot.getChildren().toArray(new GrammarASTWithOptions[0]); if ( rules!=null ) { for (GrammarASTWithOptions r : rules) { String ruleName = r.getChild(0).getText();