groovy
  1. groovy
  2. GROOVY-4453

Duplicate methods added by stub generator in joint compilation when method parameters have default values.

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.4
    • Fix Version/s: 1.7.6, 1.8-beta-3
    • Component/s: class generator
    • Labels:
      None
    • Environment:
      ubuntu
    • Number of attachments :
      0

      Description

      A new grails project.
      In the src folder a groovy class like:

      package de.app
      
      class User {
          String name
      
          public void setName(String name, String t = "") {
                this.name = name
          }
      }
      

      and in the src folder a java class like:

      package de.me;
      
      import de.app.User;
      
      public class App {
      
          public void make() {
              User u = new User();
          }
      }
      

      result:

      [groovyc] /tmp/groovy-generated-5423173608487992496-java-source/de/app/User.java:22: setName(java.lang.String) is already defined in de.app.User
        [groovyc] public  void setName(java.lang.String value) { }
        [groovyc]              ^
        [groovyc] 1 error
      

      removing the optional parameter (String t = "") works.

        Activity

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Marcel Kroschel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: