You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2021/09/27 12:14:00 UTC
[jira] [Closed] (GROOVY-10264) Issue with the diamond operator and
conditional
[ https://issues.apache.org/jira/browse/GROOVY-10264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thodoris Sotiropoulos closed GROOVY-10264.
------------------------------------------
Resolution: Duplicate
related to https://issues.apache.org/jira/browse/GROOVY-10226
> Issue with the diamond operator and conditional
> -----------------------------------------------
>
> Key: GROOVY-10264
> URL: https://issues.apache.org/jira/browse/GROOVY-10264
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Priority: Major
>
> I have the following program
> {code:java}
> class A<T extends Number> {
> T foo() {
> T x = null;
> (true) ?
> new B<>(x).f: new B<>(x).f
> }
> }
> class B<X> {
> X f;
> B(X x) {
> this.f = f;
> }
> }
> {code}
> h3. Actual behaviour
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 4: [Static type checking] - Cannot return value of type java.lang.Object on method returning type T
> @ line 4, column 5.
> (true) ?
> ^1 error
> {code}
> h3. Expected Behaviour
> Compile successfuly
>
> Tested against master ([https://github.com/apache/groovy/commit/2a97313250875d60df82302f31d77dd7f07ae685])
>
> I think this is related to https://issues.apache.org/jira/browse/GROOVY-10226. So I close this.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)