Please use Class instead of String. That comes closesed to what you need. String is definately not type-save. Think of compile-time checking, autocompletition, refactoring etc.

Christian

On Mon, 12 Dec 2005 17:07:43 +0100, Eelco Hillenius <[EMAIL PROTECTED]> wrote:

Sounds like we have to go for these darn strings then.

On 12/12/05, Johan Compagner <[EMAIL PROTECTED]> wrote:
see the javadoc:

  /**
* Gets the package for this class. The class loader of this class is
used
* to find the package. If the class was loaded by the bootstrap class * loader the set of packages loaded from CLASSPATH is searched to find
the
     * package of the class. Null is returned if no package object was
created
     * by the class loader of this class.
     *
* <p> Packages have attributes for versions and specifications only if
the
* information was defined in the manifests that accompany the classes,
and
* if the class loader created the package instance with the attributes
     * from the manifest.
     *
     * @return the package of the class, or null if no package
     *         information is available from the archive or codebase.
     */

So a Package object doesn't have to be created that is completely up to the
ClassLoader that loads the class.

And yes we already stumbled into this some months ago in wicket!
Remember the i think ResourceLoading stuff where we also did give a Package
object as a method parameter.
That also suddenly failed because of the null that was given in that
situation. I though it had something to do with Oscar classloaders
But i can be mistaken about that.

I don't care if we give a big warning about this, but then i want to be able
to do it with a string or a class
So that i do get package mounting without needing to give a Package object.

johan



On 12/12/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
>
> So, do you know when actually Package.getPackageName fails? I thought
> it fails when the class is not loaded yet. Which can be cercumvented
> by calling that class first like MyClass.getPackage().
>
> Anyway, I'm not happy with that package behaviour either, but Strings
> also suck big time because they don't refactor well. And providing a
> class parameter while you need the package is imo just a lousy
> contract. I'd rather put a big warning there and let users be
> responsibility. Or use the string. Maybe that's best.
>
> Eelco
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
> _______________________________________________
> Wicket-develop mailing list
> [email protected]
>
https://lists.sourceforge.net/lists/listinfo/wicket-develop
>




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop



--
Christian Essl
        

        
                
___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to