Bump minimum Java version to 17
Java 17 was released almost 5 years ago. Since the migration between post-8 versions does not bring as much pain as the migration from 8 to 11, it was decided to bump minimum Java version to 17. There are dependencies (like Jetty) that require Java 17 or higher. You can still compile your project with Java 11, but then when you need to run TeaVM with at least Java 17.
TeaVM public dependencies like JSO still compatible with Java 11.
New compiler extension API
Previously, TeaVM allowed describing the list of reflectable entries by extending ReflectionSupplier class and registering it using ServiceLoader convention. The problem with this approach was that the ReflectionSupplier API relied on compiler internals, which are not guaranteed to be stable.
0.15.0 introduces new public user-friendly API for introspecting compiler structures in reflection-style way. It does not include any compiler modules as dependencies. Additionally, this API adds more user-friendly fluent configuration, for example:
selectClasses(withAnnotation(MyReflectable.class))
.reflectablePublicMembers()
.foundByName();Together with reflection definitions, there are two new extension points: ResourcePolicy and SubstibutionPolicy. The former allows to control which resources are included in the final bundle. The latter allows to substitute certain classes with TeaVM-specific implementation. Primary goal is to provide web-friendly implementations of classes that rely heavily on native routines.
Old APIs are now deprecated. Moreover, former META-INF/teavm.properties approach is no more supported: it was never documented and never considered public.
Improvements to reflection
Following APIs added:
java.lang.reflect.Proxyjava.lang.reflect.Executable#getParameterAnnotationsjava.lang.reflect.Executable#getExceptionTypes
Also, this version fixes a bug with calling async methods via reflection.
Improvements to Wasm GC backend
New internal representation for Wasm instructions
TeaVM added support for WebAssembly in early pre-MVP stages. Back then early proposals relied on expression-based (tree) syntax for method bodies. Later, the committee change it with instruction-based (flat) syntax, but TeaVM never had a chance to switch to this one, performing conversion right at the stage of WebAssembly binary format emission. Now, TeaVM finally closes this gap and represents WebAssembly instructions as is, which allows more efficient code generation.
As an example, TeaVM starts utilizing local.tee instruction instead of pairs of local.set/local.get, which in turn can decrease module size by up to 1%.
Replace try with try_table instruction
Exception handling support in WebAssembly had made a thorny way, with at least one deprecation. TeaVM witnessed this and stuck at the former (now deprecated) way to encode exceptions. Now TeaVM closes this gap as well and starts emitting new exception handling instruction. As a consequence, you will notice that Firefox does not log warnings when loading Wasm modules, produced by TeaVM.
Stop bundling TeaVM with IDEA plugin
Previously, TeaVM IDEA plugin bundled full TeaVM. This made it impossible to sit on recent IDEA plugin versions (actually, IDEA always suggests to upgrade to the most recent one), while having a Maven/Gradle project of a bit older version. Now, IDEA plugin downloads TeaVM on demand, taking the version that is used in the project.
This improvement has one small issue though: this all works ONLY starting 0.15.0. So, you can't install TeaVM IDEA plugin version 0.15.0 and use it to build, for example, 0.14.1. But as soon as your IDEA plugin is updated to 0.16.0 and so on, you'll still be able to build with 0.15.0.
Other improvements
- Support for
java.lang.ref.Cleaner - Fix dev server Gradle tasks compatible with configuration cache
- Add Jetbrains'
@Languageannotation to@JSBody, so that JavaScript in@JSBodyis highlighted in IDEA. - add
debugproperty to Gradle configuration to turn on all debugging properties in one shot.
Sponsors
A big thank you to Oki{ine and @shannah, for sponsoring the project as well as other sponsors (see full list). You can join these people and start supporting the project.