Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1199

Groovy generates invalid class files when having a method that invokes a super class method taking a primitive as an argument.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.0-JSR-4
    • 1.0-RC-1
    • None
    • None
    • JDK 1.4.2_10

    Description

      I use the GroovyClassLoader and GroovyObject to load a script and invoke operations on the GroovyObject instance. For example:

      final GroovyClassLoader grooveyClassLoader = new GroovyClassLoader(this.getClass().getClassLoader());
      final Class groovyClass =
      grooveyClassLoader.parseClass(
      this.getContents(new File(this.scriptPath)),
      scriptPath);
      final GroovyObject groovyObject = (GroovyObject)groovyClass.newInstance();

      return groovyObject.invokeMethod(
      methodName,
      args);

      Anyway, things work fine in most cases, however if I have a method in my script like this:

      public Object findByName(int transform, String name)

      { return super.findByName(transform, name); }

      then I get the following verify error when trying to execute this method

      10:52:45,671 INFO [STDOUT] Caused by: java.lang.VerifyError: (class: org/dcri/ctn/siteprofile/persistence/ApplicationRo
      leDaoImpl, method: findByName signature: (ILjava/lang/String;)Ljava/lang/Object Expecting to find integer on stack
      10:52:45,671 INFO [STDOUT] at java.lang.Class.getDeclaredConstructors0(Native Method)
      10:52:45,671 INFO [STDOUT] at java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
      10:52:45,671 INFO [STDOUT] at java.lang.Class.getConstructor0(Class.java:1930)
      10:52:45,671 INFO [STDOUT] at java.lang.Class.newInstance0(Class.java:278)
      10:52:45,671 INFO [STDOUT] at java.lang.Class.newInstance(Class.java:261)

      If I remove the call to super.findByName(transform, name), things work fine. Also if I change the super call to not use a primitive like the following (even though the super method doesn't take an Integer on the actual class), things work fine:

      public Object findByName(int transform, String name)

      { return super.findByName(new Integer(transform), name); }

      .So it appears the invalid class file only occurs when the super method call contains a primitive. Let me know if I need to provide more information.

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              cwbrandon Chad Brandon
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: