FW: What does IncompatibleClassChangeError signify?
Sebastian.Millies at softwareag.com
Wed Sep 25 01:53:38 PDT 2013
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?
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?
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$3.apply(Unknown Source)
at java8.monads.Monad$$Lambda$2.apply(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
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?
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