You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Shil Sinha (JIRA)" <ji...@apache.org> on 2016/06/10 21:46:21 UTC
[jira] [Updated] (GROOVY-7859) Method pointers to non-static
methods from class objects should fail STC
[ https://issues.apache.org/jira/browse/GROOVY-7859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shil Sinha updated GROOVY-7859:
-------------------------------
Summary: Method pointers to non-static methods from class objects should fail STC (was: Method pointers to non-static methods from a class objects should fail STC)
> Method pointers to non-static methods from class objects should fail STC
> ------------------------------------------------------------------------
>
> Key: GROOVY-7859
> URL: https://issues.apache.org/jira/browse/GROOVY-7859
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 2.4.7
> Reporter: Shil Sinha
>
> The following currently passes static type checking:
> {code}
> @groovy.transform.CompileStatic
> void test() {
> def x = String.&length
> x()
> }
> test()
> {code}
> At runtime, it fails with:
> {quote}
> java.lang.IllegalArgumentException: object is not an instance of declaring class
> {quote}
> If {{String.&length}} is replaced with {{String.&size}}, or a pointer to any extension method, it still passes STC, but fails with a ClassCastException instead.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)