diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ClassNativeGenerator.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ClassNativeGenerator.java index 868424c18..250be112b 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ClassNativeGenerator.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/ClassNativeGenerator.java @@ -137,11 +137,12 @@ public class ClassNativeGenerator implements Generator, Injector, DependencyPlug writer.outdent().append("}").softNewLine(); writer.append("var cls = " + self + ".$data;").softNewLine(); writer.append("var ctor = cls.$$constructor$$;").softNewLine(); - writer.append("if (ctor === null) {").indent().softNewLine(); - writer.append("var ex = new ").appendClass(InstantiationException.class.getName()).append("();"); + writer.append("if (!ctor) {").indent().softNewLine(); + /*writer.append("var ex = new ").appendClass(InstantiationException.class.getName()).append("();").softNewLine(); writer.appendMethodBody(new MethodReference(InstantiationException.class.getName(), new MethodDescriptor( - "", ValueType.VOID))).append("(ex);").softNewLine(); - writer.append("$rt_throw(ex);").softNewLine(); + "", ValueType.VOID))).append("(ex);").softNewLine();*/ + //writer.append("$rt_throw(ex);").softNewLine(); + writer.append("return null;").softNewLine(); writer.outdent().append("}").softNewLine(); writer.append("var instance = new cls();").softNewLine(); writer.append("ctor(instance);").softNewLine(); diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TComparable.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TComparable.java index 385181776..c56236365 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TComparable.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TComparable.java @@ -19,6 +19,6 @@ package org.teavm.classlib.java.lang; * * @author Alexey Andreev */ -public interface TComparable> { +public interface TComparable { int compareTo(T other); } diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TArrays.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TArrays.java index 10598dd18..e968d6779 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TArrays.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TArrays.java @@ -196,9 +196,9 @@ public class TArrays extends TObject { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public int compare(Object o1, Object o2) { if (o1 != null) { - return ((TComparable)o1).compareTo((TComparable)o2); + return ((TComparable)o1).compareTo(o2); } else if (o2 != null) { - return ((TComparable)o2).compareTo((TComparable)o1); + return ((TComparable)o2).compareTo(o1); } else { return 0; }