ThaisaMirely / javaparser

Automatically exported from code.google.com/p/javaparser
0 stars 0 forks source link

Error working with enum in Java 1.4.2 source code #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a block statement visitor to traverse a piece of Java source code

What is the expected output? What do you see instead?
The java file containing an enum keyword is parsed as normal

What version of the product are you using? On what operating system?
Product - 1.0.8
Operating System - Windows 7

Please provide any additional information below.
I am using Java 1.4.2 where enum is not a keyword and could be used in the 
source.

Is there any resolution to this?

The declaration was:
            Enumeration enum = req.getParameterNames();

The exception thrown was:
japa.parser.ParseException: Encountered " "enum" "enum "" at line 2685, column 
25.
Was expecting one of:
    "(" ...
    ";" ...
    "=" ...
    "++" ...
    "--" ...
    "+=" ...
    "-=" ...
    "*=" ...
    "/=" ...
    "&=" ...
    "|=" ...
    "^=" ...
    "%=" ...
    "<<=" ...
    ">>=" ...
    ">>>=" ...

Original issue reported on code.google.com by ohchengp...@gmail.com on 7 Dec 2011 at 5:38

Attachments:

GoogleCodeExporter commented 9 years ago
Currently is not possible to specify the Java version of the file being parsed.
This parser uses reserved words from Java 1.5 and "enum" is a reserved word in 
this version.

There is no plan for supporting older versions of Java.

Issue closed.

Original comment by jges...@gmail.com on 13 Dec 2011 at 11:31