Please review: Bug: https://bugs.openjdk.java.net/browse/JDK-8166187 Webrev: http://cr.openjdk.java.net/~hannesw/8166187/webrev/
It was actually the combination of having a non-serialisable AST reference and not initialising the transient fields of nested functions that caused this error. Thanks, Hannes