GNOME Bugzilla – Bug 538405
Implementing generic interface with concrete type doesn't work
Last modified: 2008-07-30 21:04:07 UTC
Please describe the problem: It is not possible to implement a generic interface with a concrete type. Steps to reproduce: public interface MyInterface<G> { public abstract void method_a (G param); public abstract G method_b (); } public class MyIterator : GLib.Object, MyInterface<int> { public void method_a (int param) { // do something } public int method_b () { return 0; } } Actual results: testcase.vala:8.5-8.24: error: overriding method `MyIterator.method_a' is incompatible with base method `MyInterface.method_a': incompatible type of parameter 1. public void method_a (int param) { ^^^^^^^^^^^^^^^^^^^^ testcase.vala:12.5-12.23: error: overriding method `MyIterator.method_b' is incompatible with base method `MyInterface.method_b': incompatible return type. public int method_b () { ^^^^^^^^^^^^^^^^^^^ Compilation failed: 2 error(s), 0 warning(s) Expected results: The generic parts of the parent interface should be fixated to the specified type, in this case 'int'. Does this happen every time? Other information:
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 511286 ***