• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Enum method overrides and WO bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enum method overrides and WO bindings


  • Subject: Re: Enum method overrides and WO bindings
  • From: Musall Maik <email@hidden>
  • Date: Fri, 07 Jun 2013 11:51:07 +0200

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@hidden>:

> 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@hidden> 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@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden


 _______________________________________________
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

References: 
 >Enum method overrides and WO bindings (From: Musall Maik <email@hidden>)
 >Re: Enum method overrides and WO bindings (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: Enum method overrides and WO bindings
  • Next by Date: Re: Enum method overrides and WO bindings
  • Previous by thread: Re: Enum method overrides and WO bindings
  • Next by thread: Re: Enum method overrides and WO bindings
  • Index(es):
    • Date
    • Thread