DynamicClassLoader delegates to parent classloader before checking in its URL list

Description

See Cursive #748. Cursive calls into Leiningen in-process, and before doing that it creates a new DynamicClassLoader which uses an IntelliJ PluginClassLoader as its parent. This is throwing a CNFE, although the URL containing the class is present in the DynamicClassLoader URL list.

Cause: The patch for added an implementation of loadClass that delegates to "getParent().loadClass()", which in this case delegates to PluginClassLoader.loadClass(). This was incorrect as the current implementation should have been to delegate to the loadClass method of the superclass, which will take care of delegating to the loadClass method of the parent class loader if necessary.

Approach: The proposed patch replaces the call to "getParent().loadClass()" with a call "super.loadClass()" fixing this issue.

Screened by: Alex Miller

Environment

None

Activity

Show:
Colin Fleming
February 18, 2015, 12:25 PM

Unfortunately getClassLoadingLock(name) is only available from Java 1.7+ and I am targeting Java 1.6. However reverting that part of the patch to synchronize on "this" as previously does indeed fix the original problem.

Nicola Mometto
February 18, 2015, 1:22 PM

I'll revert the getClassLoadingLock change then, it was actually out of scope for this ticket.

Assignee

Unassigned

Reporter

Nicola Mometto

Approval

Ok

Patch

Code

Fix versions

Affects versions

Priority

Critical
Configure