Skip to content

@GrailsCompileStatic in a command object breaks importFrom method call #10157

@Macoshark

Description

@Macoshark

Steps to Reproduce

  1. Define a base command object that other command objects extend.

    @Validateable
    @GrailsCompileStatic
    class ApiCommandBase {
    String param
    ...

    static constraints = {
        param nullable: true
        ...
    }
    

    }

  2. The extended command object imports the constraints from ApiCommandBase by calling the importFrom method.

    @Validateable
    @GrailsCompileStatic
    class AccountCmd extends ApiCommandBase {
    String username

    static constraints = {
        importFrom ApiCommandBase
        username blank: false
    }
    

    }

Expected Behaviour

The code compiles normally.

Actual Behaviour

This results in the following compilation error:

Compilation error: startup failed:
AccountCmd.groovy: 15: [Static type checking] - Cannot find matching method AccountCmd#importFrom(java.lang.Class <ApiCommandBase>). Please check if the declared type is right and if the method exists.
@ line 15, column 9.
           importFrom ApiCommandBase
           ^
1 error

Environment Information

  • Operating System: Mac OSX El Capitan
  • Grails Version: 2.5.5
  • JDK Version: 1.7
  • Container Version (If Applicable): N/A

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions