diff --git a/core/src/main/java/org/teavm/dependency/DependencyType.java b/core/src/main/java/org/teavm/dependency/DependencyType.java index 51395c7c5..d0a3bf8a2 100644 --- a/core/src/main/java/org/teavm/dependency/DependencyType.java +++ b/core/src/main/java/org/teavm/dependency/DependencyType.java @@ -15,16 +15,12 @@ */ package org.teavm.dependency; -/** - * - * @author Alexey Andreev - */ public class DependencyType { private DependencyChecker dependencyChecker; private String name; int index; - public DependencyType(DependencyChecker dependencyChecker, String name, int index) { + DependencyType(DependencyChecker dependencyChecker, String name, int index) { this.dependencyChecker = dependencyChecker; this.name = name; this.index = index; diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSDependencyListener.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSDependencyListener.java index d32bdd7a2..675094a03 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSDependencyListener.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSDependencyListener.java @@ -90,12 +90,7 @@ class JSDependencyListener extends AbstractDependencyListener { } private ExposedClass getExposedClass(String name) { - ExposedClass cls = exposedClasses.get(name); - if (cls == null) { - cls = createExposedClass(name); - exposedClasses.put(name, cls); - } - return cls; + return exposedClasses.computeIfAbsent(name, this::createExposedClass); } private ExposedClass createExposedClass(String name) { @@ -111,15 +106,17 @@ class JSDependencyListener extends AbstractDependencyListener { exposedCls.implementedInterfaces.addAll(parent.implementedInterfaces); } addInterfaces(exposedCls, cls); - for (MethodReader method : cls.getMethods()) { - if (method.getName().equals("")) { - continue; - } - if (exposedCls.inheritedMethods.containsKey(method.getDescriptor()) - || exposedCls.methods.containsKey(method.getDescriptor())) { - MethodDependency methodDep = agent.linkMethod(method.getReference(), null); - methodDep.getVariable(0).propagate(agent.getType(name)); - methodDep.use(); + if (!cls.hasModifier(ElementModifier.ABSTRACT)) { + for (MethodReader method : cls.getMethods()) { + if (method.getName().equals("")) { + continue; + } + if (exposedCls.inheritedMethods.containsKey(method.getDescriptor()) + || exposedCls.methods.containsKey(method.getDescriptor())) { + MethodDependency methodDep = agent.linkMethod(method.getReference(), null); + methodDep.getVariable(0).propagate(agent.getType(name)); + methodDep.use(); + } } } if (exposedCls.functorField == null) { diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSNativeGenerator.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSNativeGenerator.java index cf5bab807..25c603de3 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSNativeGenerator.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSNativeGenerator.java @@ -31,6 +31,7 @@ import org.teavm.dependency.DependencyPlugin; import org.teavm.dependency.MethodDependency; import org.teavm.model.CallLocation; import org.teavm.model.ClassReader; +import org.teavm.model.ElementModifier; import org.teavm.model.MethodReader; import org.teavm.model.MethodReference; import org.teavm.model.ValueType; @@ -176,7 +177,7 @@ public class JSNativeGenerator implements Injector, DependencyPlugin, Generator case "instantiate": case "function": for (int i = 0; i < method.getReference().parameterCount(); ++i) { - method.getVariable(i).addConsumer(type -> achieveFunctorMethods(agent, type.getName(), method)); + method.getVariable(i).addConsumer(type -> reachFunctorMethods(agent, type.getName(), method)); } break; case "unwrapString": @@ -185,14 +186,16 @@ public class JSNativeGenerator implements Injector, DependencyPlugin, Generator } } - private void achieveFunctorMethods(DependencyAgent agent, String type, MethodDependency caller) { + private void reachFunctorMethods(DependencyAgent agent, String type, MethodDependency caller) { if (caller.isMissing()) { return; } ClassReader cls = agent.getClassSource().get(type); if (cls != null) { for (MethodReader method : cls.getMethods()) { - agent.linkMethod(method.getReference(), null).use(); + if (!method.hasModifier(ElementModifier.STATIC)) { + agent.linkMethod(method.getReference(), null).use(); + } } } } diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSObjectClassTransformer.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSObjectClassTransformer.java index bf7bd34ed..00214c46a 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSObjectClassTransformer.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSObjectClassTransformer.java @@ -22,10 +22,6 @@ import org.teavm.model.ClassReaderSource; import org.teavm.model.MethodHolder; import org.teavm.model.MethodReference; -/** - * - * @author Alexey Andreev - */ public class JSObjectClassTransformer implements ClassHolderTransformer { private JSClassProcessor processor; private JSBodyRepository repository;