[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: A query on the classloader architecture

From: David Holmes
Subject: RE: A query on the classloader architecture
Date: Sun, 11 Jul 2004 21:23:07 +1000

> Archie Cobbs wrote:
> The Sun API spec clearly states that Class.getClassLoader() may return
> null, and in fact MUST return null for primitive type Class objects.
> So why worry about obviously buggy software?

There are only two cases where getClassLoader is allowed to return null:

a) it may return null for a bootstrap loader so represented; and
b) it must return null when invoked in the Class object for a primitive type
or void.

Consequently application code should have every right to assert that
"this.getClass().getClassLoader()" is never null.

David Holmes

reply via email to

[Prev in Thread] Current Thread [Next in Thread]