diff --git a/core/src/main/java/org/teavm/dependency/Linker.java b/core/src/main/java/org/teavm/dependency/Linker.java index 70a514087..64a7c9d7b 100644 --- a/core/src/main/java/org/teavm/dependency/Linker.java +++ b/core/src/main/java/org/teavm/dependency/Linker.java @@ -47,9 +47,13 @@ public class Linker { MethodReference methodRef = method.getReference(); MethodDependencyInfo methodDep = dependency.getMethod(methodRef); if (methodDep == null || !methodDep.isUsed()) { - method.getModifiers().add(ElementModifier.ABSTRACT); - method.getModifiers().remove(ElementModifier.NATIVE); - method.setProgram(null); + if (method.hasModifier(ElementModifier.STATIC)) { + cls.removeMethod(method); + } else { + method.getModifiers().add(ElementModifier.ABSTRACT); + method.getModifiers().remove(ElementModifier.NATIVE); + method.setProgram(null); + } } else if (method.getProgram() != null) { link(method.getReference(), method.getProgram()); } diff --git a/core/src/main/java/org/teavm/vm/TeaVM.java b/core/src/main/java/org/teavm/vm/TeaVM.java index 90caa2fe3..f119f6b65 100644 --- a/core/src/main/java/org/teavm/vm/TeaVM.java +++ b/core/src/main/java/org/teavm/vm/TeaVM.java @@ -963,9 +963,13 @@ public class TeaVM implements TeaVMHost, ServiceRepository { for (MethodHolder method : cls.getMethods().toArray(new MethodHolder[0])) { MethodDependencyInfo methodDep = dependencyAnalyzer.getMethod(method.getReference()); if (methodDep == null || !methodDep.isUsed()) { - method.getModifiers().add(ElementModifier.ABSTRACT); - method.getModifiers().remove(ElementModifier.NATIVE); - method.setProgram(null); + if (method.hasModifier(ElementModifier.STATIC)) { + cls.removeMethod(method); + } else { + method.getModifiers().add(ElementModifier.ABSTRACT); + method.getModifiers().remove(ElementModifier.NATIVE); + method.setProgram(null); + } } else { MethodReader methodReader = classReader.getMethod(method.getDescriptor()); if (methodReader != null && methodReader.getProgram() != null) {