Calling from Java JSR223 publishMQTT() impossible

I am trying to write a JSR223 script in a statically typed language. In particular I want to use Java as language and this plugin https://community.openhab.org/t/java223-scripting-script-with-java-on-openhab-4-3-0-0-5-0-0-0/ . I want to send a message over MQTT.

@InjectBinding org.openhab.core.automation.module.script.defaultscope.ScriptThingActions actions;
ThingActions mqtt_broker = actions.get("mqtt", "mqtt:broker:b1");
logger.debug(mqtt_broker.toString());

The last line prints org.openhab.binding.mqtt.internal.action.MQTTActions@141b70e. I cannot execute mqtt_broker.publishMQTT as the ThingActions has no such method. At the same time I cannot import org.openhab.binding.mqtt.internal.action.MQTTActions, and cast to it, as on OH 4.3 in org.openhab.binding.mqtt:META-INF/MANIFEST.MF contains

Export-Package: org.openhab.binding.mqtt;uses:="org.openhab.core.thing";
 version="4.`3.8",org.openhab.binding.mqtt.discovery;uses:="org.openhab.c
 ore.config.discovery,org.openhab.core.io.transport.mqtt,org.openhab.cor
 e.thing";version="4.3.8",org.openhab.binding.mqtt.handler;uses:="org.op
 enhab.binding.mqtt.discovery,org.openhab.core.io.transport.mqtt,org.ope
 nhab.core.thing,org.openhab.core.thing.binding,org.openhab.core.types";
 version="4.3.8"

However this works in Groovy/JSR223, as it is not so statically typed:

@Field var mqtt_broker = actions.get("mqtt", "mqtt:broker:b1")
mqtt_broker.publishMQTT("a", "bcd")
```

How in a statically typed JSR223 language one can call actions.get(“mqtt”, “mqtt:broker:b1”) and then on the result publishMQTT()?

This is how it works:

@InjectBinding org.openhab.core.automation.module.script.defaultscope.ScriptThingActions actions;
org.openhab.core.thing.binding.ThingActions mqttBroker = actions.get("mqtt", "mqtt:broker:b1");
try {
  java.lang.reflect.Method pub = mqttBroker.getClass().getMethod("publishMQTT", String.class, String.class);
  pub.invoke(mqtt_broker, topic, value);  //where topic and value are String
} catch (java.lang.NoSuchMethodException | java.lang.IllegalAccessException | java.lang.reflect.InvocationTargetException e) {}

The correct caption is Java JSR 223, not JavaScript JSR 223. With JavaScript it works, as JS is dynamically typed language. I do not know why the caption was changed.

With Java JSR 223 I mean the add-on from Java223 Scripting - Script with Java on openHAB [5.0.1.0,6.0.0.0) .

With JSScripting (GraalVM) this worked

var mqtt_broker = actions.get("mqtt", "mqtt:broker:b1")
mqtt_broker.publishMQTT("a", "b")

so the question is explicitly not for JavaScript.

I know you don’t want to use the helper library, but for others who might find this topic after a search: this is already in the generated code by the java223 bundle.
For each openHAB Actions, a method is generated with this kind of dynamic call inside, allowing easy, static, strongly typed, and no external import solution.