groovy
  1. groovy
  2. GROOVY-3895

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major 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
    • Number of attachments :
      0

      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
        Graeme Rocher added a comment -

        IntelliJ joint compiler also compiles it fine

        Show
        Graeme Rocher added a comment - IntelliJ joint compiler also compiles it fine
        Hide
        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
        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
        Roshan Dawrani added a comment -

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

        Show
        Roshan Dawrani added a comment - Why even create a method named like that? I am curious.
        Hide
        Guillaume Laforge 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 Laforge 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
        Peter Niederwieser added a comment -

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

        Show
        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 Laforge
            Reporter:
            Graeme Rocher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: