Enum method overrides and WO bindings
Enum method overrides and WO bindings
- Subject: Enum method overrides and WO bindings
- From: Musall Maik <email@hidden>
- Date: Fri, 07 Jun 2013 09:58:03 +0200
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden