groovy
  1. groovy
  2. GROOVY-5073 GEP 8 - Static Type Checking
  3. GROOVY-3014

add an annotation that forces the compiler to check methods for their existence at compile time

    Details

    • Type: Sub-task Sub-task
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-beta-1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      coming from Java it is a bit difficult for some users to find their way into dynamic programming, especially when it comes to method being there or not. therefor I suggested an annotation with source visibility, that can be used by the compiler to check if a method actually exists. This will slow down compilation a bit and may not be supported by IDEs as of yet. Also the check will be a check only, it will not force any kind of method selection at runtime. I suggested to let the compiler throw an error if the annotation forces compiler to check if a method exists, but is unknown, because I am against warnings. the annotation should be used at method or class scope.

        Activity

        Guillaume Laforge made changes -
        Field Original Value New Value
        Fix Version/s 1.5.7 [ 14242 ]
        Fix Version/s 1.6-beta-2 [ 14261 ]
        Fix Version/s 1.5.8 [ 14630 ]
        Guillaume Laforge made changes -
        Fix Version/s 1.5.8 [ 14630 ]
        Fix Version/s 1.6.2 [ 15151 ]
        Guillaume Laforge made changes -
        Fix Version/s 1.6.3 [ 15251 ]
        Fix Version/s 1.6.2 [ 15151 ]
        Guillaume Laforge made changes -
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Fix Version/s 1.6.3 [ 15251 ]
        Guillaume Laforge made changes -
        Fix Version/s 1.7-beta-x [ 15538 ]
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Hide
        Michael Lawler added a comment -

        My company haS a rather large framework built on java and groovy. We prefer to code in groovy than java, but we miss compile-time checks when we are not using dynamic language features such as method missing. When your code base grows over 200k LOC, then compile time interface checking is a nice option.

        It would be nice to be able to instruct the compiler to throw errors when compiling modules/classes/methods that we explicitly tell it don't use dynamic stuff.

        Show
        Michael Lawler added a comment - My company haS a rather large framework built on java and groovy. We prefer to code in groovy than java, but we miss compile-time checks when we are not using dynamic language features such as method missing. When your code base grows over 200k LOC, then compile time interface checking is a nice option. It would be nice to be able to instruct the compiler to throw errors when compiling modules/classes/methods that we explicitly tell it don't use dynamic stuff.
        Hide
        blackdrag blackdrag added a comment -

        We are about to start a project under the name Grumpy, which will do static checking of Groovy code. Don't be afraid, it is only the name till we find a better one With this only a subset of Groovy will compile. But it will check method calls and assignments like in Java. Would this help you in your case?

        Show
        blackdrag blackdrag added a comment - We are about to start a project under the name Grumpy, which will do static checking of Groovy code. Don't be afraid, it is only the name till we find a better one With this only a subset of Groovy will compile. But it will check method calls and assignments like in Java. Would this help you in your case?
        Hide
        Michael Lawler added a comment -

        Sounds good Jochen. I will keep a look out for further details.

        But sorry, I can't give you a +1 on the name

        Show
        Michael Lawler added a comment - Sounds good Jochen. I will keep a look out for further details. But sorry, I can't give you a +1 on the name
        CÚdric Champeau made changes -
        Assignee Jochen Theodorou [ blackdrag ] Cedric Champeau [ melix ]
        CÚdric Champeau made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        CÚdric Champeau made changes -
        Parent GROOVY-5073 [ 130431 ]
        Issue Type Improvement [ 4 ] Sub-task [ 7 ]
        Hide
        Will P added a comment -

        It would be very nice. We have somewhat about 170k LOC (160k java, 10k groovy) and since we don't have enough tests, we are holding the groovy coding. We will surely adopt more groovy code on our systems with those checks. (though we will have to wait for GREclipse getting it too).

        Show
        Will P added a comment - It would be very nice. We have somewhat about 170k LOC (160k java, 10k groovy) and since we don't have enough tests, we are holding the groovy coding. We will surely adopt more groovy code on our systems with those checks. (though we will have to wait for GREclipse getting it too).
        Hide
        blackdrag blackdrag added a comment -

        The eclipse plugin uses the groovy compiler. So if the groovy compiler can do that, and the eclipse plugin uses that groovy version, then you will have that ability in greclipse right away

        Show
        blackdrag blackdrag added a comment - The eclipse plugin uses the groovy compiler. So if the groovy compiler can do that, and the eclipse plugin uses that groovy version, then you will have that ability in greclipse right away
        CÚdric Champeau made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 2.0-beta-1 [ 17925 ]
        Fix Version/s 1.7.x [ 15538 ]
        Resolution Fixed [ 1 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            CÚdric Champeau
            Reporter:
            blackdrag blackdrag
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: