@InjectedBy(IntegerNativeGenerator.class) public static native int remainderUnsigned(int dividend, int divisor); }
private static void handleNativesImpl(Value<TeaVMHost> host, Value<TeaVMJavaScriptHost> jsHost, ReflectClass<?> cls) { for (ReflectMethod method : cls.getDeclaredMethods()) { if (!Modifier.isNative(method.getModifiers())) { continue; } GeneratedBy generatedBy = method.getAnnotation(GeneratedBy.class); if (generatedBy != null) { ReflectClass<?> generatorClass = findClass(generatedBy.value().getName()); ReflectMethod generatorConstructor = generatorClass.getMethod("<init>"); Value<MethodReference> methodRef = methodToReference(method); emit(() -> jsHost.get().add(methodRef.get(), (Generator) generatorConstructor.construct())); } InjectedBy injectedBy = method.getAnnotation(InjectedBy.class); if (injectedBy != null) { ReflectClass<?> generatorClass = findClass(injectedBy.value().getName()); ReflectMethod generatorConstructor = generatorClass.getMethod("<init>"); Value<MethodReference> methodRef = methodToReference(method); emit(() -> jsHost.get().add(methodRef.get(), (Injector) generatorConstructor.construct())); } PluggableDependency dependency = method.getAnnotation(PluggableDependency.class); if (dependency != null) { ReflectClass<?> generatorClass = findClass(dependency.value().getName()); ReflectMethod generatorConstructor = generatorClass.getMethod("<init>"); Value<MethodReference> methodRef = methodToReference(method); emit(() -> host.get().add(methodRef.get(), (DependencyPlugin) generatorConstructor.construct())); } } }
@InjectedBy(ConverterInjector.class) public static native PlatformObject fromJava(Object object);
@InjectedBy(JSNativeGenerator.class) public static native JSObject arrayData(Object array);
@InjectedBy(ConverterInjector.class) public static native PlatformSequence<PlatformObject> arrayFromJava(Object[] objects); }
@InjectedBy(JSNativeGenerator.class) public static native float unwrapFloat(JSObject value);
@InjectedBy(IntegerNativeGenerator.class) public static native int divideUnsigned(int dividend, int divisor);
@InjectedBy(ClassLoaderNativeGenerator.class) private static native ResourceContainer supplyResources();
@InjectedBy(ConverterInjector.class) public static native Object toJava(PlatformObject jsObject);
@InjectedBy(JSNativeGenerator.class) public static native boolean unwrapBoolean(JSObject value);
@InjectedBy(JSNativeGenerator.class) public static native byte unwrapByte(JSObject value);
@InjectedBy(JSNativeGenerator.class) public static native char unwrapCharacter(JSObject value);
@InjectedBy(JSNativeGenerator.class) public static native double unwrapDouble(JSObject value);
@InjectedBy(JSNativeGenerator.class) public static native short unwrapShort(JSObject value);
@InjectedBy(JSNativeGenerator.class) public static native int unwrapInt(JSObject value);
@InjectedBy(JSNativeGenerator.class) @PluggableDependency(JSNativeGenerator.class) public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c, JSObject d, JSObject e, JSObject f, JSObject g, JSObject h);
@InjectedBy(JSNativeGenerator.class) @PluggableDependency(JSNativeGenerator.class) public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c, JSObject d, JSObject e, JSObject f, JSObject g, JSObject h, JSObject i, JSObject j, JSObject k, JSObject l, JSObject m);
@InjectedBy(PlatformQueueGenerator.class) @PluggableDependency(PlatformQueueGenerator.class) private static native <S> S unwrap(PlatformObject obj); }
@InjectedBy(JSNativeGenerator.class) @PluggableDependency(JSNativeGenerator.class) public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c, JSObject d);
@InjectedBy(JSNativeGenerator.class) @PluggableDependency(JSNativeGenerator.class) public static native JSObject invoke(JSObject instance, JSObject method, JSObject a, JSObject b, JSObject c, JSObject d, JSObject e, JSObject f);