diff --git a/annotations/pom.xml b/annotations/pom.xml
index 8dbfba4..b7dc072 100644
--- a/annotations/pom.xml
+++ b/annotations/pom.xml
@@ -4,7 +4,7 @@
org.treblereel.j2cl.processors
parent
- 0.6.3
+ 0.6.4
annotations
diff --git a/common/pom.xml b/common/pom.xml
index d52696b..32d764b 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -6,7 +6,7 @@
org.treblereel.j2cl.processors
parent
- 0.6.3
+ 0.6.4
common
diff --git a/pom.xml b/pom.xml
index 4da26cf..cc05290 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.treblereel.j2cl.processors
parent
- 0.6.3
+ 0.6.4
pom
GWT3 processors parent
diff --git a/processor/pom.xml b/processor/pom.xml
index 5899aa6..41f1e81 100644
--- a/processor/pom.xml
+++ b/processor/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl.processors
parent
- 0.6.3
+ 0.6.4
processors
diff --git a/processor/src/main/java/org/treblereel/j2cl/processors/generator/GWT3ExportGenerator.java b/processor/src/main/java/org/treblereel/j2cl/processors/generator/GWT3ExportGenerator.java
index 6286b6d..35739cb 100644
--- a/processor/src/main/java/org/treblereel/j2cl/processors/generator/GWT3ExportGenerator.java
+++ b/processor/src/main/java/org/treblereel/j2cl/processors/generator/GWT3ExportGenerator.java
@@ -29,7 +29,9 @@
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.Map;
+import java.util.Queue;
import java.util.Set;
import java.util.stream.Collectors;
import javax.lang.model.element.Element;
@@ -112,13 +114,13 @@ public void generate(Set elements) {
exports.put(checkClazz(parent), new HashSet<>());
exports.get(parent).addAll(methods);
- ElementFilter.methodsIn(parent.getEnclosedElements()).stream()
+ getAllMethodsIn(parent).stream()
.filter(elm -> !elm.getModifiers().contains(Modifier.PRIVATE))
.filter(elm -> !elm.getModifiers().contains(Modifier.NATIVE))
.filter(elm -> !elm.getModifiers().contains(Modifier.ABSTRACT))
.forEach(elm -> exportDTOs.get(parent).addMethod(getMethodDTO(parent, elm)));
- ElementFilter.fieldsIn(parent.getEnclosedElements()).stream()
+ getAllFieldsIn(parent).stream()
.filter(elm -> !elm.getModifiers().contains(Modifier.PRIVATE))
.filter(elm -> !elm.getModifiers().contains(Modifier.NATIVE))
.filter(elm -> !elm.getModifiers().contains(Modifier.ABSTRACT))
@@ -287,9 +289,8 @@ private TypeElement checkClazz(TypeElement parent) {
+ ", mustn't be annotated with @ES6Module");
}
Set constructors =
- ElementFilter.constructorsIn(parent.getEnclosedElements()).stream()
- .collect(Collectors.toSet());
- if (!constructors.isEmpty()) {
+ new HashSet<>(ElementFilter.constructorsIn(parent.getEnclosedElements()));
+ if (parent.getAnnotation(JsType.class) == null && !constructors.isEmpty()) {
constructors.stream()
.filter(elm -> elm.getModifiers().contains(Modifier.PUBLIC))
.filter(elm -> elm.getParameters().isEmpty())
@@ -305,4 +306,34 @@ private TypeElement checkClazz(TypeElement parent) {
return parent;
}
+
+ private Set getAllMethodsIn(TypeElement parent) {
+ Set elements = new HashSet<>();
+ Queue queue = new LinkedList<>();
+ queue.add(parent);
+ while (!queue.isEmpty()) {
+ TypeElement current = queue.poll();
+ elements.addAll(ElementFilter.methodsIn(current.getEnclosedElements()));
+ if (!current.getSuperclass().toString().equals("java.lang.Object")
+ && MoreTypes.asElement(current.getSuperclass()).getKind().isClass()) {
+ queue.offer((TypeElement) MoreTypes.asElement(current.getSuperclass()));
+ }
+ }
+ return elements;
+ }
+
+ private Set getAllFieldsIn(TypeElement parent) {
+ Set elements = new HashSet<>();
+ Queue queue = new LinkedList<>();
+ queue.add(parent);
+ while (!queue.isEmpty()) {
+ TypeElement current = queue.poll();
+ elements.addAll(ElementFilter.fieldsIn(current.getEnclosedElements()));
+ if (!current.getSuperclass().toString().equals("java.lang.Object")
+ && MoreTypes.asElement(current.getSuperclass()).getKind().isClass()) {
+ queue.offer((TypeElement) MoreTypes.asElement(current.getSuperclass()));
+ }
+ }
+ return elements;
+ }
}
diff --git a/processor/src/main/resources/templates/resources/export.ftlh b/processor/src/main/resources/templates/resources/export.ftlh
index 3ea900d..b6f3691 100644
--- a/processor/src/main/resources/templates/resources/export.ftlh
+++ b/processor/src/main/resources/templates/resources/export.ftlh
@@ -1,25 +1,33 @@
+<#if !isNative>
+/**
+* @fileoverview
+* @suppress {missingProperties}
+*/
+#if>
goog.module('${module}$GWT3Export');
const EXPORT = goog.require('${target}');
<#if isNative>
goog.exportSymbol('${type}', EXPORT);
-<#else>
-const j_l_Object = goog.require('java.lang.Object$impl');
-const $Util = goog.require('nativebootstrap.Util$impl');
-class _EXPORT extends EXPORT {
- constructor() {
- EXPORT.$clinit();
- super();
- this.${ctor}();
+<#list methods as method>
+goog.exportSymbol('${type}.<#if !method.isStatic>prototype.#if>${method.name}', EXPORT.<#if !method.isStatic>prototype.#if>${method.mangleName});
+#list>
+<#else>
+const classProxy = new Proxy(EXPORT, {
+ construct(target, args) {
+ return EXPORT.$create__();
}
-}
-
-$Util.$setClassMetadata(_EXPORT, '${module}');
-goog.exportSymbol('${type}', _EXPORT);
-#if>
+});
+EXPORT.$clinit();
+goog.exportSymbol('${type}', classProxy);
<#list methods as method>
-goog.exportSymbol('${type}.<#if !method.isStatic>prototype.#if>${method.name}', EXPORT.<#if !method.isStatic>prototype.#if>${method.mangleName});
+<#if method.isStatic>
+goog.exportProperty(EXPORT, '${method.name}', EXPORT.${method.mangleName});
+<#else>
+goog.exportSymbol('${type}.prototype.${method.name}', classProxy.prototype.${method.mangleName});
+#if>
#list>
+#if>
diff --git a/tests/commons/pom.xml b/tests/commons/pom.xml
index de7dd15..6ca6517 100644
--- a/tests/commons/pom.xml
+++ b/tests/commons/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
common-tests
- 0.6.3
+ 0.6.4
Common test cases
Common test cases
@@ -85,7 +85,7 @@
org.treblereel.j2cl.processors
common
- 0.6.3
+ 0.6.4
test
diff --git a/tests/entrypoint/jstype/pom.xml b/tests/entrypoint/jstype/pom.xml
index bd1007d..3299979 100644
--- a/tests/entrypoint/jstype/pom.xml
+++ b/tests/entrypoint/jstype/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
entrypoint-jstype-tests
- 0.6.3
+ 0.6.4
GWT3 Entry Point Tests for @JsType class
Test cases for the GWT3 Entry Point for @JsType class
diff --git a/tests/entrypoint/pojo/pom.xml b/tests/entrypoint/pojo/pom.xml
index 50aa4e6..bb2aaf9 100644
--- a/tests/entrypoint/pojo/pom.xml
+++ b/tests/entrypoint/pojo/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
entrypoint-pojo-tests
- 0.6.3
+ 0.6.4
GWT3 Entry Point Tests for Pojo class
Test cases for the GWT3 Entry Point for Pojo class
diff --git a/tests/entrypoint/pom.xml b/tests/entrypoint/pom.xml
index 442241c..a789bff 100644
--- a/tests/entrypoint/pom.xml
+++ b/tests/entrypoint/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
entrypoint-tests
- 0.6.3
+ 0.6.4
pom
GWT3 Entry Point Tests
diff --git a/tests/es6shim/pom.xml b/tests/es6shim/pom.xml
index 11eb9d2..65ecffa 100644
--- a/tests/es6shim/pom.xml
+++ b/tests/es6shim/pom.xml
@@ -5,7 +5,7 @@
es6shim-tests
org.treblereel.j2cl
- 0.6.3
+ 0.6.4
jar
ES6SHIM Tests
diff --git a/tests/exports/javaenv/pom-advanced.xml b/tests/exports/javaenv/pom-advanced.xml
index f8ff91c..248bcdd 100644
--- a/tests/exports/javaenv/pom-advanced.xml
+++ b/tests/exports/javaenv/pom-advanced.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
javaenv-advanced
- 0.6.3
+ 0.6.4
jar
GWTExports java env Tests ADVANCED mode
diff --git a/tests/exports/javaenv/pom.xml b/tests/exports/javaenv/pom.xml
index f5a2adb..a3354a9 100644
--- a/tests/exports/javaenv/pom.xml
+++ b/tests/exports/javaenv/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
javaenv
- 0.6.3
+ 0.6.4
jar
GWTExports java env Tests BUNDLE_JAR mode
diff --git a/tests/exports/jsenv/bundle_jar_pom.xml b/tests/exports/jsenv/bundle_jar_pom.xml
index e8e39bf..709dd94 100644
--- a/tests/exports/jsenv/bundle_jar_pom.xml
+++ b/tests/exports/jsenv/bundle_jar_pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
exports-bundle_jar
- 0.6.3
+ 0.6.4
jar
GWTExports Tests BUNDLE_JAR mode
diff --git a/tests/exports/jsenv/pom.xml b/tests/exports/jsenv/pom.xml
index 5bb94f8..a4508c6 100644
--- a/tests/exports/jsenv/pom.xml
+++ b/tests/exports/jsenv/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
jsenv
- 0.6.3
+ 0.6.4
jar
GWTExports Tests ADVANCED mode
diff --git a/tests/exports/pom.xml b/tests/exports/pom.xml
index d6ca4a4..79cf9dc 100644
--- a/tests/exports/pom.xml
+++ b/tests/exports/pom.xml
@@ -6,7 +6,7 @@
org.treblereel.j2cl
tests-parent
- 0.6.3
+ 0.6.4
pom
diff --git a/tests/pom.xml b/tests/pom.xml
index 4e7a89d..c6e46ef 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
tests-parent
- 0.6.3
+ 0.6.4
pom
GWT3 processors Tests
diff --git a/tests/resources/pom.xml b/tests/resources/pom.xml
index d4a902a..9670215 100644
--- a/tests/resources/pom.xml
+++ b/tests/resources/pom.xml
@@ -6,7 +6,7 @@
org.treblereel.j2cl
tests-parent
- 0.6.3
+ 0.6.4
resources
diff --git a/tests/translation/default/pom.xml b/tests/translation/default/pom.xml
index 49ebe03..b193c6f 100644
--- a/tests/translation/default/pom.xml
+++ b/tests/translation/default/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
translation-default
- 0.6.3
+ 0.6.4
jar
Translation Tests en
diff --git a/tests/translation/fr/pom.xml b/tests/translation/fr/pom.xml
index 74677e9..7a8e005 100644
--- a/tests/translation/fr/pom.xml
+++ b/tests/translation/fr/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
translation-fr
- 0.6.3
+ 0.6.4
jar
Translation Tests fr
diff --git a/tests/translation/fr_nr/pom.xml b/tests/translation/fr_nr/pom.xml
index c092c85..5b83350 100644
--- a/tests/translation/fr_nr/pom.xml
+++ b/tests/translation/fr_nr/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
translation-fr-nr
- 0.6.3
+ 0.6.4
jar
Translation Tests fr-nr
diff --git a/tests/translation/no_bundle/pom.xml b/tests/translation/no_bundle/pom.xml
index 562ea35..45e9906 100644
--- a/tests/translation/no_bundle/pom.xml
+++ b/tests/translation/no_bundle/pom.xml
@@ -6,7 +6,7 @@
org.treblereel.j2cl
translation-tests
- 0.6.3
+ 0.6.4
translation-no_bundle
diff --git a/tests/translation/pom.xml b/tests/translation/pom.xml
index 0f11fa6..6b01734 100644
--- a/tests/translation/pom.xml
+++ b/tests/translation/pom.xml
@@ -5,7 +5,7 @@
org.treblereel.j2cl
translation-tests
- 0.6.3
+ 0.6.4
pom
GWT3 Entry Point Tests
diff --git a/utils/pom.xml b/utils/pom.xml
index b7fee8c..7f2ac24 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -5,7 +5,7 @@
parent
org.treblereel.j2cl.processors
- 0.6.3
+ 0.6.4
4.0.0