From 2d1bc6c9568d61fb52e109107729f2d4d5e5da38 Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Sat, 5 Oct 2019 11:09:24 -0400 Subject: [PATCH] mark certain features of Date unsupported on wasm this gives much clearer feedback, at build time rather than runtime, when attempting to use TeaVM with code that uses these operations. --- .../org/teavm/classlib/java/util/TDate.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TDate.java b/classlib/src/main/java/org/teavm/classlib/java/util/TDate.java index 2470f5407..80807fb64 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TDate.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TDate.java @@ -22,7 +22,9 @@ import org.teavm.classlib.java.lang.TComparable; import org.teavm.classlib.java.lang.TSystem; import org.teavm.interop.Import; import org.teavm.interop.NoSideEffects; +import org.teavm.interop.Platforms; import org.teavm.interop.Unmanaged; +import org.teavm.interop.UnsupportedOn; import org.teavm.jso.core.JSDate; public class TDate implements TComparable { @@ -36,6 +38,7 @@ public class TDate implements TComparable { @Import(name = "teavm_date_init") @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) @NoSideEffects @Unmanaged private static native void initLowLevel(); @@ -72,6 +75,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native long initDateLowLevel(int year, int month, int date, int hrs, int min, int sec); public TDate(String s) { @@ -96,6 +100,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native long initUtcDateLowLevel(int year, int month, int date, int hrs, int min, int sec); @Deprecated @@ -115,6 +120,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native long parseLowLevel(String s); @Deprecated @@ -129,6 +135,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int getYearLowLevel(long date); @Deprecated @@ -146,6 +153,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native long setYearLowLevel(long date, int year); @Deprecated @@ -160,6 +168,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int getMonthLowLevel(long date); @Deprecated @@ -177,6 +186,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native long setMonthLowLevel(long date, int month); @Deprecated @@ -191,6 +201,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int getDateLowLevel(long date); @Deprecated @@ -208,6 +219,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int setDateLowLevel(long target, int date); @Deprecated @@ -219,6 +231,7 @@ public class TDate implements TComparable { } @Import(name = "teavm_date_getDay") + @UnsupportedOn(Platforms.WEBASSEMBLY) @Unmanaged public static native int getDayLowLevel(long date); @@ -234,6 +247,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int getHoursLowLevel(long date); @Deprecated @@ -251,6 +265,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int setHoursLowLevel(long date, int hours); @Deprecated @@ -265,6 +280,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int getMinutesLowLevel(long date); @Deprecated @@ -282,6 +298,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int setMinutesLowLevel(long date, int minutes); @Deprecated @@ -296,6 +313,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int getSecondsLowLevel(long date); @Deprecated @@ -313,6 +331,7 @@ public class TDate implements TComparable { @NoSideEffects @Unmanaged @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native int setSecondsLowLevel(long date, int seconds); public long getTime() { @@ -362,6 +381,7 @@ public class TDate implements TComparable { @Import(name = "teavm_date_format") @NoSideEffects @RuntimeInclude("date.h") + @UnsupportedOn(Platforms.WEBASSEMBLY) private static native String toStringLowLevel(long date); @Deprecated