diff --git a/Src/PCompiler/CompilerCore/Backend/Java/Constants.cs b/Src/PCompiler/CompilerCore/Backend/Java/Constants.cs index b21d20ad1..636487481 100644 --- a/Src/PCompiler/CompilerCore/Backend/Java/Constants.cs +++ b/Src/PCompiler/CompilerCore/Backend/Java/Constants.cs @@ -26,6 +26,7 @@ internal static class Constants private static readonly string[] JreDefaultImports = { + "java.io.Serializable" "java.util.*", }; diff --git a/Src/PCompiler/CompilerCore/Backend/Java/MachineGenerator.cs b/Src/PCompiler/CompilerCore/Backend/Java/MachineGenerator.cs index b05a576a2..f44072f89 100644 --- a/Src/PCompiler/CompilerCore/Backend/Java/MachineGenerator.cs +++ b/Src/PCompiler/CompilerCore/Backend/Java/MachineGenerator.cs @@ -116,7 +116,7 @@ private void WriteMonitorDecl() private void WriteSupplierCDef(string cname) { - WriteLine($"public static class Supplier implements java.util.function.Supplier<{cname}> {{"); + WriteLine($"public static class Supplier implements java.util.function.Supplier<{cname}>, Serializable {{"); WriteLine($"public {cname} get() {{"); WriteLine($"{cname} ret = new {cname}();"); WriteLine("ret.ready();"); // TODO: at this point, we may as well ready() within the monitor's constructor?