avoid warning of unused import in generated ParserTokenManager
@@ -104,6 +104,7 @@ public class LexGen extends CodeGenerator implements JavaCCParserConstants
void PrintClassHead()
{
int i, j;
+ boolean bHasImport = false;
List<String> tn = new ArrayList<String>(toolNames);
tn.add(toolName);
@@ -119,6 +120,8 @@ public class LexGen extends CodeGenerator implements JavaCCParserConstants
kind = ((Token)cu_to_insertion_point_1.get(l)).kind;
if(kind == PACKAGE || kind == IMPORT) {
+ if (kind == IMPORT)
+ bHasImport = true;
for (; i < cu_to_insertion_point_1.size(); i++) {
kind = ((Token)cu_to_insertion_point_1.get(i)).kind;
if (kind == SEMICOLON ||
@@ -147,6 +150,10 @@ public class LexGen extends CodeGenerator implements JavaCCParserConstants
genCodeLine("");
genCodeLine("/** Token Manager. */");
+
+ if (bHasImport && Options.getGenerateAnnotations()) {
+ genCodeLine("@SuppressWarnings (\"unused\")");
+ }
if(Options.getSupportClassVisibilityPublic()) {
//genModifier("public ");
genModifier("public ");
