[ 
https://issues.apache.org/jira/browse/GROOVY-10267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10267:
---------------------------------
    Description: 
I have the following program
{code:java}
class A<T> {
}
class B {
  A<? extends Object> test() {
    return test2();
  }
  A<? extends Object> test2() {
    return null;
  }
}
{code}

h3. Actual behaviour
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 6: [Static type checking] - Incompatible generic argument types. 
Cannot assign A<?> to: A<? extends java.lang.Object>
 @ line 6, column 12.
       return test2();
              ^1 error

{code}

h3. Expected behaviour
Compile successfully

Tested against master

  was:
I have the following program

 
{code:java}
class A<T> {}
class B {
  A<? extends Object> test() {
    return test2();
  }  A<? extends Object> test2() {
    return null;
  }
}{code}
h3. Actual behaviour

 
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 6: [Static type checking] - Incompatible generic argument types. 
Cannot assign A<?> to: A<? extends java.lang.Object>
 @ line 6, column 12.
       return test2();
              ^1 error

{code}
h3. Expected behaviour

Compile successfully

 

Tested against master

 

 

 

 


> STC reports wrong message when encoutering wildcard types
> ---------------------------------------------------------
>
>                 Key: GROOVY-10267
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10267
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>
> I have the following program
> {code:java}
> class A<T> {
> }
> class B {
>   A<? extends Object> test() {
>     return test2();
>   }
>   A<? extends Object> test2() {
>     return null;
>   }
> }
> {code}
> h3. Actual behaviour
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 6: [Static type checking] - Incompatible generic argument types. 
> Cannot assign A<?> to: A<? extends java.lang.Object>
>  @ line 6, column 12.
>        return test2();
>               ^1 error
> {code}
> h3. Expected behaviour
> Compile successfully
> Tested against master



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to