classpath
[Top][All Lists]
Advanced

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

RE: A query on the classloader architecture


From: Jeroen Frijters
Subject: RE: A query on the classloader architecture
Date: Sun, 11 Jul 2004 13:45:48 +0200

David Holmes wrote:
> > 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.

Sure, but, IMHO, if you write a library you cannot assume that your
library won't be loaded by the bootstrap class loader.

Regards,
Jeroen




reply via email to

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