IncompatibleClassChangeError example
Peter Levart
peter.levart at gmail.com
Sun Jun 9 08:24:23 PDT 2013
Hi,
When I compile and run the following program with the latest tip of
lambda repo:
import java.util.function.Function;
import java.util.function.Supplier;
public class ICCEBug {
interface Value<T> extends Supplier<T> {
default <R> Value<R> map(Function<? super T, ? extends R> mapper) {
return new SuppliedValue<>(() -> mapper.apply(this.get()));
}
}
static class SuppliedValue<T> implements Value<T> {
private final Supplier<T> supplier;
SuppliedValue(Supplier<T> supplier) {
this.supplier = supplier;
}
@Override
public T get() {
return supplier.get();
}
}
public static void main(String[] args) {
Value<String> name = () -> "Peter";
Value<String> sentence = name.map(nm -> "Hello " + nm + "!");
System.out.println(sentence.get());
}
}
... I get the following exception:
Exception in thread "main" java.lang.IncompatibleClassChangeError: Class
ICCEBug$$Lambda$2 does not implement the requested interface ICCEBug$Value
at ICCEBug$Value.lambda$0(ICCEBug.java:17)
at ICCEBug$Value$$Lambda$3.get(Unknown Source)
at ICCEBug$SuppliedValue.get(ICCEBug.java:30)
at ICCEBug.main(ICCEBug.java:37)
It looks like something is not compiled correctly.
Regards, Peter
More information about the lambda-dev
mailing list