23361497, the interface defining the services for the component that should be returned
Are you sure, that the interface and the component should have equal hash codes, even though the components interface is not equal to the component itself? Did you mean perhaps, that I should check loggerInst.debug("here : " + System.identityHashCode( MyComponentImpl.class ) ); instead?
I think he was trying to get you to list the differences between the hashcode for the MyInterface.class, and the one that the proxied component said it implemented.
The thing is that with classloaders, even if there are two classloaders that point to the same exact JAR file, the class hashcode for any one class (or interface) will be different when the two classloaders are not connected in any way.
Proof:
ClassLoader loader1 = new URLClassLoader(new URL[] {"file:otherJar.jar"});
ClassLoader loader2 = new URLClassLoader(new URL[] {"file:otherJar.jar"});Class myClass1 = loader1.loadClass("demo.MyClass");
Class myClass2 = loader2.loadClass("demo.MyClass");assert myClass1.equals(myClass2); // will fail!!! assert myClass1.hashCode() == myClass2.hashCode(); // will fail!!!
Now if loader2 was a child classloader of loader1, then the class returned would be the same. However, they are peers, and completely separate.
This is the type of check that should be made.
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
