Hi Dave,
In my experience, there's no way around this. You have to either add
public accessors or make iVars public. cug's suggestion of keeping a
dictionary for simple bindings is a good one. I think it's good
practice to create accessors for everything (says the guy who's been
doing it the other way for years up until the last few months). It's
a pain in the ass at first, but once you get into the rhythm of doing
it, it doesn't feel like a big deal and you start to notice nice
little side effects here and there. I have a ton of code that has to
be refactored, so I'm leaving everything in the default package in
that code for now, and adding the accessors as I go. Once I have all
that in place for existing code, I will go back and move things into
packages. New code that I write goes into packages right away
whenever possible. It's a pain, but all that code will have to be in
packages when the move to java 6 happens, because I believe java 6
requires everything to be in packages.
Mark
On Aug 16, 2007, at 10:02 AM, David Avendasora wrote:
> Hi all,
>
> I know that this question has come up before, but I can't seem to
> find a definitive answer.
>
> I just migrated my project from Xcode to Eclipse (yeah!). I have
> organized all my component .java files into packages, and now all
> my components are complaining about not being able to access the
> protected attributes in the Java classes. Is this a bug or a feature?
>
> I would think that the Component for a given Java Class would be
> considered as being in the same package. Even if I mimic the
> package structure of the Sources directory in the Components
> directory, it still does not see them as being in the same package.
>
> I would really rather NOT change all the protected attributes to
> "public". I could create public accessors for them, but this seems
> a bit extreme when the related component should "be" in the same
> package.
>
> I would be happy to add the answer to this to the WOProject/WOLips/
> Tutorials/Editing WOComponents documentation.
>
> Thanks,
>
> Dave
>
This archive was generated by hypermail 2.0.0 : Thu Aug 16 2007 - 10:49:11 EDT