facebook

JSP Compile errors – case expressions (Linux)

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #197065 Reply

    chsu
    Member

    I’m running the Linux Workbench with Eclipse 2.1.1. Am running into a compile error that doesn’t happen when compiling with the Windows MyEclipse version. (Also, it doesn’t happen when the same code is in a .java file outside of Eclipse — on the same platform).

    Error is:
    “case expressions must be constant expressions”

    and occurs when the JSP has a line like this:

    int iResult = 0;
    switch (iResult) {
    case MyClass.MY_CONSTANT:
    break;
    }

    where MyClass.MY_CONSTANT is defined as:

    public static int MY_CONSTANT = 0;

    This is the ONLY error the JSPs are getting, and all case expressions generate the same error. It doesn’t seem to be a path issue.

    Any clues would be much appreciated!

    Christine

    #197067 Reply

    Scott Anderson
    Participant

    Christine,

    try:
    public static final int MY_CONSTANT=0;

    Just because it’s static, doesn’t mean it’s a constant. 🙂

    –Scott
    MyEclipse Support

    #197068 Reply

    chsu
    Member

    Whoops!! So sorry! It actually DOES have a final in the definition.

    public static final int MY_CONSTANT = 0;

    That’s what I get for not cutting and pasting.

    Any ideas if that’s the case?

    #197071 Reply

    Scott Anderson
    Participant

    Well, I agree. It doesn’t happen with the Windows version. It may be a JDK issue. What JDK are you using on Linux? Can you try swapping in a different one for the workspace default? Perhaps 1.4.1_03?

    –Scott
    MyEclipse Support

    #197163 Reply

    chsu
    Member

    I was using 1.4.2 and just changed it to use 1.4.1_04. Still the same thing. How can I make the generated .java files stick around so I can try to compile it by hand after they are done?

    Thanks.

    #197166 Reply

    Scott Anderson
    Participant

    Well, you really can’t make the files stick around. When you changed the JDK, I assume you made it the default within your workspace?

    If there is only this one instance of the problem, have you thought about working around it by using if..else if?

    –Scott
    MyEclipse Support

    #197261 Reply

    chsu
    Member

    FWIW, command-line compiling the JSP with Jasper and then compiling the .java file with javac (1.4.2) works fine. The only time it doesn’t work is when I’m compiling with MyEclipse, so I think the problem lies there somewhere.

    There are a number of instances where this compile error occurs (and it’s the only error I get), so I can’t change it to an if-then-else.

    Is it possible that it’s a Workbench bug?

    #197263 Reply

    Scott Anderson
    Participant

    Is it possible that it’s a Workbench bug?

    It could be, but it’s odd that it’s only on Linux. Is there anything in the log file (<workspace>/.metadata/.log). If so, could you mail it to us?

    Also, did you update to the 2.5.1 release by any chance and try that? It had a JSP fix for Linux, but it wasn’t this one. I was just wondering if it might have addressed it as a side-effect.

    Once I hear back on these questions I’ll place it into our defect tracking system to force it to be investigated on Linux in depth. Also, for the defect log, which version of Linux are you using?

    –Scott
    MyEclipse Support

    #197281 Reply

    chsu
    Member

    I just updated to 2.5.1 and it still happens. I also was able to re-create the error using just one Test.java file with a constant and a Test.jsp file referencing it.

    My Linux version is Redhat 9. I will e-mail the .metadata/.log file as well as the test source.

    Thanks!

    #197284 Reply

    Scott Anderson
    Participant

    Sorry to hear it still exists, but if we can recreate it on RedHat internally, we can fix it. The things you’re emailing will allow us to address it in the next service release.

    –Scott
    MyEclipse Support

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: JSP Compile errors – case expressions (Linux)

You must be logged in to post in the forum log in