Skip to content

Commit 8f402dc

Browse files
committed
Removed TeaVM dependency and replaced it with similar code
1 parent 658c9bb commit 8f402dc

File tree

165 files changed

+1924
-5794
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+1924
-5794
lines changed

Ports/JavaScriptPort/src/main/java/org/teavm/interop/AsyncCallback.java renamed to Ports/JavaScriptPort/src/main/java/com/codename1/html5/interop/AsyncCallback.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
* Copyright (c) 2026 Codename One and contributors.
33
* Licensed under the PolyForm Noncommercial License 1.0.0.
44
*/
5-
package org.teavm.interop;
5+
package com.codename1.html5.interop;
66

7+
/**
8+
* Callback interface for async operations.
9+
* This is a replacement for TeaVM's AsyncCallback.
10+
*/
711
public interface AsyncCallback<T> {
812
void complete(T result);
9-
void error(Throwable t);
13+
void error(Throwable e);
1014
}

Ports/JavaScriptPort/src/main/java/org/teavm/interop/SuppressSyncErrors.java renamed to Ports/JavaScriptPort/src/main/java/com/codename1/html5/interop/SuppressSyncErrors.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
* Copyright (c) 2026 Codename One and contributors.
33
* Licensed under the PolyForm Noncommercial License 1.0.0.
44
*/
5-
package org.teavm.interop;
5+
package com.codename1.html5.interop;
66

77
import java.lang.annotation.ElementType;
88
import java.lang.annotation.Retention;
99
import java.lang.annotation.RetentionPolicy;
1010
import java.lang.annotation.Target;
1111

12-
@Target({ElementType.TYPE, ElementType.METHOD})
12+
/**
13+
* Annotation to suppress synchronization errors.
14+
* This is a no-op stub for ParparVM builds.
15+
* TeaVM uses this for its async/sync transformation.
16+
*/
17+
@Target({ElementType.METHOD, ElementType.TYPE})
1318
@Retention(RetentionPolicy.RUNTIME)
14-
public @interface SuppressSyncErrors {}
19+
public @interface SuppressSyncErrors {
20+
}

Ports/JavaScriptPort/src/main/java/org/teavm/jso/JSBody.java renamed to Ports/JavaScriptPort/src/main/java/com/codename1/html5/js/JSBody.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
* Copyright (c) 2026 Codename One and contributors.
33
* Licensed under the PolyForm Noncommercial License 1.0.0.
44
*/
5-
package org.teavm.jso;
5+
package com.codename1.html5.js;
66

77
import java.lang.annotation.ElementType;
88
import java.lang.annotation.Retention;
99
import java.lang.annotation.RetentionPolicy;
1010
import java.lang.annotation.Target;
1111

12+
/**
13+
* Marks a method as implemented by inline JavaScript.
14+
* For ParparVM, the script is executed via native binding mechanism.
15+
*/
1216
@Target(ElementType.METHOD)
1317
@Retention(RetentionPolicy.RUNTIME)
1418
public @interface JSBody {
1519
String[] params() default {};
1620
String script() default "";
17-
boolean module() default false;
1821
}

Ports/JavaScriptPort/src/main/java/org/teavm/jso/JSFunctor.java renamed to Ports/JavaScriptPort/src/main/java/com/codename1/html5/js/JSFunctor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22
* Copyright (c) 2026 Codename One and contributors.
33
* Licensed under the PolyForm Noncommercial License 1.0.0.
44
*/
5-
package org.teavm.jso;
5+
package com.codename1.html5.js;
66

77
import java.lang.annotation.ElementType;
88
import java.lang.annotation.Retention;
99
import java.lang.annotation.RetentionPolicy;
1010
import java.lang.annotation.Target;
1111

12+
/**
13+
* Marks an interface as a JavaScript function type.
14+
* Used for callback interfaces that wrap JavaScript functions.
15+
*/
1216
@Target(ElementType.TYPE)
1317
@Retention(RetentionPolicy.RUNTIME)
14-
public @interface JSFunctor {}
18+
public @interface JSFunctor {
19+
}

Ports/JavaScriptPort/src/main/java/org/teavm/jso/JSMethod.java renamed to Ports/JavaScriptPort/src/main/java/com/codename1/html5/js/JSMethod.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
* Copyright (c) 2026 Codename One and contributors.
33
* Licensed under the PolyForm Noncommercial License 1.0.0.
44
*/
5-
package org.teavm.jso;
5+
package com.codename1.html5.js;
66

77
import java.lang.annotation.ElementType;
88
import java.lang.annotation.Retention;
99
import java.lang.annotation.RetentionPolicy;
1010
import java.lang.annotation.Target;
1111

12+
/**
13+
* Marks a method as a JavaScript method.
14+
* Used for interface methods that correspond to JS object methods.
15+
*/
1216
@Target(ElementType.METHOD)
1317
@Retention(RetentionPolicy.RUNTIME)
14-
public @interface JSMethod {}
18+
public @interface JSMethod {
19+
String value() default "";
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 2026 Codename One and contributors.
3+
* Licensed under the PolyForm Noncommercial License 1.0.0.
4+
*/
5+
package com.codename1.html5.js;
6+
7+
/**
8+
* Base interface for all JavaScript objects.
9+
* All JS interop interfaces extend this marker.
10+
*/
11+
public interface JSObject {
12+
// Marker interface - all JS wrappers extend this
13+
}

Ports/JavaScriptPort/src/main/java/org/teavm/jso/JSProperty.java renamed to Ports/JavaScriptPort/src/main/java/com/codename1/html5/js/JSProperty.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
* Copyright (c) 2026 Codename One and contributors.
33
* Licensed under the PolyForm Noncommercial License 1.0.0.
44
*/
5-
package org.teavm.jso;
5+
package com.codename1.html5.js;
66

77
import java.lang.annotation.ElementType;
88
import java.lang.annotation.Retention;
99
import java.lang.annotation.RetentionPolicy;
1010
import java.lang.annotation.Target;
1111

12-
@Target({ElementType.METHOD, ElementType.FIELD})
12+
/**
13+
* Marks a method as a JavaScript property accessor.
14+
* Getter methods return the property value, setter methods set it.
15+
*/
16+
@Target(ElementType.METHOD)
1317
@Retention(RetentionPolicy.RUNTIME)
1418
public @interface JSProperty {
1519
String value() default "";

Ports/JavaScriptPort/src/main/java/org/teavm/interop/Async.java renamed to Ports/JavaScriptPort/src/main/java/com/codename1/html5/js/NativeJS.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
* Copyright (c) 2026 Codename One and contributors.
33
* Licensed under the PolyForm Noncommercial License 1.0.0.
44
*/
5-
package org.teavm.interop;
5+
package com.codename1.html5.js;
66

77
import java.lang.annotation.ElementType;
88
import java.lang.annotation.Retention;
99
import java.lang.annotation.RetentionPolicy;
1010
import java.lang.annotation.Target;
1111

12+
/**
13+
* Marks a method as implemented by native JavaScript.
14+
* ParparVM's runtime provides implementations via bindNative() mappings.
15+
*/
1216
@Target(ElementType.METHOD)
1317
@Retention(RetentionPolicy.RUNTIME)
14-
public @interface Async {}
18+
public @interface NativeJS {
19+
String value() default "";
20+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2026 Codename One and contributors.
3+
* Licensed under the PolyForm Noncommercial License 1.0.0.
4+
*/
5+
package com.codename1.html5.js.ajax;
6+
7+
import com.codename1.html5.js.JSFunctor;
8+
9+
/**
10+
* ReadyStateChange handler callback interface.
11+
*/
12+
@JSFunctor
13+
public interface ReadyStateChangeHandler {
14+
void stateChanged();
15+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2026 Codename One and contributors.
3+
* Licensed under the PolyForm Noncommercial License 1.0.0.
4+
*/
5+
package com.codename1.html5.js.ajax;
6+
7+
import com.codename1.html5.js.JSObject;
8+
import com.codename1.html5.js.typedarrays.ArrayBuffer;
9+
10+
/**
11+
* XMLHttpRequest interface for AJAX.
12+
* https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
13+
*/
14+
public interface XMLHttpRequest extends JSObject {
15+
static XMLHttpRequest create() {
16+
return null; // Native implementation
17+
}
18+
19+
int getReadyState();
20+
int getStatus();
21+
String getStatusText();
22+
String getResponseText();
23+
ArrayBuffer getResponseArrayBuffer();
24+
Object getResponse();
25+
String getResponseURL();
26+
void open(String method, String url);
27+
void open(String method, String url, boolean async);
28+
void setRequestHeader(String name, String value);
29+
void send();
30+
void send(String data);
31+
void send(ArrayBuffer data);
32+
void abort();
33+
void setResponseType(String type);
34+
String getResponseType();
35+
void overrideMimeType(String mimeType);
36+
int getTimeout();
37+
void setTimeout(int timeout);
38+
Object getUpload();
39+
void setOnReadyStateChange(ReadyStateChangeHandler handler);
40+
ReadyStateChangeHandler getOnReadyStateChange();
41+
void setOnLoad(Object handler);
42+
void setOnError(Object handler);
43+
void setOnProgress(Object handler);
44+
String getAllResponseHeaders();
45+
String getResponseHeader(String name);
46+
}

0 commit comments

Comments
 (0)