From 6964c7190d090a5ef3f2bcf8139d6596839cf8eb Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Sun, 15 Mar 2015 19:03:57 +0300 Subject: [PATCH] Fix non-async application detection. Fix javadoc comments. --- .../src/main/java/org/teavm/model/package-info.java | 4 ++-- .../main/java/org/teavm/model/util/AsyncMethodFinder.java | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/teavm-core/src/main/java/org/teavm/model/package-info.java b/teavm-core/src/main/java/org/teavm/model/package-info.java index f50ee2cd4..a1d7c1dc1 100644 --- a/teavm-core/src/main/java/org/teavm/model/package-info.java +++ b/teavm-core/src/main/java/org/teavm/model/package-info.java @@ -14,10 +14,10 @@ * limitations under the License. */ /** - * Represents a class model that is alternative to {@link java.lang.reflection} package. + * Represents a class model that is alternative to {@code java.lang.reflection} package. * Model is suitable for representing classes that are not in class path. Also * it allows to disassemble method bodies into three-address code that is very - * close to JVM bytecode (see {@link org.teavm.model.instructions}. + * close to JVM bytecode (see {@code org.teavm.model.instructions}. * *

The entry point is some implementation of {@link org.teavm.model.ClassHolderSource} interface. * diff --git a/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java b/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java index 610b5ce6b..d17297756 100644 --- a/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java +++ b/teavm-core/src/main/java/org/teavm/model/util/AsyncMethodFinder.java @@ -109,7 +109,13 @@ public class AsyncMethodFinder { int.class, void.class))) { --count; } - return count > 0; + if (asyncMethods.contains(new MethodReference(Object.class, "monitorEnterWait", Object.class, + int.class, void.class))) { + --count; + } + ClassReader cls = classSource.get("java.lang.Thread"); + MethodReader method = cls != null ? cls.getMethod(new MethodDescriptor("start", void.class)) : null; + return count > 0 && method != null; } private void add(MethodReference methodRef) {