I have discovered a bug in the class loader. Essentially the AdaptiveClassLoader doesn't properly account for inner-class hierarchies.
I think I can explain this best with an example
The following is a controller that fails to load
import uk.ac.warwick.dcs.maze.logic.IRobot;
public class Test {
public void controlRobot(IRobot robot) {
}
public static class A extends B {
}
public static class B {
}
}
It gives the error message:
java.lang.LinkageError: loader (instance of uk/ac/warwick/dcs/maze/loader/AdaptiveClassLoader): attempted duplicate class definition for name: "Test$B"
However, if the class names were switched, it works
import uk.ac.warwick.dcs.maze.logic.IRobot;
public class Test {
public void controlRobot(IRobot robot) {
}
public static class B extends A {
}
public static class A {
}
}
By looking at the source code for AdaptiveClassLoader it loads classes based on their file name listed in the directory (using RelatedClassFilter.getRelatedFiles(file);)
In the failiure case, class Test$A gets loaded first. Because of it's superclass dependency of Test$B, class B gets loaded before A. Then, because AdaptiveClassLoader#loadClass(File) loops over getRelatedFiles, it then attempts to load B, hence the duplicate class definition error.