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

Joint compiler doesn't like classes that contain methods with primitive types for names

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.6.5
    • Fix Version/s: 1.6.6, 1.7-rc-1
    • Component/s: None
    • Labels:
      None

      Description

      I defined a method like:

          Integer 'int'(String name) {
              def o = get(name)
              if(o instanceof Number) {
                 return o.intValue()
              }
              else if(o != null) {
                  try {
                      return Integer.parseInt(o.toString())
                  }
                  catch (NumberFormatException e) {
                  }
              }
          }
      

      This compiles fine in Groovy but blows up with the joint compiler with an error like:

       [groovyc] public  java.lang.Integer byte(java.lang.String name) { return (java.lang.Integer)null;}
      

        Activity

        Hide
        graemerocher Graeme Rocher added a comment -

        IntelliJ joint compiler also compiles it fine

        Show
        graemerocher Graeme Rocher added a comment - IntelliJ joint compiler also compiles it fine
        Hide
        graemerocher Graeme Rocher added a comment -

        The fix IMO should be just to exclude them from the generated Java classes since it would be impossible for Java to call these methods anyway

        Show
        graemerocher Graeme Rocher added a comment - The fix IMO should be just to exclude them from the generated Java classes since it would be impossible for Java to call these methods anyway
        Hide
        roshandawrani Roshan Dawrani added a comment -

        Why even create a method named like that? I am curious.

        Show
        roshandawrani Roshan Dawrani added a comment - Why even create a method named like that? I am curious.
        Hide
        Guillaume Guillaume Delcroix added a comment -

        With these instructions to try and reproduce the problem:

        git clone git://github.com/grails/grails.git
        cd grails/grails
        git checkout eb82261fa94beca22c422cc5968779fc5cdaa68d
        ant clean jar
        

        With Groovy 1.6.x, I do see some warnings in the output, but I don't see the joint compiler error with the byte / int / etc. methods.
        The build also fails with OOME Java heap space, so I hope it's not the tree hiding the forest.
        But so far, I've not been able to see that problem.

        Show
        Guillaume Guillaume Delcroix added a comment - With these instructions to try and reproduce the problem: git clone git: //github.com/grails/grails.git cd grails/grails git checkout eb82261fa94beca22c422cc5968779fc5cdaa68d ant clean jar With Groovy 1.6.x, I do see some warnings in the output, but I don't see the joint compiler error with the byte / int / etc. methods. The build also fails with OOME Java heap space, so I hope it's not the tree hiding the forest. But so far, I've not been able to see that problem.
        Hide
        pniederw Peter Niederwieser added a comment -

        I already fixed this a few weeks back. Do you still see this with 1.6.x?

        Show
        pniederw Peter Niederwieser added a comment - I already fixed this a few weeks back. Do you still see this with 1.6.x?

          People

          • Assignee:
            Guillaume Guillaume Delcroix
            Reporter:
            graemerocher Graeme Rocher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development