Hi,
some time ago, I discovered the following problem with Enums and WO bindings
(broken down to a simple example):
package com.foo.bar;
public class MyClass {
public static enum Status {
one { @Override public String description() { return "eins"; } },
two { @Override public String description() { return "zwei"; } };
public abstract String description();
}
}
While this works nicely in all Java code, WO bindings will not see the
overridden description() implementations. At least not when using Java packages
(it seems to work if everything is in the default package, but that doesn't
help me). You get an error like:
java.lang.IllegalAccessException: Class
com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1 can not access
a member of class com.foo.bar.MyClass$Status$1 with modifiers "public"
or, if using JRebel, you get
java.lang.IllegalAccessException: Class<?>
com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1 can not access
com.foo.bar.MyClass$Status$1!
My current workaround:
package com.foo.bar;
public class MyClass {
public static enum Status {
one { @Override String descriptionImpl() { return "eins"; } },
two { @Override String descriptionImpl() { return "zwei"; } };
abstract String descriptionImpl();
public String description() { return descriptionImpl(); }
}
}
which works but is ugly. Now I'm about to implement another Enum with a lot of
methods and it bothers me. Anyone an idea how to improve the situation?
Thanks
Maik
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]