diff --git a/teavm-core/src/main/java/org/teavm/dependency/DependencyChecker.java b/teavm-core/src/main/java/org/teavm/dependency/DependencyChecker.java index a54bf56ef..d806d2994 100644 --- a/teavm-core/src/main/java/org/teavm/dependency/DependencyChecker.java +++ b/teavm-core/src/main/java/org/teavm/dependency/DependencyChecker.java @@ -106,7 +106,9 @@ public class DependencyChecker { } void schedule(final Runnable runnable) { - activeTaskCount.incrementAndGet(); + synchronized (activeTaskMonitor) { + activeTaskCount.incrementAndGet(); + } try { executor.execute(new Runnable() { @Override public void run() { @@ -117,8 +119,8 @@ public class DependencyChecker { exceptionOccured.compareAndSet(null, e); executor.shutdownNow(); } - if (activeTaskCount.decrementAndGet() == 0) { - synchronized (activeTaskMonitor) { + synchronized (activeTaskMonitor) { + if (activeTaskCount.decrementAndGet() == 0) { activeTaskMonitor.notifyAll(); } } @@ -131,11 +133,11 @@ public class DependencyChecker { public void checkDependencies() { while (true) { - if (activeTaskCount.get() == 0 || exceptionOccured.get() != null) { - break; - } try { synchronized (activeTaskMonitor) { + if (activeTaskCount.get() == 0 || exceptionOccured.get() != null) { + break; + } activeTaskMonitor.wait(); } } catch (InterruptedException e) { diff --git a/teavm-core/src/main/java/org/teavm/model/resource/ClassRefsRenamer.java b/teavm-core/src/main/java/org/teavm/model/resource/ClassRefsRenamer.java index 48d1d6cd2..5f1ffe643 100644 --- a/teavm-core/src/main/java/org/teavm/model/resource/ClassRefsRenamer.java +++ b/teavm-core/src/main/java/org/teavm/model/resource/ClassRefsRenamer.java @@ -252,7 +252,7 @@ class ClassRefsRenamer implements InstructionVisitor { @Override public void visit(InvokeInstruction insn) { - String className = classNameMapper.map(insn.getMethod().getClassName()); + String className = classNameMapper.map(insn.getMethod().getClassName()); ValueType[] signature = insn.getMethod().getSignature(); for (int i = 0; i < signature.length; ++i) { signature[i] = rename(signature[i]);