Hi, Sorry, after a review, I wanted to replace 'Sex' by 'Gender' but did not complete is correctly. I replaced everything inline in the e-mail below. However, the behavior is unchanged whatever the terminology :).
Regards, Loïc De : DECLOEDT Loic EVADERIS Envoyé : mercredi 23 mars 2016 10:02 À : [email protected] Cc : PAOLI Pierre EVADERIS <[email protected]>; GUIU Vincent EVADERIS <[email protected]> Objet : [PROVENANCE INTERNET] Groovy runtime issue with multiple directories install Hi, I have a problem starting up a groovy project structured like this: project/ classes/ person/ C1.groovy scripts run.groovy The C1.groovy file contains the following code: package person import groovy.transform.ToString @ToString class C1 { enum Gender { M, F} String name Gender gender } And the run.groovy file contains the following code: import person.C1 //import person.C1.Gender def m = person.C1.Gender.M def f = person.C1.Gender.F println "genders: ${m}, ${f}" abstract class CScript extends groovy.lang.Script { public C1 addC1(String name, person.C1.Gender g) { return new C1(name:name, gender:g) } } def c = new C1(name: "max", gender: person.C1.Gender.M) println "c = ${c}" I have the following error when executing this code with the following command from the project dir: groovy -cp $PWD/classes scripts/run.groovy org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: /home/ldecloed/Groovy/workspace/issueImportEnum/scripts/run.groovy: 13: unable to resolve class person.C1.Gender @ line 13, column 32. public C1 addC1(String name, person.C1.Gender g) { ^ 1 error However, all errors disapear when commenting out the whole CScript class declaration. As a result, the person.C1.Sex enum can be used outside the CScript class declaration but not inside. In addtion, I tested a static compilation of the whole code and it works correctly in this case. Can you clarify whether this code is valid ? If so, do you plan to improve groovy to support it ? This test has been made with groovy 2.4.6. I can provide the sources if you want a test-case. Regards, Loïc. -- Loïc Decloedt CAD & Software Manager eVaderis [eVaderis-logo-CMJN-small1] Minatec Entreprise BHT 7, Parvis Louis Néel 38054 Grenoble Cedex 9 France Office : 04 38 7 80874
