Support reflection on lambdas and function expressions

Write a special annotation containing the bytes for the Callable protobuf
message and deserialize it at runtime properly

 #KT-9005 Fixed
This commit is contained in:
Alexander Udalov
2015-09-02 12:01:24 +03:00
parent 73ae0751ee
commit df935f5bb7
11 changed files with 204 additions and 16 deletions
@@ -54,6 +54,19 @@ public class SerializationUtil {
}
}
@NotNull
public static byte[] serializeCallableData(@NotNull NameResolver nameResolver, @NotNull ProtoBuf.Callable callableProto) {
try {
ByteArrayOutputStream result = new ByteArrayOutputStream();
serializeNameResolver(result, nameResolver);
callableProto.writeTo(result);
return result.toByteArray();
}
catch (IOException e) {
throw UtilsPackage.rethrow(e);
}
}
private static void serializeNameResolver(@NotNull OutputStream out, @NotNull NameResolver nameResolver) {
serializeStringTable(out, nameResolver.getStringTable(), nameResolver.getQualifiedNameTable());
}