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 2020/11/24 01:44:00 UTC
[jira] [Resolved] (GROOVY-6882) STC: AIC cannot resolve overridden
method of outer class
[ https://issues.apache.org/jira/browse/GROOVY-6882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King resolved GROOVY-6882.
-------------------------------
Fix Version/s: 4.0.0-alpha-2
3.0.7
2.5.14
Resolution: Fixed
Proposed PR merged.
> STC: AIC cannot resolve overridden method of outer class
> --------------------------------------------------------
>
> Key: GROOVY-6882
> URL: https://issues.apache.org/jira/browse/GROOVY-6882
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 2.4.0-rc-1
> Reporter: Cédric Champeau
> Assignee: Eric Milles
> Priority: Major
> Fix For: 2.5.14, 3.0.7, 4.0.0-alpha-2
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Originally reported on StackOverflow: http://stackoverflow.com/questions/24321109/is-threre-any-way-to-ues-override-method-in-anonymous-class-on-groovy-compilest
> This fails with an ambiguous method error:
> {code}
> import groovy.transform.CompileStatic;
> interface HelloWorld {
> public void greet();
> }
> class HelloWorldAnonymousClassesParents {
> public void hi() {
> println "hi"
> }
> }
> @CompileStatic
> public class HelloWorldAnonymousClasses extends HelloWorldAnonymousClassesParents {
> public void hi() {
> System.out.println("hihi ");
> }
> public void sayHello() {
> HelloWorld spanishGreeting = new HelloWorld() {
> public void greet() {
> hi() //<- here [Static type checking] - Reference to method is ambiguous error
> System.out.println("spanishGreeting");
> }
> };
> spanishGreeting.greet();
> hi()
> }
> }
> def myApp = new HelloWorldAnonymousClasses();
> myApp.sayHello();
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)