Hi Kieran, makes no difference.
java.lang.IllegalAccessException: Class<?> com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1 can not access com.foo.bar.Status$1! Maik Am 07.06.2013 um 11:40 schrieb Kieran Kelleher <[email protected]>: > Declare the enum as its own java class file and see if that works: > > MyClass.java > public class MyClass { > > } > > Status.java > public enum Status { > one { @Override public String description() { return "eins"; } }, > two { @Override public String description() { return "zwei"; } }; > public abstract String description(); > } > > > Regards, Kieran. > (Sent from my iPhone) > > > On Jun 7, 2013, at 3:58 AM, Musall Maik <[email protected]> wrote: > >> 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/kelleherk%40gmail.com >> >> This email sent to [email protected] _______________________________________________ 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]
