You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/12/20 18:51:00 UTC

[jira] [Commented] (GROOVY-9866) Inner class of superinterface cannot be found

    [ https://issues.apache.org/jira/browse/GROOVY-9866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17252491#comment-17252491 ] 

Eric Milles commented on GROOVY-9866:
-------------------------------------

This is a situation similar to what is described by GROOVY-4287, GROOVY-7812 and GROOVY-9243.  In this instance, an interface gets the placeholder treatment (see {{ConstructedOuterNestedClassNode}}) and must be resolved later.  Since interface {{I}} cannot be resolved when implementing class {{C}} is resolved, the type hierarchy cannot be explored fully for static inners.

I think you could have the same problem with super types, but I have not tested:
{code:groovy}
package p
class A {
  static class I {}
}
{code}
{code:groovy}
package p
class B extends A {
}
{code}
{code:groovy}
package p
class C extends B {
  def m(I eye) {
  }
}
{code}
{code:groovy}
// run this with "groovy" command
new p.C()
{code}

> Inner class of superinterface cannot be found
> ---------------------------------------------
>
>                 Key: GROOVY-9866
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9866
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.7
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>
> https://github.com/dovchinnikov/groovy-bug-inner-of-superinterface 
> {noformat}
> $ groovy playground.groovy
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> file:~/groovy-bug-inner-of-superinterface/com/foo/C.groovy: 11: unable to resolve class Level
>  @ line 11, column 24.
>        boolean isLoggable(Level level) {
>                           ^
> file:~/groovy-bug-inner-of-superinterface/com/foo/C.groovy: 16: unable to resolve class Level
>  @ line 16, column 14.
>        void log(Level level, ResourceBundle bundle, String msg, Throwable thrown) {}
>                 ^
> file:~/groovy-bug-inner-of-superinterface/com/foo/C.groovy: 19: unable to resolve class Level
>  @ line 19, column 14.
>        void log(Level level, ResourceBundle bundle, String format, Object... params) {}
>                 ^
> 3 errors
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)