On Fri, 2005-07-15 at 17:29 +0200, Ugo Cei wrote: > > those methods are inherited from AbstractDatatype, where they are > declared as "protected". Thus, I was painfully reminded that protected > members in Java are visible not only to subclasses, but to all other > classes in the same package as well! As long as StringTypeBuilder is in > the same package as AbstractDatatype, all is well, but as soon as I > copy it to com.example.mypackage.MyTypeBuilder, it doesn't compile > anymore.
I think this might be a good opportunity to bring up again a similar problem with creating jxpath bindings outside the o.a.c.forms.binding package. I had posted this problem on this list several months ago with no reply. Here is the message again: > On Tue, 2005-01-04 at 14:43 -0700, Jason Johnston wrote: > Hi folks-- I'm trying to create a custom binding by extending > JXPathBindingBase and JXPathBindingBuilderBase for the binding and > binding builder respectively. My classes, of course, live in a > different package than o.a.c.forms.binding. > > My builder class is able to access the protected inner class > JXPathBindingBuilderBase.CommonAttributes just fine, because it is a > direct subclass of JXPathBindingBuilderBase. But the binding class > fails because it also needs access to CommonAttributes (see the > JXPathBindingBase constructor), but neither extends nor resides in the > same package as JXPathBindingBuilderBase so CommonAttributes is not > visible. > > Anyone know of a reason why CommonAttributes is protected rather than > public? Any objections to making it public? It's not the exact same problem as Ugo is describing but the end effect is the same... it is impossible to create a custom CForms component in a package other than o.a.c.forms. Perhaps both Ugo's issue and mine could be fixed at the same time. --Jason