Supress Inspection in Grails: cannot apply default constructor.


I am using Idea 8.1.2.  In my Grails controller, the Grails generated code creates a line like this in the save closure:

  def lineInstance = new Line(params)

Runs fine in Grails, but Idea says it can't apply this to the default constructor.  The 'params' is highlighted in the warning color and the tool tip says"cannot apply default constructor for class 'Line' ".  I can't seem to find a way to hide this inspection. I don't mind much, but I like my source files 'all green' on the right highlight bar.

Any ideas on how to supress this warning?  I could not find anything in the code inspection settings.  Also, Alt-Enter  does not work on this message.  No light bulb either.

BTW, great job on the Groovy/Grails support.  Does more than I thought possible in an IDE with a dynamic language...


Comment actions Permalink

I made one change to the controller code, and it supresses the code inspection:

  def lineInstance = new Line(params: params)

Now my controllers are all green

Comment actions Permalink

How does your Line class look like? Does it have an explicit constructor?

Comment actions Permalink

It has no explicit constructors. Just a small number of properties so far.

  class Line {
    String name


I understand that IDEA can't guess what is valid in some dynamic features.  I was just looking for a way to supress the yellow warning.  Adding 'params:' solved it for me.  I don't consider this an open issue now.



Please sign in to leave a comment.