Calling addSource("A", "class B {}"); addSource("B", "class A {}"); compileAll(); returns a Map of "A" to the class A and "B" to the class B. This is unexpected, and means that compileAll().get(className) won't necessarily return the class compiled from the source code for className.
This could cause problems if, for example, client code ensures that the source code for "A" declares a class with some property, and then expects compileAll().get("A") to return a class with that property.
A suggested fix is for the compileAll() method to check that the source code associated with each class name does declare a class of that name, and throw a CompilationException otherwise. This mirrors the behaviour of javac which requires a file named A.java to declare a class named A.
Calling addSource("A", "class B {}"); addSource("B", "class A {}"); compileAll(); returns a Map of "A" to the class A and "B" to the class B. This is unexpected, and means that compileAll().get(className) won't necessarily return the class compiled from the source code for className.
This could cause problems if, for example, client code ensures that the source code for "A" declares a class with some property, and then expects compileAll().get("A") to return a class with that property.
A suggested fix is for the compileAll() method to check that the source code associated with each class name does declare a class of that name, and throw a CompilationException otherwise. This mirrors the behaviour of javac which requires a file named A.java to declare a class named A.