i have a Java-Interface that i want to implement in Scala. The Interface contains the following method-declaration:
public Boolean existsTable(String tableId);
My Scala-Implementation is:
override def existsTable(tableId: String): Boolean = {
val dbmeta = connection.getMetaData()
val dbtables = dbmeta.getTables(null, null, channelId, null)
if (dbtables.next())
// table exists
return true
else
return false
}
For some reason i get the error "overriding method existsTable in trait xyz of type (tableId: String)Boolean; method existsTable has incompatible type"
But i dont really know where there could be an incompatible type since its just a Boolean that is the return-type?
Greetings.
PS: I had this method working once before in the exact way, when i wasnt implementing an interface, so there should be no error in the method itself. It's just the Implementation of the Java-Interface in Scala that's giving me a hard time.
publicmodifier on interface method declarations is redundant; also, why not justreturn dbtables.next()? (and whyBooleanand notbooleanwhile we're at it?)override def existsTable(tableId: String): java.lang.Boolean.