GMaven (OLD... DO NOT USE)
  1. GMaven (OLD... DO NOT USE)
  2. MGROOVY-150

StubGeneration for non-empty superclass constructors

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-rc-3
    • Component/s: stub generation
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Given this groovy-class

      import javax.servlet.http.HttpServletRequest
      import javax.servlet.http.HttpServletRequestWrapper

      class RequestProxy extends HttpServletRequestWrapper {
      RequestProxy(HttpServletRequest request)

      { super(request) }

      }

      the stub-generation creates a constructor-stub:

      public class RequestProxy extends HttpServletRequestWrapper {
      public RequestProxy(HttpServletRequest request)

      { throw new Error(); }

      ;
      }

      that makes the java-compile complain, because there's no empty constructor for the super-class HttpServletRequestWrapper to call.

      I guess this could be fixed in the joint-compiler by looking for any 'super' calls in constructors and adding them to the stub-constructor-body, so it would generate this stub instead:

      public class RequestProxy extends HttpServletRequestWrapper {
      public RequestProxy(HttpServletRequest request)

      { super(request); throw new Error(); }

      ;
      }

        Activity

        Hide
        Jason Dillon added a comment -

        What version of the plugin are you using? Are you using the new GMaven plugin or the old Codehaus groovy-maven-plugin?

        Show
        Jason Dillon added a comment - What version of the plugin are you using? Are you using the new GMaven plugin or the old Codehaus groovy-maven-plugin?
        Hide
        Bart Robeyns added a comment - - edited

        I'm using the, apparently old, groovy-maven-plugin. I've switched over to gmaven (org.codehaus.groovy.maven:gmaven-plugin:jar:1.0-rc-2) and I get essentially the same error, but in a different format:Unexpected node: Node[1:1,27,EXPR]

        Show
        Bart Robeyns added a comment - - edited I'm using the, apparently old, groovy-maven-plugin. I've switched over to gmaven (org.codehaus.groovy.maven:gmaven-plugin:jar:1.0-rc-2) and I get essentially the same error, but in a different format: Unexpected node: Node [1:1,27,EXPR]
        Hide
        Jason Dillon added a comment -

        Can you please try gmaven 1.0-rc-3-SNAPSHOT

        Show
        Jason Dillon added a comment - Can you please try gmaven 1.0-rc-3-SNAPSHOT
        Hide
        Bart Robeyns added a comment -

        I can't find rc-3 in any repository; I'll try to build it from source during the weekend.

        Show
        Bart Robeyns added a comment - I can't find rc-3 in any repository; I'll try to build it from source during the weekend.
        Hide
        Jason Dillon added a comment -

        They are in the codehaus snapshot repository: http://snapshots.repository.codehaus.org/

        Show
        Jason Dillon added a comment - They are in the codehaus snapshot repository: http://snapshots.repository.codehaus.org/
        Hide
        Bart Robeyns added a comment -

        With 1.0-rc-3-20080513.065802, it's the same result.
        Generated constructor-stub:

           public RequestProxy(HttpServletRequest request){ throw new Error(); };
        

        Error message:

        ...\RequestProxy.java:[39,48] cannot find symbol
        symbol  : constructor HttpServletRequestWrapper()
        location: class javax.servlet.http.HttpServletRequestWrapper
        

        (My previous comment about the new error-message was bogus: I was actually commenting on the 'stubgeneration for scripts'-issue)

        Show
        Bart Robeyns added a comment - With 1.0-rc-3-20080513.065802, it's the same result. Generated constructor-stub: public RequestProxy(HttpServletRequest request){ throw new Error(); }; Error message: ...\RequestProxy.java:[39,48] cannot find symbol symbol : constructor HttpServletRequestWrapper() location: class javax.servlet.http.HttpServletRequestWrapper (My previous comment about the new error-message was bogus: I was actually commenting on the 'stubgeneration for scripts'-issue)
        Hide
        Bart Robeyns added a comment - - edited

        Sorry, error on my part. I've built the plugin myself and now my build works fine. Don't know what went wrong, but I guess I must have had an old RC-3 version in my repo.
        Anyway, thanks for the fix.

        Show
        Bart Robeyns added a comment - - edited Sorry, error on my part. I've built the plugin myself and now my build works fine. Don't know what went wrong, but I guess I must have had an old RC-3 version in my repo . Anyway, thanks for the fix.
        Hide
        Jason Dillon added a comment -

        glad to hear you have it working

        Show
        Jason Dillon added a comment - glad to hear you have it working

          People

          • Assignee:
            Jason Dillon
            Reporter:
            Bart Robeyns
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: