You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:35:01 UTC
[jira] [Closed] (GROOVY-10107) Cannot assign null to a variable with a bounded generic type
[ https://issues.apache.org/jira/browse/GROOVY-10107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-10107.
------------------------------
> Cannot assign null to a variable with a bounded generic type
> ------------------------------------------------------------
>
> Key: GROOVY-10107
> URL: https://issues.apache.org/jira/browse/GROOVY-10107
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-beta-1, 3.0.9
>
>
> I have the following program
> {code:java}
> final class Test<T extends Number> {
> final void m() {
> T v = null;
> }
> }
> {code}
> h3. Actual Behaviour
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 5: [Static type checking] - Cannot assign value of type <unknown parameter type> to variable of type T
> @ line 5, column 11.
> T v = null;
> ^1 error
> {code}
> h3. Expected Behaviour
>
> Tested against master https://github.com/apache/groovy/commit/7a56d7130aaf7b5244fa5a82fa0505fb7509f51f
--
This message was sent by Atlassian Jira
(v8.20.1#820001)