package autostack;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.LongBuffer;

import org.lwjgl.PointerBuffer;

public class Stack {

    public static IntBuffer stackMallocInt(int size) {
        /* Will be transformed anyway */
        throw new AssertionError("Please start the JVM with -javaagent:autostack.jar");
    }

    public static PointerBuffer stackMallocPointer(int size) {
        /* Will be transformed anyway */
        throw new AssertionError("Please start the JVM with -javaagent:autostack.jar");
    }

    public static LongBuffer stackMallocLong(int size) {
        /* Will be transformed anyway */
        throw new AssertionError("Please start the JVM with -javaagent:autostack.jar");
    }

    public static FloatBuffer stackMallocFloat(int size) {
        /* Will be transformed anyway */
        throw new AssertionError("Please start the JVM with -javaagent:autostack.jar");
    }

    public static IntBuffer stackCallocInt(int size) {
        /* Will be transformed anyway */
        throw new AssertionError("Please start the JVM with -javaagent:autostack.jar");
    }

    public static PointerBuffer stackCallocPointer(int size) {
        /* Will be transformed anyway */
        throw new AssertionError("Please start the JVM with -javaagent:autostack.jar");
    }

    public static LongBuffer stackCallocLong(int size) {
        /* Will be transformed anyway */
        throw new AssertionError("Please start the JVM with -javaagent:autostack.jar");
    }

    public static FloatBuffer stackCallocFloat(int size) {
        /* Will be transformed anyway */
        throw new AssertionError("Please start the JVM with -javaagent:autostack.jar");
    }

}

Add simple user API to stack-allocate NIO buffers
Add simple user API to stack-allocate NIO buffers

I wanted to play a bit with a user API in the form of a Stack class,
whose static method implementations immediately throw an exception if
the JVM is not started with a Java Agent to give the user feedback.