Details
Description
Consider an example base class:
class BaseObject { void trace(Integer logLevel, Object... args) { /* ... */ } void trace(Object... args) { /* ... */ } }
and the extending class:
@CompileStatic class ChildObject extends BaseObject { void doSomething() { trace('test2') // OK super.trace('test2') // OK trace(1, 'test1') // OK super.trace(1, 'test1') // compilation error } }
When a type checked compilation is enabled following error appears on the last line of 2nd example class:
[Static type checking] - Reference to method is ambiguous. Cannot choose between [MethodNode@1022828757[void trace([Ljava.lang.Object;)], MethodNode@76324664[void trace(java.lang.Integer, [Ljava.lang.Object;)]]
I've come across this problem when extending closed library class which has methods of such signatures. Only difference is no Integer passed, but some custom class object of the library API as the 1st param. Compilation error is the same.
Pay attention to the fact, that the error is thrown only when 'super' keyword preceding method call.