Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old June 27th, 2008, 05:17 PM
Mikhail Teterin
Guest
 
Posts: n/a
Default Reflection: setting public fields of an object from another package

Hello!

I have a method, that is supposed to set fields in an object passed to it.
Any object -- the names of the fields are determined at run-time, the only
(obvious) requirement is, the fields must be "public".

This worked perfectly fine, until I put that method's class into a package
of its own.

Now, when the method is given an object of a class /from another package/
the field-setting fails:

Field CDS_REPL is not accessible: java.lang.IllegalAccessException: Class foo.bar.BarQueue can not access a member of class foo.dang.Meow with modifiers "public"

How can I overcome this? Is there something more permissive than "public",
or, perhaps, I can, somehow, explicitly grant foo.bar.BarQueue the right
to modify public fields the callers?

Thanks!

-mi



 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.