Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grails 2.5.0: Reloading of enums fails #703

Closed
zaccak opened this issue May 14, 2015 · 4 comments
Closed

Grails 2.5.0: Reloading of enums fails #703

zaccak opened this issue May 14, 2015 · 4 comments

Comments

@zaccak
Copy link

zaccak commented May 14, 2015

If I'm running a Grails application and I change an enum it wont reload it. I will have to shut down the app and run-app again to fix it.

Please fix.

Line | Method
->> 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor


| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread

Caused by GrailsConfigurationException: Cannot add Domain class [class y.enums.x]. It is not a Domain!
->> 745 | run in java.lang.Thread

@graemerocher
Copy link
Member

I tried to reproduce this by creating an enum and rendering a enum value, then changing the enum and rendering the newly added value and I received no such exception, if you want any progress on this issue you will need to upload an example to github with steps to reproduce

@graemerocher graemerocher removed this from the grails-2.5.1 milestone May 28, 2015
@zaccak
Copy link
Author

zaccak commented May 30, 2015

Hi Graeme,

I'm able to reproduce it using the following:
0. Make a new project: EnumBreaker

  1. Make an emum:
    package enumbreaker.enums
    enum ProvinceEnum {
    AB("Alberta"),
    BC("British Columbia"),
    MB("Manitoba"),
    NB("New Brunswick"),
    NF("Newfoundland and Labrador"),
    NT("Northwest Territories"),
    NS("Nova Scotia"),
    NU("Nunavut"),
    ON("Ontario"),
    PE("Prince Edward Island"),
    QC("Quebec"),
    SK("Saskatchewan"),
    YT("Yukon")

    private final String value

    ProvinceEnum(String value) {
    this.value = value
    }

    String toString() {
    return value
    }
    }

  2. Make a domain that uses that enum:
    package enumbreaker
    import enumbreaker.enums.ProvinceEnum
    class Clinic {

    String name
    ProvinceEnum province

    static constraints = {

    }
    }

  3. Run-app

  4. Now change the enum (remove the last YT or add something new)

  5. You should get this:
    ......
    |Compiling 1 source files
    .Error
    |
    2015-05-30 13:14:11,141 [FileSystemWatcher: files=Grails fails to correctly identify Java Home in startGrails #1 cl=groovy.lang.GroovyClassLoader@7a64cb0c] ERROR plugins.AbstractGrailsPluginManager - Plugin [domainClass:2.5.0] could not reload changes to file [/Users/xxx/EnumBreaker/grails-app/domain/enumbreaker/enums/ProvinceEnum.groovy]: Cannot add Domain class [class enumbreaker.enums.ProvinceEnum]. It is not a Domain!
    Message: Cannot add Domain class [class enumbreaker.enums.ProvinceEnum]. It is not a Domain!
    Line | Method
    ->> 745 | run in java.lang.Thread


@graemerocher
Copy link
Member

I followed your steps and I cannot reproduce with the master branch, maybe it has already been fixed by another commit

@zaccak
Copy link
Author

zaccak commented Jun 2, 2015

I can give it another shot when 2.5.1 comes out.

I should note that I'm running Grails 2.5.0 on Mac OS X 10.10.3 and Groovy/Grails Tool Suite Version: 3.6.4.RELEASE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants