Groovy Documentation

org.gradle
Class ParentLastClassLoader

java.lang.Object
  java.lang.ClassLoader
      java.security.SecureClassLoader
          java.net.URLClassLoader
              org.gradle.ParentLastClassLoader

class ParentLastClassLoader
extends java.net.URLClassLoader

This class loader delegates to the parent class loader ONLY if it cannot find it itself. This is meant to solve classloading issues when running something as, say, a plugin inside an application that may have already loaded a different version of some required jars. This makes sure it looks locally first. This is the opposite of a ClassLoader's typical behavior, but it necessary when you can't control the environment in which you're running. Using this class can be very dangerous. You must carefully make sure you understand the ramifications of using this. You should also probably make this the first class loader between your plugin and the plugin's owner.

author:
mhunsicker


Constructor Summary
ParentLastClassLoader(URL[] urls, java.lang.ClassLoader parent)

ParentLastClassLoader(URL[] urls)

ParentLastClassLoader(URL[] urls, java.lang.ClassLoader parent, URLStreamHandlerFactory factory)

 
Method Summary
java.lang.Class loadClass(java.lang.String name)

 
Methods inherited from class java.net.URLClassLoader
newInstance, newInstance, findResource, findResources, getURLs, loadClass, getSystemClassLoader, getResourceAsStream, getResource, getSystemResourceAsStream, getSystemResource, getResources, getSystemResources, getParent, setDefaultAssertionStatus, setPackageAssertionStatus, setClassAssertionStatus, clearAssertionStatus, wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 
Methods inherited from class java.security.SecureClassLoader
loadClass, getSystemClassLoader, getResourceAsStream, getResource, getSystemResourceAsStream, getSystemResource, getResources, getSystemResources, getParent, setDefaultAssertionStatus, setPackageAssertionStatus, setClassAssertionStatus, clearAssertionStatus, wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 
Methods inherited from class java.lang.ClassLoader
loadClass, getSystemClassLoader, getResourceAsStream, getResource, getSystemResourceAsStream, getSystemResource, getResources, getSystemResources, getParent, setDefaultAssertionStatus, setPackageAssertionStatus, setClassAssertionStatus, clearAssertionStatus, wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 
Methods inherited from class java.lang.Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Constructor Detail

ParentLastClassLoader

public ParentLastClassLoader(URL[] urls, java.lang.ClassLoader parent)


ParentLastClassLoader

public ParentLastClassLoader(URL[] urls)


ParentLastClassLoader

public ParentLastClassLoader(URL[] urls, java.lang.ClassLoader parent, URLStreamHandlerFactory factory)


 
Method Detail

loadClass

@Override
public java.lang.Class loadClass(java.lang.String name)


 

Groovy Documentation