ParkerTenBroeck.github.io/content/blog/projects/generators.md
2026-04-27 23:18:26 -04:00

865 B

+++ title = "Generators" description = "A java 24 library that adds stackless coroutines to standard java code by transforming method bytecode into state machines at load time" date = 2025-05-07

[taxonomies] tags = ["java", "bytecode"] category = ["project"] +++

Take a look at the GitHub

public static Future<Void, IOException> echo(@Cancellation("close") Socket socket) throws IOException {
    try(socket){
        var buffer = ByteBuffer.allocate(4096*2);
        while(true){
            bytes_received = socket.read(buffer).await() + bytes_received;
            buffer.flip();
            bytes_sent = socket.write_all(buffer).await() + bytes_sent;
            buffer.clear().limit(buffer.capacity());
        }
    }
}

Java (and other languages which compile for the JVM) operate on a