You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/04/30 14:33:00 UTC
[jira] [Resolved] (GROOVY-11035) Inferred type is Object when having a complex inheritance chain of interfaces
[ https://issues.apache.org/jira/browse/GROOVY-11035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-11035.
----------------------------------
Resolution: Duplicate
> Inferred type is Object when having a complex inheritance chain of interfaces
> -----------------------------------------------------------------------------
>
> Key: GROOVY-11035
> URL: https://issues.apache.org/jira/browse/GROOVY-11035
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Minor
>
> This seems related to GROOVY-11012.
> I have the following program
> {code}
> @Grab('org.apache.commons:commons-collections4:4.4')
> import org.apache.commons.collections4.iterators.*;
> class Main {
> @groovy.transform.TypeChecked test() {
> EmptyListIterator<Number> tmp = null
> Number x = tmp.next()
> }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 6: [Static type checking] - Cannot assign value of type java.lang.Object to variable of type java.lang.Number
> @ line 6, column 16.
> Number x = tmp.next();
> ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> h3. Notes
> Tested against master (commit: ed4b33c8d5ac71ee4963d6bb391850593c59e5b1)
> https://commons.apache.org/proper/commons-collections/javadocs/api-4.4/org/apache/commons/collections4/iterators/EmptyListIterator.html
--
This message was sent by Atlassian Jira
(v8.20.10#820010)