Generic method lookup error

Issue #168 resolved
Jesper Öqvist created an issue

ExtendJ 8.0.1-115-ge711456

There is an error in the method lookup in ExtendJ which causes it to discard a matching generic method when using certain types of type variable bounds and a raw formal argument type. This test case exposes the bug:

// Test accessing a parameterized static method using a raw parameter value.
// .result=COMPILE_PASS
class Container<T> {
  T value;

class Foo<T> { }

class Helper {
  static <T extends Foo<T>> T valueOf(Container<T> c) {
    return c.value;

public class Test {
  Object valueOf(Object in) {
    return Helper.valueOf((Container) in);

The Helper.valueOf((Container) in) call gives the following error message from ExtendJ: error: no method named valueOf(Container) in Helper matches. However, there is a method valueOf(Container<T>)

The error goes away if the signature of the Helper.valueOf method is changed to the following:

static <T> T valueOf(Container<T> c) {...

Comments (7)

  1. Loïc Girault

    I was about to submit an issue about generic method lookup that does not work with raw types. Seems related to this issue so I just post you the sample of code that does not work:

    package p;
    import java.util.Vector;
    import java.util.Collections;
    class C {
        void m(){
            Vector v = new Vector();
  2. Log in to comment