@GeneratedBy(JavaScriptConvGenerator.class) public static native Object fromJavaScript(Object obj, Object cls); }
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())); } } }
@GeneratedBy(DateTimeZoneProviderGenerator.class) private static native boolean timeZoneDetectionEnabled();
@GeneratedBy(ClassGenerator.class) private static native void createMetadata();
@GeneratedBy(JavaScriptConvGenerator.class) public static native Object toJavaScript(Object obj);
@GeneratedBy(LongNativeGenerator.class) public static native long remainderUnsigned(long dividend, long divisor); }
@GeneratedBy(LongNativeGenerator.class) public static native long divideUnsigned(long dividend, long divisor);
@GeneratedBy(PlatformGenerator.class) private static native void prepareNewInstance();
@GeneratedBy(SystemNativeGenerator.class) @DelegateTo("doArrayCopyLowLevel") private static native void doArrayCopy(Object src, int srcPos, Object dest, int destPos, int length);
@GeneratedBy(MathNativeGenerator.class) @Import(module = "teavmMath", name = "sin") public static native double sin(double a);
@GeneratedBy(MathNativeGenerator.class) @Import(module = "teavmMath", name = "asin") public static native double asin(double a);
@GeneratedBy(JSNativeGenerator.class) @PluggableDependency(JSNativeGenerator.class) public static native JSObject functionAsObject(JSObject instance, JSObject property); }
@GeneratedBy(ArrayNativeGenerator.class) @PluggableDependency(ArrayNativeGenerator.class) private static native void setImpl(TObject array, int index, TObject value); }
@GeneratedBy(JSNativeGenerator.class) @PluggableDependency(JSNativeGenerator.class) public static native JSObject function(JSObject instance, JSObject property);
@GeneratedBy(PlatformGenerator.class) @PluggableDependency(PlatformGenerator.class) public static native Object clone(Object obj);
@GeneratedBy(MathNativeGenerator.class) @Import(module = "teavmMath", name = "pow") public static native double pow(double x, double y);
@GeneratedBy(ArrayNativeGenerator.class) @DelegateTo("newInstanceLowLevel") private static native TObject newInstanceImpl(PlatformClass componentType, int length);
@DelegateTo("currentTimeMillisLowLevel") @GeneratedBy(SystemNativeGenerator.class) public static native long currentTimeMillis();
@GeneratedBy(PlatformGenerator.class) @PluggableDependency(PlatformGenerator.class) public static native PlatformClass lookupClass(String name);
@GeneratedBy(PlatformGenerator.class) @PluggableDependency(PlatformGenerator.class) public static native int schedule(PlatformRunnable runnable, int timeout);