Re: I'm annoyed
Andreas Leitgeb wrote:
Lew <lew@lewscanon.com> wrote:
"Mike Schilling" wrote:
Excpet that it didn't happen "as part of a normal method call or as
part of creating a new instance using the new expression"
Except that it did happen as part of a normal method call.
The only method call, that could itself (not the method, but the call)
cause a class to be loaded, (and that furthermore I can currently think
of) would be a static method on a class that wasn't yet loaded before,
but a static method call isn't a "normal method call" in my own
dictionary.
That's just it - you are applying idiolectic definitions without precedent in
the Java literature.
Then there's of course also the trivial possibility of a
method (of an already loaded class) like loadClass()
explicitly throwing that exception ... that should rather
be referred to as "as part of a normal throws-clause",
not "as part of a normal method call".
Just trying to put my finger on what appears to me the root
confusion...
The root is the Javadoc phrase "a normal method call", which is not a
well-defined term in Java generally, or even a distinction I can recall
encountering in any other context. That leaves it open to interpretation.
Given the lack of a referent for the phrase, it only makes sense to construe
it in context, a contrast to the next phrase in the sentence in the Javadoc,
which indicates "normal method call" as a distinction from constructor calls.
It makes perfect sense to me that the JVM would throw a NoClassDefFoundError
in the loadClass() method call, which is a "normal" method call by anyone's
definition I should think, when it is unable to find the class definition at
run time.
It is weird that it failed to realize that it couldn't find the class when it
was trying to find it at first, and only fails at a later phase, but that is
explainable by the refusal of Windows to honor case distinction in file names.
Nevertheless, by any reasonable interpretation of the Javadocs for
NoClassDefFoundError, its behavior in this context is exactly as promised. It
is the failure to throw the earlier Exception that is bizarre.
--
Lew