M25 Assertion code cannot be removed in method. Unsupported Java compiler


I’m getting the following error when trying to build an application.

=============== [ Initialization Stage ] ===============
Platform connected to BSP location '.microej\workspaces\MicroEJ-SDK-Dist-21.03\ESP32WROVER-HDAHT-GNUv52b96_xtensa-esp32-psram-1.8.3\source/bsp' using platform included 'bsp' folder.
=============== [ Launching SOAR ] ===============
	[M25] - Assertion code cannot be removed in method ... (Unsupported Java compiler).

Soar image generation aborted.

The app is using some assert statements for nullity checks,
but i’m not sure if this is the cause.

factory = SocketFactory.getDefault();
assert factory != null;

I’m using:
Java: jdk-
SDK: 5.4.1

Any guidance on this?


You are right, this error is thrown when SOAR was not able assert statement could not be removed.
This can be the case when trying to link an external .class file that has been built outside MicroEJ SDK (which is based on Eclipse JDT compiler).

Can you check if you are in that situation ?

The library is built using MicroEJ SDK.

I was able to reproduce the issue with this simple code snippet. it seems to be related to the continue statement in the catch close.

public class Main {

	public static void main(String[] args) {
		while (true) {

			boolean shoudlContinue = true;
			try {
			} catch (Exception e) {
				assert shoudlContinue;

			if (!shoudlContinue) { break; }

	private static void throwException() throws Exception {
		throw new Exception();

Thanks for your extract, it really helps.

I just tested your code:

  • using a Platform based on Architecture 7.15.0 => fails with the same SOAR error.
  • using a Platform based on Architecture 7.16.0 => build works.

By taking a look to the Architecture Changelog, I see the following line which also likely fixed your issue:

I have updated my platform to use architecture 7.16.0 and it works.
Thank you