Issue Details (XML | Word | Printable)

Key: GROOVY-1226
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jochen Theodorou
Reporter: Graeme Rocher
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

Multiple Class fail to work with loadClass method in GCL

Created: 02/Feb/06 11:45 AM   Updated: 03/Mar/06 11:12 AM   Resolved: 03/Mar/06 11:12 AM
Component/s: groovy-jdk
Affects Version/s: None
Fix Version/s: 1.0-JSR-6

Time Tracking:
Not Specified


 Description  « Hide

If you have multiple classes in a file like below:

file: FileController.groovy
-----------------------------
class UploadCommand {
@Property byte[] myFile
}
class FileController {
@Property upload = {}
}

calling

gcl.loadClass("FileController",true,false) loads the "UploadCommand" class. If you look at the loaded classes within the class loader the closures within the FileController class (like FileController$_closure1) are loaded but no the FileController. Is this a bug? Does loadClass not support multiple classes in a file?



Jochen Theodorou added a comment - 02/Feb/06 01:58 PM

I am sure the class is loaded but maybe it is not added to the list of loaded classes. So this is a bug.


Jochen Theodorou added a comment - 03/Mar/06 11:12 AM

it seems all 3 classes were generated, but the wrong answer was picked. This resulted in dleting the FileController class and returing the UploadCommand class as well as saving the UploadCommand class in the cache for the name "FileController". I corrected this.