Add logic to allow synchronizing methods to main thread.

This commit is contained in:
Florian Nücke
2020-11-29 17:37:20 +01:00
parent 11e612c789
commit 35f5f2e2b6
6 changed files with 68 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ package li.cil.oc2.vm;
import li.cil.oc2.api.device.DeviceMethod;
import li.cil.oc2.api.device.DeviceMethodParameter;
import javax.annotation.Nullable;
import java.util.Optional;
abstract class AbstractTestMethod implements DeviceMethod {
@@ -22,6 +23,11 @@ abstract class AbstractTestMethod implements DeviceMethod {
return getClass().getSimpleName();
}
@Override
public boolean isSynchronized() {
return false;
}
@Override
public Class<?> getReturnType() {
return returnType;
@@ -33,10 +39,10 @@ abstract class AbstractTestMethod implements DeviceMethod {
}
private static final class TestParameter implements DeviceMethodParameter {
private final String name;
@Nullable private final String name;
private final Class<?> type;
public TestParameter(final String name, final Class<?> type) {
public TestParameter(@Nullable final String name, final Class<?> type) {
this.name = name;
this.type = type;
}