Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 715024544f
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (30 sloc) 1.326 kb
package groovy
class CompileOrderTest extends GroovyTestCase {
public void testCompileOrder() {
def interfaceFile = File.createTempFile("TestOrderInterface", ".groovy", new File("target"))
def concreteFile = File.createTempFile("TestOrderConcrete", ".groovy", new File("target"))
def cl = new GroovyClassLoader(this.class.classLoader);
def currentDir = concreteFile.parentFile.absolutePath
println currentDir
cl.addClasspath(currentDir)
cl.shouldRecompile = true
try {
// Create the interface
println "a"
interfaceFile.deleteOnExit()
def interfaceName = interfaceFile.name - ".groovy"
interfaceFile.write "interface $interfaceName { }\n"
// Create a concrete class which implements the interface
concreteFile.deleteOnExit()
def concreteName = concreteFile.name - ".groovy"
concreteFile.write "class $concreteName implements $interfaceName { }\n"
// We're testing whether this fails:
def groovyClass = cl.loadClass(concreteName,true,false)
// Create an object, just for good measure.
def object = groovyClass.newInstance()
} finally {
interfaceFile.delete()
concreteFile.delete()
}
}
}
Jump to Line
Something went wrong with that request. Please try again.