Bug: no single overload found. Probably due to generic super interface

Andreas Woess andreas.woess at oracle.com
Wed Aug 9 12:51:02 UTC 2017


Hi Jerven,

thanks for the bug report. I've pushed a fix for it [1]. Naturally, it 
will be part of the next GraalVM release (0.27).

[1] 
https://github.com/graalvm/graal/commit/08abcb23d1d3f736f98d2dda6e04392f13912691

Regards,
Andreas

On 08/08/2017 16:47, Jerven Tjalling Bolleman wrote:
> Hi All,
>
> I have a class hierarchy like this in Java. I am not using the real 
> hierarchy because it are large objects which hide the details. But the 
> following Junit should demonstrate the issue.
>
> package org.expasy.services.taxonomy.view;
>
> import static org.junit.Assert.assertEquals;
>
> import org.graalvm.polyglot.Context;
> import org.graalvm.polyglot.Value;
> import org.junit.Test;
>
> public class GraalTest
> {
>     public interface Identity<T>{
>         public T getId();
>     }
>
>     public interface SomeClassOfThingWithIdentity extends 
> Identity<Integer>{
>         public Integer getId();
>     }
>
>     public class ActualRealThingWithIdentity
>         implements SomeClassOfThingWithIdentity {
>         Integer id = 1;
>
>         public Integer getId(){
>             return id;
>         };
>     }
>
>     @Test
>     public void test(){
>         final Value value = Context.create("js").eval("js", 
> "function(example){return `${example.getId().toString()}`;}");
>         String result = value.execute(new 
> ActualRealThingWithIdentity()).asString();
>         assertEquals("1", result);
>     }
> }
>
> This fails with the following stacktrace
>
> org.graalvm.polyglot.PolyglotException: 
> java.lang.IllegalArgumentException: no single overload found 
> (candidates: [Method[public java.lang.Integer 
> org.expasy.services.taxonomy.view.GraalTest$ActualRealThingWithIdentity.getId()], 
> Method[public java.lang.Object 
> org.expasy.services.taxonomy.view.GraalTest$ActualRealThingWithIdentity.getId()]], 
> arguments: [])
>     at 
> com.oracle.truffle.api.interop.java.ExecuteMethodNode.ambiguousOverloadsException(ExecuteMethodNode.java:441)
>     at 
> com.oracle.truffle.api.interop.java.ExecuteMethodNode.selectOverload(ExecuteMethodNode.java:270)
>     at 
> com.oracle.truffle.api.interop.java.ExecuteMethodNodeGen.executeAndSpecialize(ExecuteMethodNodeGen.java:179)
>     at 
> com.oracle.truffle.api.interop.java.ExecuteMethodNodeGen.execute(ExecuteMethodNodeGen.java:75)
>     at 
> com.oracle.truffle.api.interop.java.JavaObjectMessageResolution$InvokeNode.access(JavaObjectMessageResolution.java:94)
>     at 
> com.oracle.truffle.api.interop.java.JavaObjectMessageResolutionForeign$InvokeSubNode.accessWithTarget(JavaObjectMessageResolutionForeign.java:229)
>     at 
> com.oracle.truffle.api.interop.java.JavaObjectMessageResolutionForeignFactory$InvokeSubNodeGen.executeAndSpecialize(JavaObjectMessageResolutionForeignFactory.java:267)
>     at 
> com.oracle.truffle.api.interop.java.JavaObjectMessageResolutionForeignFactory$InvokeSubNodeGen.executeWithTarget(JavaObjectMessageResolutionForeignFactory.java:249)
>     at 
> com.oracle.truffle.api.interop.java.JavaObjectMessageResolutionForeign$InvokeSubNode$INVOKERootNode.execute(JavaObjectMessageResolutionForeign.java:247)
>     at <js> :program$0(Unnamed:1:28-42)
>     at org.graalvm.polyglot.Value.execute(Value.java:162)
>     at 
> org.expasy.services.taxonomy.view.GraalTest.test(GraalTest.java:31)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at ....
>
>
> Regards,
> Jerven
>



More information about the graal-dev mailing list