Closed
Description
When invoking method from instances of class, which implement interfaces, declared in Java as public @interface SomeInterface
- then throws java.lang.IncompatibleClassChangeError
. But if use that in Java classes - all works fine. Now to solve this problem used workaround which use static methods from Java-class with additional argument of this-object.
for example:
// In Java
public @interface TableColumn {
int width() default -1;
}
public class TableColumnImpl implements TableColumn {.......}
public class TableWorkAround {
public int width(TableColumnImpl column) { return column.width();}
}
// In Scala
...
val column: TableColumnImpl = getSomeFuncReturn_TableColumnImpl
val widthScala = column.width // throw IncompatibleClassChangeError
val widthJava = TableWorkAround.width(column) // works fine
when disassembly
in scala call of method -> invokeinterface
in java call of method -> invokevirtual
Full bundle, which replicates this behaviour in bundle.zip, which attached