Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] constants in case expressions

Good catch:  https://bugs.eclipse.org/bugs/show_bug.cgi?id=87525

------------Original Message------------
From: Irum Godil <softwarengineer2004@xxxxxxxxx>
To: "AJDT USER" <aspectj-users@xxxxxxxxxxx>
Date: Sun, Mar-13-2005 7:51 PM
Subject: [aspectj-users] constants in case expressions
Hi, 
I have the following code structure: 

package a; 

public class D { 
static final int D_O       = 1;

...}

In the same package A i have another class: 

package A; 
public class L { 

 boolean closeLog(int closemode) {
            switch (closemode) {

              case D.D_O :
                    lLog.shutdown();
                    break;
              }
           }
 }
.. }

All is fine here when I compile. Now, I want to refactor the above closeLog method. I define an aspect as follows: 

//The aspect is in a different package
package B

privileged aspect C { 
  //pointcut definitions...

 boolean around(Logger l, int closemode): targetLogger(l) && closeLogExec(closemode)
    {
               ...
            switch (closemode) {
                case Database.D_O :
                    l.lLog.shutdown();
                    break;
            }
}

Now, when I compile I keep getting error: 
"case expressions must be constant expressions" on the line: "case Database.D_O :"

I do not know what I am doing wrong. My expression Database.D_O is final i.e. constant, then why am getting this error? I am using JDK 1.4 and Eclipse 3.0. Any help will be appreciated. 

thanks. 


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



Back to the top