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/04/27 08:50:00 UTC
[jira] [Updated] (GROOVY-10358) Unable to resole method after LUB operator
[ https://issues.apache.org/jira/browse/GROOVY-10358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-10358:
-------------------------------
Fix Version/s: 4.0.2
> Unable to resole method after LUB operator
> ------------------------------------------
>
> Key: GROOVY-10358
> URL: https://issues.apache.org/jira/browse/GROOVY-10358
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Thodoris Sotiropoulos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.2
>
>
> I have the following program
> {code:java}
> interface I {
> int m(int x);
> }
> abstract class A implements I {
> }
> class B<T> extends A {
> public int m(int x) {
> return x + 1;
> }
> }
> public class C<T> extends A {
> public int m(int x) {
> return x - 1;
> }
> }
> class Test {
> void test() {
> C<String> x = null;
> int y = 1;
> ((true) ? x : new B<String>()).m(y);
> }
>
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 26: [Static type checking] - Cannot find matching method A#m(int). Please check if the declared type is correct and if the method exists.
> @ line 26, column 5.
> ((true) ? x : new B<String>()).m(y);
> ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master
--
This message was sent by Atlassian Jira
(v8.20.7#820007)