private boolean isglobal;
private boolean isenum;
private int enumvalue;
+ private boolean isEnumClass;
private ClassDescriptor cn;
this.isglobal=isglobal;
this.isenum = false;
this.enumvalue = -1;
+ this.isEnumClass = false;
}
public ClassDescriptor getClassDescriptor() {
public String toPrettyStringBrief() {
return td.toPrettyString()+" "+getSymbol();
}
+
+ public void setIsEnumClass() {
+ this.isEnumClass = true;
+ }
+
+ public boolean isEnumClass() {
+ return this.isEnumClass;
+ }
+
}
public boolean isSuper() {
return issuper;
}
-
+
public Long evaluate() {
// if the field is a constant value then OK
eval = null;
public boolean isStatic() {
return ((value&STATIC)!=0);
}
+
+ public boolean isPublic() {
+ return ((value&PUBLIC)!=0);
+ }
public boolean isNative() {
return ((value&NATIVE)!=0);
}
surroundingCls=surroundingCls.getSurroundingDesc();
}
+
+ // check if it is to access an enum field
+ Iterator it_enum = ltd.getClassDesc().getEnum();
+ while(it_enum.hasNext()) {
+ ClassDescriptor ecd = (ClassDescriptor)it_enum.next();
+ if(ecd.getSymbol().equals(ltd.getClassDesc().getSymbol()+"$"+fieldname)) {
+ // this is an enum field access
+ if(!ecd.isStatic() && !ecd.getModifier().isStatic() && !ecd.getModifier().isPublic()) {
+ throw new Error(fieldname + " is not a public/static enum field in "+fan.printNode(0)+" in "+md);
+ }
+ TypeDescriptor tp = new TypeDescriptor(ecd);
+ tp.setClassNameRef();
+ fd=new FieldDescriptor(ecd.getModifier(), tp, ltd.getClassDesc().getSymbol()+"$"+fieldname, null, false);;
+ fd.setIsEnumClass();
+ break;
+ }
+ }
}
if(ltd.getClassDesc().isEnum()) {
public Spiciness1 howHot;
- public enum Spiciness1 {
+ public static enum Spiciness1 {
NOT, FLAMING, MILD, MEDIUM, HOT
} ///:~
System.out.println(howHot);
EnumTest et = new EnumTest();
- et.howHot = Spiciness1.MEDIUM; // EnumTest.Spiciness1.MEDIUM;
+ et.howHot = EnumTest.Spiciness1.MEDIUM;
System.out.println(et.howHot);
}
} /* Output: