Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What about the API for Class?



Nicholas Rinard wrote:

>I'm trying to access this functionality thru the Class.getResource()
>method, which is supposed to delegate the call to
>ClassLoader.findResource(). ...
> ...
>That whole part about modifying the name of the resource doesn't seem to
>happen. The resulting call to ClassLoader.findResource() gives the same
>name as passed to Class.getResource(). I also looked at the code for those
>methods, and indeed they don't do any modifications on the name at all.

The source for 1.4.2's Class.getResource(String) shows this line at the top
of the method:
  name = resolveName(name);

where resolveName() is a private method that does the transformation
described in the API docs.  The name is then passed to the ClassLoader, as
described in the API docs.

The method being called directly is ClassLoader.getResource(), though, NOT
findResource() as you wrote.  Eventually findResource() may be called, and
the code I'm looking at shows it getting the same name arg as was passed to
getResource().  See ClassLoader.getResource().

I see the same call to resolveName() in the Class.java sources from 1.3.1,
1.2, and 1.1.7.  I also see the same ClassLoader code everywhere except
1.1.7 (no findResource() in JDK 1.1).  If you're not seeing that, please
describe which version of source you're looking at, and where it came from.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.