

In the case of the Java FFI, the compilerJava pod is the compiler plugin for importing the Java type system into Fantom.įantom code using the Java FFI results in a normal pod file compiled down into fcode. The Fantom compiler itself has no knowledge of Java libraries, rather it supports FFI plugins based on pods being prefixed with "". For example the Java package javax.swing has the Fantom pod name of javax.swing. Java packages are mapped to Fantom pods by prefixing the string "". Java APIs are imported into the Fantom type system via the normal using statement with a special syntax for pod names. The Java FFI does not use any special Fantom syntax. Int x = new int x := IntArray(5) How it Works Import using java.util::Map$Entry as Entry Quick reference for mapping Java code to Fantom code: Java Fantom

The following table summarizes the mapping of Java types to Fantom types: Java Type Fantom Typeįoo Foo // sys::List parameterized with Fooīoolean fanx.interop::BooleanArrayįoo // unsupported for both primitivies and Objects
