FW: What does IncompatibleClassChangeError signify?
Remi Forax
forax at univ-mlv.fr
Wed Sep 25 04:05:22 PDT 2013
IncompatibleClassChangeError usually means that you have modified a
functional interface without recompiling the class holding the lambda,
so the lambda conversion at creation site and the functional interface
disagree on the way to convert the lambda to an object.
By example, changing the name of the single method of the functional
interface is not a binary compatible change.
But without seeing the code, it's hard to say.
Rémi
On 09/25/2013 10:53 AM, Millies, Sebastian wrote:
> OK, follow-up: I have seen there is no class java8.monads.MaybeDemo$$Lambda$1 in the classes directory.
> So the lambda does get generated on the fly and must be linked, which explains why in principle there could be
> a LinkageError. In practice I still don't get it - aren't lambdas supposed to be type-safe?
>
> Can I somehow write out the generated lambda classes to a file to help me see what goes wrong? And would I
> have to inspect the byte code, or is there a decompiler that would give me some sort of source-level view of
> the lambda class?
>
>
> n Sebastian
>
> From: sebastian.millies at ids-scheer.com
> Sent: Wednesday, September 25, 2013 10:42 AM
> To: lambda-dev at openjdk.java.net
> Subject: What does IncompatibleClassChangeError signify?
>
> Hello there,
>
> This is with b106 under Windows. I have compiled some classes (no error) and then run one of them. At runtime I get:
>
> Exception in thread "main" java.lang.IncompatibleClassChangeError: Class java8.monads.MaybeDemo$$Lambda$1 does not implement the requested interface java8.monads.Monad
> at java8.monads.Monad.lambda$94(Monad.java:50)
> at java8.monads.Monad$$Lambda$3.apply(Unknown Source)
> at java8.monads.MaybeMonad.bind(MaybeMonad.java:23)
> at java8.monads.Monad.lambda$93(Monad.java:50)
> at java8.monads.MaybeMonad.lambda$93(MaybeMonad.java)
> at java8.monads.Monad$$Lambda$2.apply(Unknown Source)
> at java8.monads.MaybeMonad.bind(MaybeMonad.java:23)
> at java8.monads.Monad.ap(Monad.java:51)
> at java8.monads.MaybeMonad.ap(MaybeMonad.java)
> at java8.monads.MaybeDemo.main(MaybeDemo.java:35)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:491)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
>
> Now, the code is likely very wrong, contains unchecked and perhaps illegal casts, erroneous type parameters etc. However, I'd have expected ClassCastException, NoSuchMethodError, ClassNotFoundException, whatever, but not a subclass of LinkageError. After all, how *could* any classes have changed? Why should re-linkage happen at all? No class has dependencies outside the JDK. Does something strange happen under the hood? Under what circumstances should I expect IncompatibleClassChangeError when using lambdas?
>
> Best,
> Sebastian
>
>
> Software AG - Sitz/Registered office: Uhlandstra?e 12, 64297 Darmstadt, Germany - Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), Dr. Wolfram Jost, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Dr. Andreas Bereczky - http://www.softwareag.com
>
>
More information about the lambda-dev
mailing list