Github user shils commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/253#discussion_r52126075
  
    --- Diff: src/test/groovy/transform/stc/GenericsSTCTest.groovy ---
    @@ -1800,6 +1800,19 @@ assert result == 'ok'
     '''
         }
     
    +    // GROOVY-7742
    +    void testMethodParamWithDifferentPlaceholderForTypeArgument() {
    +        // We use <T> here while List uses <E>
    --- End diff --
    
    That was my thought initially as well, but in that case I would expect the 
following to fail since AtomicReference uses 'V' as a placeholder:
    ```
    import java.util.concurrent.atomic.AtomicReference
    
    @groovy.transform.CompileStatic
    class Foo {
        public <V> AtomicReference<V> firstReference(List<AtomicReference<V>> 
references) {
            return references.first()
        }
    }
    ```
    
    The code above compiles but, interestingly enough, the variant below does 
not:
    
    ```
    import java.util.concurrent.atomic.AtomicReference                          
       
    
    @groovy.transform.CompileStatic                                             
                                      
    class Foo {                                                                 
       
        public <T> AtomicReference<T> firstClass(List<AtomicReference<T>> 
references) {
            return references.first()                                           
       
        }                                                                       
       
    }
    ```                                                                         
         


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to