overriding java method with an argument that is existentially typed not working

Greetings

I'm not sure whether I should open a ticket for this, perhaps it's already tracked somewhere...

The following compiles via sbt (and intelliJ's build automatically) but intelliJ highlights an error "resolveSigningKeyBytes overrides nothing" : 

val keyResolver = new io.jsonwebtoken.SigningKeyResolverAdapter {
override def resolveSigningKeyBytes(header: JwsHeader[T] forSome {type T <: JwsHeader[T]}, claims: Claims): Array[Byte] = ???
}

When I let intelliJ generate the method, it gets the following shape and the highlighted error disappears:

val keyResolver = new io.jsonwebtoken.SigningKeyResolverAdapter {
override def resolveSigningKeyBytes(header: JwsHeader[_], claims: Claims): Array[Byte] = ???
}

but now compilation via sbt (or intelliJ's build automatically) does not work anymore:

[error] {trimmed for brevity} ... method resolveSigningKeyBytes overrides nothing.
[error] Note: the super classes of <$anon: io.jsonwebtoken.SigningKeyResolverAdapter> contain the following, non final members named resolveSigningKeyBytes:
[error] def resolveSigningKeyBytes(x$1: io.jsonwebtoken.JwsHeader,x$2: String): Array[Byte]
[error] def resolveSigningKeyBytes(x$1: io.jsonwebtoken.JwsHeader,x$2: io.jsonwebtoken.Claims): Array[Byte]
[error] override def resolveSigningKeyBytes(header: JwsHeader[_], claims: Claims): Array[Byte] = ???
[error] ^
[error] one error found

The java classes are defined as follows, (trimmed for brevity):

public class SigningKeyResolverAdapter implements SigningKeyResolver {
...
public byte[] resolveSigningKeyBytes(JwsHeader header, Claims claims) {...}
...
}

public interface JwsHeader<T extends JwsHeader<T>> extends Header<T> {...}

public interface Header<T extends Header<T>> extends Map<String,Object> {...}

Thanks a lot for any pointers and have a great day,

Tanju

---

Scala Plugin: 2018.2.10.2

IntelliJ IDEA 2018.2.3 (Ultimate Edition)
Build #IU-182.4323.18, built on August 28, 2018
RE: 1.8.0_152-release-1248-b8 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

Please sign in to leave a comment.