PROBLEM: JvmTypeReference to Enum within a class does NOT work [message #744098] |
Fri, 21 October 2011 23:31 |
Erik Messages: 3 Registered: October 2011 |
Junior Member |
|
|
I have the following (partly) grammar:
Import:
'import' importedNamespace=QualifiedNameWithWildCard ';'
;
QualifiedNameWithWildCard:
QualifiedName ('.' '*')?
;
Attribute:
name = ID ':' type = JvmTypeReference ';'
;
It accepts the creation of an attribute, but there is a problem with the JvmTypeReference to an enum. Referring to an enum that is in a file of its own works fine, after importing it. But when trying to refer to an enum within an (abstract) class, both public does not work.
Example Code:
AbstractClass.java does NOT work
public abstract class AbstractClass {
public enum InnerEnum{
One(1),
Two(2)
private int number = -1;
private InnerEnum(int code){
this.number = code;
}
public int getNumber(){
return number;
}
}
}
and this DOES work:
InnerEnum.java
public enum InnerEnum{
One(1),
Two(2)
private int number = -1;
private InnerEnum(int code){
this.number = code;
}
public int getNumber(){
return number;
}
}
How can I change my syntax to allow the InnerEnum to be accepted as the type for the Attribute?
Thanks a lot,
Erik
[Updated on: Fri, 21 October 2011 23:45] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03034 seconds