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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.4
    • 1.7.6, 1.8-beta-3
    • class generator
    • None
    • ubuntu

    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.

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            marcel166 Marcel Kroschel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: