[jira] [Commented] (GROOVY-7859) Erroneous method pointer expressions pass STC

2021-12-19 Thread Eric Milles (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-7859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17462275#comment-17462275
 ] 

Eric Milles commented on GROOVY-7859:
-

Is the expectation that STC know that "x" requires 1 argument when initialized 
from "String." or "String."?  "x" is callable if a string argument 
is supplied.

> Erroneous method pointer expressions pass 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
>Assignee: Shil Sinha
>Priority: Major
>
> Method pointer expressions are not type checked (with STC enabled). The 
> following example should not compile for a number of reasons:
> {code}
> @groovy.transform.TypeChecked
> void test() {
>   def x = 'abc'. //bar is not a String method
>   x() // groovy.lang.MissingMethodException
>   x = String. //length is a non-static method
>   x() // java.lang.IllegalArgumentException: object is not an instance of 
> declaring class
>   x = String. //size is a non-static extension method
>   x() // java.lang.ClassCastException: java.lang.Class cannot be cast to 
> java.lang.String
> }
> test()
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Commented] (GROOVY-7859) Erroneous method pointer expressions pass STC

2020-11-12 Thread Eric Milles (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-7859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17230950#comment-17230950
 ] 

Eric Milles commented on GROOVY-7859:
-

This may have been addressed by GROOVY-9463

> Erroneous method pointer expressions pass 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
>Assignee: Shil Sinha
>Priority: Major
>
> Method pointer expressions are not type checked (with STC enabled). The 
> following example should not compile for a number of reasons:
> {code}
> @groovy.transform.TypeChecked
> void test() {
>   def x = 'abc'. //bar is not a String method
>   x() // groovy.lang.MissingMethodException
>   x = String. //length is a non-static method
>   x() // java.lang.IllegalArgumentException: object is not an instance of 
> declaring class
>   x = String. //size is a non-static extension method
>   x() // java.lang.ClassCastException: java.lang.Class cannot be cast to 
> java.lang.String
> }
> test()
> {code}



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


[jira] [Commented] (GROOVY-7859) Erroneous method pointer expressions pass STC

2017-10-14 Thread Shil Sinha (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16204699#comment-16204699
 ] 

Shil Sinha commented on GROOVY-7859:


[~emilles] That issue was addressed in 
https://issues.apache.org/jira/browse/GROOVY-7772, though it's unclear reading 
the comments whether the resolution means that 2.6 has the behavior for groovy 
style method pointers, or java style method references.

> Erroneous method pointer expressions pass 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
>Assignee: Shil Sinha
>
> Method pointer expressions are not type checked (with STC enabled). The 
> following example should not compile for a number of reasons:
> {code}
> @groovy.transform.TypeChecked
> void test() {
>   def x = 'abc'. //bar is not a String method
>   x() // groovy.lang.MissingMethodException
>   x = String. //length is a non-static method
>   x() // java.lang.IllegalArgumentException: object is not an instance of 
> declaring class
>   x = String. //size is a non-static extension method
>   x() // java.lang.ClassCastException: java.lang.Class cannot be cast to 
> java.lang.String
> }
> test()
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-7859) Erroneous method pointer expressions pass STC

2017-10-14 Thread Eric Milles (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16204662#comment-16204662
 ] 

Eric Milles commented on GROOVY-7859:
-

I also found that {{String.}} (for example) is not usable.  It 
results in:
{code}
assert ['ABC','XYZ'].collect(String.) == ['abc','xyz']

groovy.lang.MissingMethodException: No signature of method: 
java.lang.String.toLowerCase() is applicable for argument types: 
(java.lang.String) values: [ABC]
Possible solutions: toLowerCase(), toLowerCase(java.util.Locale), 
toUpperCase(), toUpperCase(java.util.Locale)
at Script1.run(Script1.groovy:1)
{code}

Should I file a separate bug report for this?

> Erroneous method pointer expressions pass 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
>Assignee: Shil Sinha
>
> Method pointer expressions are not type checked (with STC enabled). The 
> following example should not compile for a number of reasons:
> {code}
> @groovy.transform.TypeChecked
> void test() {
>   def x = 'abc'. //bar is not a String method
>   x() // groovy.lang.MissingMethodException
>   x = String. //length is a non-static method
>   x() // java.lang.IllegalArgumentException: object is not an instance of 
> declaring class
>   x = String. //size is a non-static extension method
>   x() // java.lang.ClassCastException: java.lang.Class cannot be cast to 
> java.lang.String
> }
> test()
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-7859) Erroneous method pointer expressions pass STC

2017-09-14 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16165804#comment-16165804
 ] 

Paul King commented on GROOVY-7859:
---

The corresponding method reference equivalent using the Parrot parser suffer 
from the same errors:
{code}
x = 'abc'::bar
x = String::length
x = String::size
{code}
This is to be expected given the current implementation.

> Erroneous method pointer expressions pass 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
>Assignee: Shil Sinha
>
> Method pointer expressions are not type checked (with STC enabled). The 
> following example should not compile for a number of reasons:
> {code}
> @groovy.transform.TypeChecked
> void test() {
>   def x = 'abc'. //bar is not a String method
>   x() // groovy.lang.MissingMethodException
>   x = String. //length is a non-static method
>   x() // java.lang.IllegalArgumentException: object is not an instance of 
> declaring class
>   x = String. //size is a non-static extension method
>   x() // java.lang.ClassCastException: java.lang.Class cannot be cast to 
> java.lang.String
> }
> test()
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)