[
https://issues.apache.org/jira/browse/GROOVY-11035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-11035:
---------------------------------
Description:
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
was:
This seems related to GROOVY-11012.
I have the following program
{code}
import org.apache.commons.collections4.iterators.*;
class Main {
static final void 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)
> 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
> 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)