[ https://issues.apache.org/jira/browse/GROOVY-10977?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-10977: ------------------------------------ Assignee: Eric Milles > STC does not catch the type error when a generic is instantiated with bounded > type parameter > -------------------------------------------------------------------------------------------- > > Key: GROOVY-10977 > URL: https://issues.apache.org/jira/browse/GROOVY-10977 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Reporter: Thodoris Sotiropoulos > Assignee: Eric Milles > Priority: Major > > Probably this is a regression, because groovyc 4.0.10 catches the error. > Program: > {code} > import java.util.*; > public class Test { > public static <T extends Number> void test() { > List<T> d = null; > d.add(false); > } > } > {code} > h3. Actual behavior > Groovyc compiles the code > h3. Expected behavior > Groovyc rejects the code with a message of the form: > {code} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > test.groovy: 8: [Static type checking] - Cannot find matching method > java.util.List#add(boolean). Please check if the declared type is correct and > if the method exists. > @ line 8, column 7. > d.add(false); > ^ > 1 error > {code} > Tested against master -- This message was sent by Atlassian Jira (v8.20.10#820010)