Skip to content

Commit

Permalink
Merge pull request #6 from webfx-project/j2cl
Browse files Browse the repository at this point in the history
Refactored AST + J2CL support
  • Loading branch information
salmonb authored Mar 14, 2024
2 parents ee0fa2f + bc9a974 commit 55d8614
Show file tree
Hide file tree
Showing 938 changed files with 114,578 additions and 5,337 deletions.
71 changes: 43 additions & 28 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skippedModules>webfx-platform-arch-gwt,webfx-platform-arch-java,webfx-platform-audio-gluon,webfx-platform-boot-gwt,webfx-platform-boot-java,webfx-platform-boot-vertx,webfx-platform-console-gwt,webfx-platform-console-java,webfx-platform-fetch-gwt,webfx-platform-fetch-java,webfx-platform-fetch-vertx,webfx-platform-file-gwt,webfx-platform-file-java,webfx-platform-javabase-emul-gwt,webfx-platform-json-gwt,webfx-platform-json-java,webfx-platform-json-teavm,webfx-platform-json-vertx,webfx-platform-meta,webfx-platform-os-gluon,webfx-platform-os-gwt,webfx-platform-os-java,webfx-platform-resource-gluon,webfx-platform-resource-gwt,webfx-platform-resource-java,webfx-platform-typedarray-gwt,webfx-platform-scheduler-java,webfx-platform-scheduler-vertx,webfx-platform-shutdown-gluon,webfx-platform-shutdown-gwt,webfx-platform-shutdown-java,webfx-platform-storage-gwt,webfx-platform-storage-java,webfx-platform-storagelocation-gluon,webfx-platform-storagelocation-java,webfx-platform-uischeduler-gwt,webfx-platform-useragent-gluon,webfx-platform-useragent-gwt,webfx-platform-useragent-java-client,webfx-platform-useragent-java-server,webfx-platform-visibility-gluon,webfx-platform-visibility-gwt,webfx-platform-visibility-java-headless,webfx-platform-webassembly-teavm,webfx-platform-webworker-gwt,webfx-platform-webworker-java,webfx-platform-webworker-teavm,webfx-platform-windowhistory-gwt,webfx-platform-windowhistory-java,webfx-platform-windowhistory-web,webfx-platform-windowlocation-gwt,webfx-platform-windowlocation-java,webfx-platform-util,webfx-platform-vertx-common</skippedModules>
<skippedModules>webfx-platform-arch-gwt,webfx-platform-arch-java,webfx-platform-audio-gluon,webfx-platform-boot-gwt,webfx-platform-boot-java,webfx-platform-boot-vertx,webfx-platform-console-gwt,webfx-platform-console-java,webfx-platform-fetch-gwt,webfx-platform-fetch-java,webfx-platform-fetch-vertx,webfx-platform-file-gwt,webfx-platform-file-java,webfx-platform-javabase-emul-gwt,webfx-platform-json-gwt,webfx-platform-json-java,webfx-platform-json-teavm,webfx-platform-json-vertx,webfx-platform-meta,webfx-platform-os-gluon,webfx-platform-os-gwt,webfx-platform-os-java,webfx-platform-resource-gluon,webfx-platform-resource-gwt,webfx-platform-resource-java,webfx-platform-scheduler-java,webfx-platform-scheduler-vertx,webfx-platform-shutdown-gluon,webfx-platform-shutdown-gwt,webfx-platform-shutdown-java,webfx-platform-storage-gwt,webfx-platform-storage-java,webfx-platform-storagelocation-gluon,webfx-platform-storagelocation-java,webfx-platform-uischeduler-gwt,webfx-platform-useragent-gluon,webfx-platform-useragent-gwt,webfx-platform-useragent-java-client,webfx-platform-useragent-java-server,webfx-platform-visibility-gluon,webfx-platform-visibility-gwt,webfx-platform-visibility-java-headless,webfx-platform-webassembly-teavm,webfx-platform-webworker-gwt,webfx-platform-webworker-java,webfx-platform-webworker-teavm,webfx-platform-windowhistory-gwt,webfx-platform-windowhistory-java,webfx-platform-windowhistory-web,webfx-platform-windowlocation-gwt,webfx-platform-windowlocation-java,webfx-platform-util,webfx-platform-vertx-common</skippedModules>
</configuration>
</plugin>
</plugins>
Expand All @@ -96,92 +96,107 @@

<modules>
<module>webfx-platform-arch</module>
<module>webfx-platform-arch-gwt</module>
<module>webfx-platform-arch-gwt-j2cl</module>
<module>webfx-platform-arch-java</module>
<module>webfx-platform-ast-yaml</module>
<module>webfx-platform-ast</module>
<module>webfx-platform-ast-factory-generic</module>
<module>webfx-platform-ast-factory-gwt</module>
<module>webfx-platform-ast-factory-teavm</module>
<module>webfx-platform-ast-factory-vertx</module>
<module>webfx-platform-ast-json-plugin</module>
<module>webfx-platform-ast-yaml-plugin</module>
<module>webfx-platform-async</module>
<module>webfx-platform-audio</module>
<module>webfx-platform-audio-gluon</module>
<module>webfx-platform-blob</module>
<module>webfx-platform-blob-gwt-j2cl</module>
<module>webfx-platform-blob-java</module>
<module>webfx-platform-boot</module>
<module>webfx-platform-boot-gwt</module>
<module>webfx-platform-boot-j2cl</module>
<module>webfx-platform-boot-java</module>
<module>webfx-platform-boot-vertx</module>
<module>webfx-platform-browser</module>
<module>webfx-platform-browser-gluon</module>
<module>webfx-platform-browser-gwt-j2cl</module>
<module>webfx-platform-conf</module>
<module>webfx-platform-conf-file-java</module>
<module>webfx-platform-conf-file-java-plugin</module>
<module>webfx-platform-conf-zero</module>
<module>webfx-platform-conf-zero-impl</module>
<module>webfx-platform-console</module>
<module>webfx-platform-console-gwt</module>
<module>webfx-platform-console-gwt-j2cl</module>
<module>webfx-platform-console-java</module>
<module>webfx-platform-console-teavm</module>
<module>webfx-platform-fetch</module>
<module>webfx-platform-fetch-gwt</module>
<module>webfx-platform-fetch-ast-json</module>
<module>webfx-platform-fetch-gwt-j2cl</module>
<module>webfx-platform-fetch-java</module>
<module>webfx-platform-fetch-json</module>
<module>webfx-platform-fetch-vertx</module>
<module>webfx-platform-file</module>
<module>webfx-platform-file-gwt</module>
<module>webfx-platform-file-gwt-j2cl</module>
<module>webfx-platform-file-java</module>
<module>webfx-platform-javabase-emul-gwt</module>
<module>webfx-platform-javabase-emul-j2cl</module>
<module>webfx-platform-json</module>
<module>webfx-platform-json-gwt</module>
<module>webfx-platform-json-java</module>
<module>webfx-platform-json-teavm</module>
<module>webfx-platform-json-vertx</module>
<module>webfx-platform-javatime-emul-j2cl</module>
<module>webfx-platform-meta</module>
<module>webfx-platform-os</module>
<module>webfx-platform-os-gluon</module>
<module>webfx-platform-os-gwt</module>
<module>webfx-platform-os-gwt-j2cl</module>
<module>webfx-platform-os-java</module>
<module>webfx-platform-reflect</module>
<module>webfx-platform-resource</module>
<module>webfx-platform-resource-gluon</module>
<module>webfx-platform-resource-gwt</module>
<module>webfx-platform-resource-j2cl</module>
<module>webfx-platform-resource-java</module>
<module>webfx-platform-scheduler</module>
<module>webfx-platform-scheduler-java</module>
<module>webfx-platform-scheduler-vertx</module>
<module>webfx-platform-shutdown</module>
<module>webfx-platform-shutdown-gluon</module>
<module>webfx-platform-shutdown-gwt</module>
<module>webfx-platform-shutdown-gwt-j2cl</module>
<module>webfx-platform-shutdown-java</module>
<module>webfx-platform-storage</module>
<module>webfx-platform-storage-gwt</module>
<module>webfx-platform-storage-gwt-j2cl</module>
<module>webfx-platform-storage-java</module>
<module>webfx-platform-storagelocation</module>
<module>webfx-platform-storagelocation-gluon</module>
<module>webfx-platform-storagelocation-java</module>
<module>webfx-platform-substitution</module>
<module>webfx-platform-substitution-var</module>
<module>webfx-platform-substitution-var-conf</module>
<module>webfx-platform-substitution-var-env</module>
<module>webfx-platform-substitution-var-localstorage</module>
<module>webfx-platform-substitution-var-sysprop</module>
<module>webfx-platform-substitution-var-windowlocation</module>
<module>webfx-platform-substitution-var-conf-plugin</module>
<module>webfx-platform-substitution-var-env-plugin</module>
<module>webfx-platform-substitution-var-localstorage-plugin</module>
<module>webfx-platform-substitution-var-sysprop-plugin</module>
<module>webfx-platform-substitution-var-windowlocation-plugin</module>
<module>webfx-platform-typedarray</module>
<module>webfx-platform-typedarray-gwt</module>
<module>webfx-platform-typedarray-gwt-j2cl</module>
<module>webfx-platform-uischeduler</module>
<module>webfx-platform-uischeduler-gwt</module>
<module>webfx-platform-uischeduler-gwt-j2cl</module>
<module>webfx-platform-useragent</module>
<module>webfx-platform-useragent-gluon</module>
<module>webfx-platform-useragent-gwt</module>
<module>webfx-platform-useragent-gwt-j2cl</module>
<module>webfx-platform-useragent-java-client</module>
<module>webfx-platform-useragent-java-server</module>
<module>webfx-platform-util</module>
<module>webfx-platform-util-time</module>
<module>webfx-platform-vertx-common</module>
<module>webfx-platform-visibility</module>
<module>webfx-platform-visibility-gluon</module>
<module>webfx-platform-visibility-gwt</module>
<module>webfx-platform-visibility-gwt-j2cl</module>
<module>webfx-platform-visibility-java-headless</module>
<module>webfx-platform-webassembly</module>
<module>webfx-platform-webassembly-teavm</module>
<module>webfx-platform-webworker</module>
<module>webfx-platform-webworker-gwt</module>
<module>webfx-platform-webworker-gwt-j2cl</module>
<module>webfx-platform-webworker-java</module>
<module>webfx-platform-webworker-teavm</module>
<module>webfx-platform-windowhistory</module>
<module>webfx-platform-windowhistory-gwt</module>
<module>webfx-platform-windowhistory-gwt-j2cl</module>
<module>webfx-platform-windowhistory-java</module>
<module>webfx-platform-windowhistory-web</module>
<module>webfx-platform-windowlocation</module>
<module>webfx-platform-windowlocation-gwt</module>
<module>webfx-platform-windowlocation-gwt-j2cl</module>
<module>webfx-platform-windowlocation-java</module>
</modules>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<version>0.1.0-SNAPSHOT</version>
</parent>

<artifactId>webfx-platform-arch-gwt</artifactId>
<artifactId>webfx-platform-arch-gwt-j2cl</artifactId>

<description>GWT implementation of the Arch API (for the browser).</description>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.webfx.platform.arch.spi.impl.gwt;
package dev.webfx.platform.arch.spi.impl.gwtj2cl;

import dev.webfx.platform.arch.spi.ArchProvider;
import elemental2.dom.DomGlobal;
Expand All @@ -7,7 +7,7 @@
/**
* @author Bruno Salmon
*/
public final class GwtArchProvider implements ArchProvider {
public final class GwtJ2clArchProvider implements ArchProvider {

@Override
public boolean is64Bit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</dependencies>

<providers>
<provider interface="dev.webfx.platform.arch.spi.ArchProvider">dev.webfx.platform.arch.spi.impl.gwt.GwtArchProvider</provider>
<provider interface="dev.webfx.platform.arch.spi.ArchProvider">dev.webfx.platform.arch.spi.impl.gwtj2cl.GwtJ2clArchProvider</provider>
</providers>

</project>
7 changes: 7 additions & 0 deletions webfx-platform-arch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@

<dependencies>

<dependency>
<groupId>dev.webfx</groupId>
<artifactId>webfx-platform-javabase-emul-j2cl</artifactId>
<version>0.1.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>dev.webfx</groupId>
<artifactId>webfx-platform-util</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
<version>0.1.0-SNAPSHOT</version>
</parent>

<artifactId>webfx-platform-json-java</artifactId>

<description>Java implementation of the Json API (for platforms other than browser and server).</description>
<artifactId>webfx-platform-ast-factory-generic</artifactId>

<dependencies>

<dependency>
<groupId>dev.webfx</groupId>
<artifactId>webfx-platform-json</artifactId>
<artifactId>webfx-platform-ast</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package dev.webfx.platform.ast.spi.factory.impl.generic;

import dev.webfx.platform.ast.AstArray;
import dev.webfx.platform.ast.AstObject;
import dev.webfx.platform.ast.spi.factory.AstFactoryProvider;

/**
* @author Bruno Salmon
*/
public class GenericAstFactoryProvider implements AstFactoryProvider {

@Override
public AstObject createObject() {
return new MapAstObject();
}

@Override
public AstArray createArray() {
return new ListAstArray();
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package dev.webfx.platform.util.keyobject.impl.listmap;
package dev.webfx.platform.ast.spi.factory.impl.generic;

import dev.webfx.platform.util.keyobject.IndexedArray;
import dev.webfx.platform.ast.AstArray;

import java.util.List;

/**
* @author Bruno Salmon
*/
public final class ListIndexedArray extends ListBasedIndexedArray {
public final class ListAstArray extends ListBasedAstArray {

protected List<Object> list;

protected ListIndexedArray() {
protected ListAstArray() {
}

protected ListIndexedArray(List<Object> list) {
protected ListAstArray(List<Object> list) {
super(list);
}

Expand All @@ -23,19 +23,24 @@ public List<Object> getList() {
return list;
}

@Override
public void clear() {
getList().clear();
}

@Override
protected void setList(List<Object> list) {
this.list = list;
}

@Override
public <T extends IndexedArray> T push(Object element) {
public <T extends AstArray> T push(Object element) {
list.add(element);
return (T) this;
}

@Override
public <T extends IndexedArray> T set(int index, Object value) {
public <T extends AstArray> T set(int index, Object value) {
list.set(index, value);
return (T) this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package dev.webfx.platform.util.keyobject.impl.listmap;
package dev.webfx.platform.ast.spi.factory.impl.generic;

import dev.webfx.platform.util.keyobject.IndexedArray;
import dev.webfx.platform.ast.AstArray;

import java.util.ArrayList;
import java.util.List;

/**
* @author Bruno Salmon
*/
public abstract class ListBasedIndexedArray implements IndexedArray {
public abstract class ListBasedAstArray implements AstArray {
protected boolean isShallowCopy;

protected ListBasedIndexedArray() {
protected ListBasedAstArray() {
this(new ArrayList<>());
}

protected ListBasedIndexedArray(List<Object> list) {
protected ListBasedAstArray(List<Object> list) {
setList(list);
}

Expand Down Expand Up @@ -46,7 +46,6 @@ public <T> T remove(int index) {
return (T) getList().remove(index);
}

/*
@Override
public void clear() {
if (isShallowCopy) {
Expand All @@ -56,6 +55,12 @@ public void clear() {
getList().clear();
}

protected void recreateEmptyNativeArray() {
setList(new ArrayList<>());
}

/*
@Override
public ListBasedJsonArray copy() {
ListBasedJsonArray copy = (ListBasedJsonArray) nativeToJavaJsonArray(getNativeElement());
Expand All @@ -74,7 +79,7 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass())
return false;

ListBasedIndexedArray that = (ListBasedIndexedArray) o;
ListBasedAstArray that = (ListBasedAstArray) o;

List<?> thisList = this.getList();
List<?> thatList = that.getList();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package dev.webfx.platform.ast.spi.factory.impl.generic;

import dev.webfx.platform.ast.spi.factory.AstFactoryProvider;
import dev.webfx.platform.ast.AstArray;
import dev.webfx.platform.ast.AstObject;

/**
* @author Bruno Salmon
*/
public final class ListMapAstFactoryProvider implements AstFactoryProvider {

private final static ListMapAstFactoryProvider INSTANCE = new ListMapAstFactoryProvider();

public static ListMapAstFactoryProvider getInstance() {
return INSTANCE;
}

@Override
public AstObject createObject() {
return new MapAstObject();
}

@Override
public AstArray createArray() {
return new ListAstArray();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.webfx.platform.util.keyobject.impl.listmap;
package dev.webfx.platform.ast.spi.factory.impl.generic;

import java.util.ArrayList;
import java.util.LinkedHashMap;
Expand Down
Loading

0 comments on commit 55d8614

Please sign in to comment.