Skip to content

java.lang.IncompatibleClassChangeError when using Java-class, which implements @interface #8348

Closed
@scabug

Description

@scabug

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions