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 2018/09/27 17:21:00 UTC

[jira] [Created] (GROOVY-8815) Inconsistent class file - undefined type parameter for trait

Eric Milles created GROOVY-8815:
-----------------------------------

             Summary: Inconsistent class file - undefined type parameter for trait
                 Key: GROOVY-8815
                 URL: https://issues.apache.org/jira/browse/GROOVY-8815
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.5.2, 2.4.15
            Reporter: Eric Milles


When compiling the following classes, the Service class ends up with an incomplete type parameter in it.  This causes errors for the IDE: "Inconsistent classfile encountered: The undefined type parameter T is referenced from within Service"

{code:groovy}
import java.util.function.Consumer
import groovy.transform.CompileStatic

class Event<T> {
  Event(String id, T payload) {
  }
  Event<T> setReplyTo(Object replyTo) {
  }
}

@CompileStatic
trait Events {
  def <E extends Event<?>> Registration<Object, Consumer<E>> on(Class key, Closure consumer) {
  }
}

interface Registration<K, V> {
}
{code}



javap output for Events shows:
{code}
  public abstract <E extends reactor.bus.Event<?>> reactor.bus.registry.Registration<java.lang.Object, reactor.fn.Consumer<E>> on(java.lang.Class, groovy.lang.Closure);
{code}

javap output for Service shows:
{code}
  public <E extends Event<T>> Registration<java.lang.Object, java.util.function.Consumer<E>> on(java.lang.Class, groovy.lang.Closure);
  public <E extends Event<?>> Registration<java.lang.Object, java.util.function.Consumer<E>> Eventstrait$super$on(java.lang.Class, groovy.lang.Closure);
{code}

It is this "T" in the trait method that is not defined.  I think it should be "?" instead when looking at the original method's and the trait bridge method's type parameters.




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)