Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.7
-
None
Description
Method pointer expressions are not type checked (with STC enabled). The following example should not compile for a number of reasons:
@groovy.transform.TypeChecked void test() { def x = 'abc'.&bar //bar is not a String method x() // groovy.lang.MissingMethodException x = String.&length //length is a non-static method x() // java.lang.IllegalArgumentException: object is not an instance of declaring class x = String.&size //size is a non-static extension method x() // java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.String } test()