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

Incorrect overload selection for subclasses

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • 4.0.12
    • None
    • Static compilation
    • None

    Description

      I'm writing a Spring Security configurer and trying to add it to my configuration using apply(C), but the Groovy compiler selects the wrong overload, and necessary initialization is not performed.

      @Grab('org.springframework.security:spring-security-config:5.7.11')
      import org.springframework.security.config.annotation.authentication.builders.*
      import org.springframework.security.config.annotation.web.configurers.*
      import org.springframework.security.config.annotation.web.builders.*
      @Grab('org.springframework.security:spring-security-web:5.7.11')
      import org.springframework.security.web.*
      @Grab('javax.servlet:servlet-api:2.5')
      // AbstractHttpConfigurer extends SecurityConfigurerAdapter
      class MyConfigurer extends AbstractHttpConfigurer<MyConfigurer, HttpSecurity> {}
      
      SecurityFilterChain securityFilterChain(HttpSecurity http) {
        http.apply(new MyConfigurer())
           // ^ should select apply(SecurityConfigurerAdapter), but selects apply(SecurityConfigurer)
          .and()
          .build()
      }
      
      securityFilterChain(new HttpSecurity({ }, new AuthenticationManagerBuilder({ }), [:]))
      

      This is probably a result of an edge case in the generics, since the bounds on the overloads are determined by type parameters.

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              chrylis Christopher Smith
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: