mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fixes java.lang.Comparable interface
This commit is contained in:
parent
0004babe65
commit
68f9376242
|
@ -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(
|
||||
"<init>", ValueType.VOID))).append("(ex);").softNewLine();
|
||||
writer.append("$rt_throw(ex);").softNewLine();
|
||||
"<init>", 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();
|
||||
|
|
|
@ -19,6 +19,6 @@ package org.teavm.classlib.java.lang;
|
|||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface TComparable<T extends TComparable<T>> {
|
||||
public interface TComparable<T> {
|
||||
int compareTo(T other);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user