mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Missing (un)boxing for long values in reflection method value marshalling.
This commit is contained in:
parent
e064457fe7
commit
42cd4c7cb4
|
@ -314,6 +314,9 @@ public class ReflectionDependencyListener extends AbstractDependencyListener {
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
boxMethod = new MethodReference(Integer.class, "valueOf", int.class, Integer.class);
|
boxMethod = new MethodReference(Integer.class, "valueOf", int.class, Integer.class);
|
||||||
break;
|
break;
|
||||||
|
case LONG:
|
||||||
|
boxMethod = new MethodReference(Long.class, "valueOf", long.class, Long.class);
|
||||||
|
break;
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
boxMethod = new MethodReference(Float.class, "valueOf", float.class, Float.class);
|
boxMethod = new MethodReference(Float.class, "valueOf", float.class, Float.class);
|
||||||
break;
|
break;
|
||||||
|
@ -351,6 +354,9 @@ public class ReflectionDependencyListener extends AbstractDependencyListener {
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
unboxMethod = new MethodReference(Integer.class, "intValue", int.class);
|
unboxMethod = new MethodReference(Integer.class, "intValue", int.class);
|
||||||
break;
|
break;
|
||||||
|
case LONG:
|
||||||
|
unboxMethod = new MethodReference(Long.class, "longValue", long.class);
|
||||||
|
break;
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
unboxMethod = new MethodReference(Float.class, "floatValue", float.class);
|
unboxMethod = new MethodReference(Float.class, "floatValue", float.class);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class FieldTest {
|
||||||
+ "java.lang.String org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.d;"
|
+ "java.lang.String org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.d;"
|
||||||
+ "long org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.e;"
|
+ "long org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.e;"
|
||||||
+ "private static short org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.f;"
|
+ "private static short org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.f;"
|
||||||
|
+ "long org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.g;"
|
||||||
+ "static boolean org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.initialized;",
|
+ "static boolean org.teavm.classlib.java.lang.reflect.FieldTest$ReflectableType.initialized;",
|
||||||
sb.toString());
|
sb.toString());
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,14 @@ public class FieldTest {
|
||||||
assertEquals(23, result);
|
assertEquals(23, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fieldReadLong() throws NoSuchFieldException, IllegalAccessException {
|
||||||
|
ReflectableType instance = new ReflectableType();
|
||||||
|
Field field = instance.getClass().getDeclaredField("g");
|
||||||
|
Object result = field.get(instance);
|
||||||
|
assertEquals(Long.MAX_VALUE, result);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fieldWritten() throws NoSuchFieldException, IllegalAccessException {
|
public void fieldWritten() throws NoSuchFieldException, IllegalAccessException {
|
||||||
ReflectableType instance = new ReflectableType();
|
ReflectableType instance = new ReflectableType();
|
||||||
|
@ -116,10 +125,9 @@ public class FieldTest {
|
||||||
@Reflectable private boolean b;
|
@Reflectable private boolean b;
|
||||||
@Reflectable Object c;
|
@Reflectable Object c;
|
||||||
@Reflectable String d;
|
@Reflectable String d;
|
||||||
|
|
||||||
long e;
|
long e;
|
||||||
|
|
||||||
@Reflectable private static short f = 99;
|
@Reflectable private static short f = 99;
|
||||||
|
@Reflectable long g;
|
||||||
|
|
||||||
static boolean initialized = true;
|
static boolean initialized = true;
|
||||||
|
|
||||||
|
@ -129,6 +137,7 @@ public class FieldTest {
|
||||||
c = "foo";
|
c = "foo";
|
||||||
d = "bar";
|
d = "bar";
|
||||||
e = 42;
|
e = 42;
|
||||||
|
g = Long.MAX_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class MethodTest {
|
||||||
|
|
||||||
assertEquals(""
|
assertEquals(""
|
||||||
+ "java.lang.Object Foo.baz();"
|
+ "java.lang.Object Foo.baz();"
|
||||||
|
+ "public void Foo.accept(long);"
|
||||||
+ "public void Foo.bar(java.lang.Object);",
|
+ "public void Foo.bar(java.lang.Object);",
|
||||||
text);
|
text);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +47,7 @@ public class MethodTest {
|
||||||
|
|
||||||
String text = collectMethods(Foo.class.getMethods());
|
String text = collectMethods(Foo.class.getMethods());
|
||||||
|
|
||||||
assertEquals("public void Foo.bar(java.lang.Object);", text);
|
assertEquals("public void Foo.accept(long);public void Foo.bar(java.lang.Object);", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -94,6 +95,7 @@ public class MethodTest {
|
||||||
private void callMethods() {
|
private void callMethods() {
|
||||||
new Foo().bar(null);
|
new Foo().bar(null);
|
||||||
new Foo().baz();
|
new Foo().baz();
|
||||||
|
new Foo().accept(0);
|
||||||
new SuperClass().f();
|
new SuperClass().f();
|
||||||
new SubClass().g();
|
new SubClass().g();
|
||||||
new SuperClassWithBridge().f();
|
new SuperClassWithBridge().f();
|
||||||
|
@ -118,6 +120,10 @@ public class MethodTest {
|
||||||
static class Foo {
|
static class Foo {
|
||||||
Object value;
|
Object value;
|
||||||
|
|
||||||
|
@Reflectable
|
||||||
|
public void accept(long l) {
|
||||||
|
}
|
||||||
|
|
||||||
@Reflectable
|
@Reflectable
|
||||||
public void bar(Object value) {
|
public void bar(Object value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user