Static Dynamic Method

I just upgraded to the latest JetGroovy however I still do not see how to make a dynamic method static.  I still get the cannot reference nonstatic symbol from static context when defining dynamic methods for finders.  Where in the UI can I designate that the dynamic method should be static?

6 comments
Comment actions Permalink

Static methods will never be able to reference instance fields or methods without an instance in hand to use in the invocation. It's just not allowed by Java or Groovy.

You should ask questions about the Groovy language itself or about the Grails framework on the relevant mailing list. Here you should ask about things specific to the JetGroovy plug-in.


Randall Schulz

0
Comment actions Permalink

>It's just not allowed by Java or Groovy.

Then why does JetBrains say they'll support it?  This is from the Groovy and Grails page at http://www.jetbrains.com/idea/features/groovy_grails.html:

  • Support for static dynamic methods

Maybe this isn't the correct forum but it's hard to know where to post this question since it could be part of the plugin or part of the IDE so I thought I would start here and someone would know.

0
Comment actions Permalink

I see. Well, I don't know what they're talking about, 'cause to me it's a contradiction in terms.

RRS

0
Comment actions Permalink

Dynamic methods are allowed in Groovy, read http://groovy.codehaus.org/ExpandoMetaClass+-+Static+Methods
JetGroovy supports this feature, you should select checkbox "Static" while dialog "Add dynamic method" appeares.

0
Comment actions Permalink

>you should select checkbox "Static" while dialog "Add dynamic method" appeares

I don't see a checkbox.  When I see the dialog for Add dynamic method, all that it list is Class, Return type, and Method arguments.  I am on IntelliJ 7.0.5 and JetGroovy plugin 1.6.20679.  Does this only show for IntelliJ 8?

0
Comment actions Permalink

Update IDEA to 8 and JetGroovy plugin, static dynamic methods are allowed there

0

Please sign in to leave a comment.