groovy

Multiple Class fail to work with loadClass method in GCL

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0-JSR-6
  • Component/s: groovy-jdk
  • Labels:
    None
  • Number of attachments :
    0

Description

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?

Activity

Hide
blackdrag blackdrag added a comment -

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

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

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.

Show
blackdrag blackdrag added a comment - 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.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: