Simple enum iteration fails to compile on java


(Marko Bohanec) #1

Why does the following code fail to compile on java? I am getting “(E0) Internal error: Object reference not set to an instance of an object.”

namespace EnumJava;

interface

uses
  java.util;

type
  ConsoleApp = class
  public
    class method Main(args: array of String);
  end;

type
  MyEnum = public enum (Bla, Ble, Blu);

implementation

class method ConsoleApp.Main(args: array of String);
begin
  for e: MyEnum := MyEnum.Bla to MyEnum.Blu do
    writeLn(e.ToString);
end;

end.

(RemObjects) #2

Thanks, logged as bugs://78522


(Carlo Kok) #3

This properly fails now, java enums aren’t iterable, unless you use integer enums,


(RemObjects) #4

bugs://78522 got closed with status fixed.