Class Substitutions
- All Implemented Interfaces:
org.teavm.extension.spi.substitution.SubstitutionPolicy
java.net at the ones in this package.
Found through META-INF/services, which is how the compiler's own class library registers
its substitutions. A project compiles against the real classes from the JDK, and the references are
rewritten when the program is compiled to WebAssembly, so a library that opens a socket or makes a
request the ordinary way needs no change and no shim.
URL, URLConnection and HttpURLConnection exist in the class library and
are replaced rather than supplied: its versions are wired to XMLHttpRequest, which this
platform does not have, so they compile and then fail on the first request. Socket,
InetAddress and the java.net.http client are absent from it and are supplied.
Only the classes named here are substituted. ServerSocket and DatagramSocket are
deliberately absent: the platform can accept no inbound connection and speaks no UDP, so a program
using either should fail while it is being built rather than throw once it is running.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontribute(org.teavm.extension.spi.substitution.SubstitutionSink sink) Methods inherited from class org.teavm.extension.spi.substitution.SimpleSubstitutionPolicy
inPackage, inPackage, named, namePattern, not
-
Constructor Details
-
Substitutions
public Substitutions()
-
-
Method Details
-
contribute
public void contribute(org.teavm.extension.spi.substitution.SubstitutionSink sink)
-