groovy
  1. groovy
  2. GROOVY-2116

add an extension mechanism to allow new GDK methods to be added to other libraries by other projects using a META-INF/services/groovy/groovyMethods file on the classpath to list Classes to be used to load GDK methods

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-rc-1
    • Component/s: groovy-jdk
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      2

      Issue Links

        Activity

        Hide
        CÚdric Champeau added a comment -

        Yes, the DefautGroovyMethods class already has support for this (the "additionals" static field). However, it looks much more complicated to provide MetaMethods than implementing extensions through DGM style.

        Show
        CÚdric Champeau added a comment - Yes, the DefautGroovyMethods class already has support for this (the "additionals" static field). However, it looks much more complicated to provide MetaMethods than implementing extensions through DGM style.
        Hide
        Peter Niederwieser added a comment -

        From a user's perspective, I'm very much in favor of implementing methods in DGM style. In particular, I want to be able to implement the methods in Groovy or Java.

        Show
        Peter Niederwieser added a comment - From a user's perspective, I'm very much in favor of implementing methods in DGM style. In particular, I want to be able to implement the methods in Groovy or Java.
        Hide
        blackdrag blackdrag added a comment -

        the additionals parts is not used by the runtime, it is used by groovydoc and by the part that generates callsites for the dgm methods. If we really wanted to do it like dgm, then we would need those hundreds of generated classes. The reason we have them simply is, that laoding them is faster than loading a giant DGM and inspecting it through reflection. Also a point to consider is that the more methods are added the slower groovy will startup, since that complete registry is done once at startup. I was thinking that we should have a more efficient system, but I couldn't come up with one yet

        Show
        blackdrag blackdrag added a comment - the additionals parts is not used by the runtime, it is used by groovydoc and by the part that generates callsites for the dgm methods. If we really wanted to do it like dgm, then we would need those hundreds of generated classes. The reason we have them simply is, that laoding them is faster than loading a giant DGM and inspecting it through reflection. Also a point to consider is that the more methods are added the slower groovy will startup, since that complete registry is done once at startup. I was thinking that we should have a more efficient system, but I couldn't come up with one yet
        Hide
        Peter Niederwieser added a comment -

        I don't know the details. Just saying that as a user, I'd like to write DGM-style methods. I assume the number of methods added in such a way would be way below the number of DGM methods. IMHO this feature should only be used by end-user applications. For libraries, the risk of nasty conflicts is too high.

        Show
        Peter Niederwieser added a comment - I don't know the details. Just saying that as a user, I'd like to write DGM-style methods. I assume the number of methods added in such a way would be way below the number of DGM methods. IMHO this feature should only be used by end-user applications. For libraries, the risk of nasty conflicts is too high.
        Show
        CÚdric Champeau added a comment - See http://docs.codehaus.org/display/GROOVY/Creating+an+extension+module

          People

          • Assignee:
            CÚdric Champeau
            Reporter:
            james strachan
          • Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: