@TypeChecked - Ambiguous method

173 views Asked by At

I have a following code:

@TypeChecked
class SomeClass {

  def someMethod( BridgeEvent event ){
    event.complete true // here comes the compile error
  }

}

the line shows an error in eclipse:

Groovy:[Static type checking] - Reference to method is ambiguous. Cannot choose between [void io.vertx.groovy.ext.web.handler.sockjs.BridgeEvent#complete(java.lang.Boolean), void io.vertx.groovy.ext.web.handler.sockjs.BridgeEvent#complete(java.lang.Object)]

The 1st method comes from the BridgeEvent class, the 2nd from it's superclass.

If I remove @TypeChecked the code is working just fine.

How can I fix the problem?

UPDATE:

I tried @tim-yates' solution event.complete Boolean.TRUE and compile error disappears, but the complete(java.lang.Object) method is doing something different, than the complete(boolean). So I need to call the later method.

For now I rewritten the code so:

@TypeChecked
class SomeClass {

  def someMethod( BridgeEvent event ){
    complete event
  }

  @TypeChecked( SKIP )
  private void complete( BridgeEvent event ){
    event.complete true
  }

}

and it's working great again, but the way it looks...

0

There are 0 answers