Bug 70 : weaver and inheritance results in IllegalAccessError
Priority 
High
Reported Version 
 
Logged By 
imario
Status 
Fixed
Fixed Version 
1.1.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
15/02/2009
Updated 
15/02/2009
Type 
Bug
 
Attachments 
No attachments

I use the ebean runtime weaver to enhance the entities, now when trying to query the database the following exception will be thrown:

Exception in thread "main" java.lang.IllegalAccessError: tried to access field com.ops.Premium.model.po.Zone.sid from class com.ops.Premium.model.po.ZoneManual
at com.ops.Premium.model.po.ZoneManual._ebean_setField(ZoneManual.java:1)
at com.avaje.ebean.server.reflect.EnhanceBeanReflect$Setter.set(EnhanceBeanReflect.java:110)
at com.avaje.ebean.server.deploy.BeanProperty.setValue(BeanProperty.java:524)
at com.avaje.ebean.server.deploy.BeanProperty.readSet(BeanProperty.java:391)


the field is private in Zone and has public getter/setter. If I change the property from private to public it starts working.
Making them public is not really an option, no?

I think we need to set setAccessible on the field, no?
I am not yet an expert on generating bytecode, would be great if you could look at that.

Thanks!

 
Rob 16 Feb 00:18
How about package protected

I think it will work if you make sid package protected (rather than private). No you should not make it public.

In regards getting it to work as private, I'll have a look into that. I think I see the problem ...

imario 16 Feb 16:04
package protected did the trick

Yes, "package protected" did the trick. This is something I can live with. Being able to stick with "private" would be nice, though, not a high priority issue any more I think.

Thanks!

Rob 19 Feb 08:21
Okay.

I think I'll get out v1.0.3 first... and then come back to this one.

In the meantime... people have to use package protected (can't use private).

Rob 12 Mar 08:30
Fixed in HEAD

I believe this is now fixed.

woResponse

Upload a file