1

I am trying to implement my own class loader, but I have trouble with the resource part - the javadoc on these methods is very brief, and I'm wondering about what the correct behavior for these methods should be.

In particular I'm asking about findResource(name) and findResorces(name).

I presume findResource(name) should return the first resource found with a matching name. But I haven't found any concrete documentation how a match should be detected. Must the resource name be always qualified, or are unqualified names allowed. Also, must it be case-sensitive or no (and if its case insensitive, what locale would be appropiate to detect matches)? Same basically with findResources(name).

So far my ClassLoader works, but I am concerned that it does not cover every possible way to address a resource.

Any examples for class loaders I have found (there are many tutorials) do not cover resources in detail (most don't even touch the subject at all). Neither the JLS nor the VMS seem to talk about resource loading anywhere.

So, the my question is: Whats the contract for these methods? What kind of behavior is correct?

Durandal
  • 19,919
  • 4
  • 36
  • 70
  • Honestly, these are often things that may depend on your classloader itself, though names with it are generally qualified where it doesn't make sense to depend on the specific classloader's design. – nanofarad Nov 19 '13 at 20:33
  • Did you examine the default library classloader source? – Jim Garrison Nov 19 '13 at 21:37
  • @JimGarrison Which one do you mean? URLClassLoader? Unfortunately it delegates to sun.misc.URLClassPath, for which no source is provided. – Durandal Nov 20 '13 at 15:32

0 Answers0