You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2019/10/15 20:44:00 UTC

[jira] [Updated] (GROOVY-8350) Class expressions with and without ".class"

     [ https://issues.apache.org/jira/browse/GROOVY-8350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-8350:
--------------------------------
    Description: 
This seems like a bug (but it could just be a clarification in the documentation).  And is seems related to GROOVY-3548, GROOVY-8152, GROOVY-8153, and GROOVY-8154.

{{System.currentTimeMillis()}} is your typical static call.
{{System.getClass().currentTimeMillis()}} results in a MissingMethodException, as it should.
However, {{System.class.currentTimeMillis()}} and {{def sys = System.class; sys.currentTimeMillis()}} both compile and execute fine.  I would expect a MissingMethodException for these as well.

Is there some trick where methodMissing on class instance can find the static method or something?  My Java experience says no {{currentTimeMillis}} method on {{Class}}.

  was:
This seems like a bug (but it could just be a clarification in the documentation).  And is seems related to GROOVY-8152, GROOVY-8153, and GROOVY-8154.

{{System.currentTimeMillis()}} is your typical static call.
{{System.getClass().currentTimeMillis()}} results in a MissingMethodException, as it should.
However, {{System.class.currentTimeMillis()}} and {{def sys = System.class; sys.currentTimeMillis()}} both compile and execute fine.  I would expect a MissingMethodException for these as well.

Is there some trick where methodMissing on class instance can find the static method or something?  My Java experience says no {{currentTimeMillis}} method on {{Class}}.


> Class expressions with and without ".class"
> -------------------------------------------
>
>                 Key: GROOVY-8350
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8350
>             Project: Groovy
>          Issue Type: Documentation
>            Reporter: Eric Milles
>            Priority: Minor
>
> This seems like a bug (but it could just be a clarification in the documentation).  And is seems related to GROOVY-3548, GROOVY-8152, GROOVY-8153, and GROOVY-8154.
> {{System.currentTimeMillis()}} is your typical static call.
> {{System.getClass().currentTimeMillis()}} results in a MissingMethodException, as it should.
> However, {{System.class.currentTimeMillis()}} and {{def sys = System.class; sys.currentTimeMillis()}} both compile and execute fine.  I would expect a MissingMethodException for these as well.
> Is there some trick where methodMissing on class instance can find the static method or something?  My Java experience says no {{currentTimeMillis}} method on {{Class}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)