Annotation Type GcMapped


@Target(TYPE) @Retention(RUNTIME) public @interface GcMapped
Marks a Java class or record as mappable to a WebAssembly GC struct type.

Fields are mapped in declaration order to GC struct fields. Supported field types are:

  • int / Integer → i32
  • long / Long → i64
  • float / Float → f32
  • double / Double → f64
  • boolean / Boolean → i32 (0/1)
  • Another @GcMapped type → struct reference

Example:


 @GcMapped
 public record Point(double x, double y) {}

 GcMarshaller marshaller = GcMarshaller.forExtension(gc);
 GcStructInstance struct = marshaller.marshal(new Point(1.0, 2.0));
 Point point = marshaller.unmarshal(struct, Point.class);
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional WasmGC struct type name.
  • Element Details

    • value

      String value
      Optional WasmGC struct type name. If empty, the simple class name is used.
      Default:
      ""