Daniel Huss created GROOVY-11071:
------------------------------------

             Summary: Compiler error related to getAt and type parameters
                 Key: GROOVY-11071
                 URL: https://issues.apache.org/jira/browse/GROOVY-11071
             Project: Groovy
          Issue Type: Bug
          Components: class generator
    Affects Versions: 4.0.12, 3.0.17
            Reporter: Daniel Huss


*Error message:*
{code:none}
BUG! exception in phase 'class generation' in source unit 
'...Reproducer.groovy' At line 11 column 21
On receiver: myMap with message: getAt and arguments: new Reproducer$Key()
This method should not have been called. {code}
*Simple example reproducing the error:*
{code:groovy}
import groovy.transform.CompileStatic
import org.junit.jupiter.api.Test

@CompileStatic
class Reproducer {

    @Test
    void reproduce() {
        MyMap myMap = null
        try {
            println(myMap[new Key()].toString())
        } catch (NullPointerException ignored) {
            // Expected
        }
    }

    static class Key {}

    static interface SomeMap<SELF extends SomeMap<SELF, K, V>, K, V> {
        V getAt(K key);
    }

    static interface MyMap extends SomeMap<MyMap, Key, Object> {}
}
 {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to