Summary: | AntClassLoader returns false loader in getParent() | ||
---|---|---|---|
Product: | Ant | Reporter: | Rainer Noack <rainer> |
Component: | Core | Assignee: | Ant Notifications List <notifications> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 1.7.0 | ||
Target Milestone: | 1.8.0 | ||
Hardware: | All | ||
OS: | All | ||
Bug Depends on: | |||
Bug Blocks: | 46759 |
Description
Rainer Noack
2005-06-20 21:59:42 UTC
This will be fixed in ant 1.7. I have added a new constructor to set the parent classloader and made all the other constructors deprecated. I have not converted all uses to use the new constructor (since some of them do strange things), however I have modifed the setParent() to use reflection to attempt to set the private field of the super class to the new parent. The change had to be reverted as it did work for java 1.4 and lower. In java 5, ClassLoader.getResources() is protected, in java 1.4, it is private. (In reply to comment #2) > The change had to be reverted as it did work > for java 1.4 and lower. > > In java 5, ClassLoader.getResources() is protected, > in java 1.4, it is private. > Can Dale Anson's "object rape" technique (see ac Variable task) be used here? No, one would have to change the class itself, not the use of the class. Well.., we could do this, but it would mess up the JDK rt.jar file..... Users call classloader.getResources() to get the resources. As ClassLoader.getResources() is final in java 1.4 (but not in java 5), AntClassLoader cannot have a getResources() method. It has to fake the getResources by not having a parent as seen by ClassLoader.getResources(). Opps, hit the wrong button... reopen *** This bug has been marked as a duplicate of bug 46759 *** the getResources issue is fixed in the Java5 case now. I don't think we would achieve much by setting ClassLoader.parent since we'd still have to deal with parentFirst and setIsolated in a way incompatible with the base implementation. In order to close this issue I've simply added a getConfiguredParent method in svn revision 796649 |