Java enums gets converted to Integers inside of List

Hi,
I encountered a problem and im not sure how to fix it.

Given types:
type

OxygeneEnum = public enum (
  A,
  B,
  C
);

OxygeneEnumWraper = class
public
  method getEnumList : List<OxygeneEnum>;
end;

implementation

method OxygeneEnumWraper.getEnumList: List<OxygeneEnum>;
begin
  Result := ArrayList<OxygeneEnum>.create;
end;

then i use code like that:

List<OxygeneEnum> oxygeneEnumList = new OxygeneEnumWraper().getEnumList();

it works Ok inside of an oxygene but whenever i compile it to java.jar and use it as a library it gives error:

Error says its incompatible types, so i diged more and found out that getEnumList returns List instead of List as it should

Is there any work around this problem?

I believe if you want your enums to be compatible with non-Elements Java compiler(s), you will have to explicitly specify their base type as java.lang.Enum, as below. Otherwise (and this is a recent change/fix) the compiler will favor cross-platform compatibility over Java compatibility, and use Integer base types for enums.

OxygeneEnum = public enum (
  A,
  B,
  C
) of java.land.ENum;

Yeah but then i cant use it as a set, can i?

OxygeneEnumSet = public set of OxygeneEnum

I expect you should. but if not, that might just be a limitation to live with (set of is not a Java runtime nave type, it’s an Oxygene thing). If set of does not work with java.lang.Enum enums, it also wouldn’t have worded before our fix (when every enum was based on java.lang.Enum).

Well im not able to use it now. I am not sure if we used it before.

I don’t recall for sure, but I think one of the reasons for the change was to support set of, so, yeah, it might as well be a limitation. @ck, do you recall?

Right. The only thing we changed is the default. And with “of enum” sets don’t work. That said, on the Java site you should get a List<int> on the other end as Java doesn’t support enums like this properly.

So basicly thats the way it is and it cant be changed.
Ok, thanks for clarification.

The thing is that inside a single project I probably can figure out that information. Outside, there’s no way to get the integeral value without running it (which doesn’t happen during compile of course). Due to the way this is structured.