- changed status to resolved
Generic method lookup error
Issue #168
resolved
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 {
@SuppressWarnings("unchecked")
Object valueOf(Object in) {
return Helper.valueOf((Container) in);
}
}
The Helper.valueOf((Container) in)
call gives the following error message from ExtendJ:
Test.java:18: 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)
-
reporter -
reporter - changed status to open
The fix introduced another error.
-
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(); Collections.sort(v); } }
-
reporter - changed status to resolved
-
The sample of code I send you is still not compiling. Should I open another issue ?
-
reporter Yes please!
-
Done ! ^_^
- Log in to comment
Improve type variable type bound checking
fixes
#168(bitbucket)→ <<cset 895024e7f400>>