mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-07 08:52:59 +00:00
Switch the core library to be non-null by default
See comments in c8c128d335 for further
details. This requires /relatively/ few changes - mostly cases we were
missing @Nullable annotations.
This commit is contained in:
@@ -23,7 +23,6 @@ import org.opentest4j.AssertionFailedError;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -249,7 +248,6 @@ public class ComputerTestDelegate {
|
||||
}
|
||||
|
||||
public static class FakeModem implements IPeripheral {
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getType() {
|
||||
return "modem";
|
||||
@@ -267,7 +265,6 @@ public class ComputerTestDelegate {
|
||||
}
|
||||
|
||||
public static class FakePeripheralHub implements IPeripheral {
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getType() {
|
||||
return "peripheral_hub";
|
||||
|
||||
@@ -8,7 +8,6 @@ package dan200.computercraft.core.apis;
|
||||
import dan200.computercraft.api.lua.*;
|
||||
import dan200.computercraft.core.asm.LuaMethod;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -51,7 +50,7 @@ public class ObjectWrapper implements ILuaContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long issueMainThreadTask(@Nonnull ILuaTask task) {
|
||||
public long issueMainThreadTask(ILuaTask task) {
|
||||
throw new IllegalStateException("Method should never queue events");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import dan200.computercraft.core.computer.ComputerSide;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
@@ -241,7 +240,7 @@ public class GeneratorTest {
|
||||
|
||||
private static final ILuaContext CONTEXT = new ILuaContext() {
|
||||
@Override
|
||||
public long issueMainThreadTask(@Nonnull ILuaTask task) {
|
||||
public long issueMainThreadTask(ILuaTask task) {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,6 @@ import dan200.computercraft.core.computer.ComputerBootstrap;
|
||||
import dan200.computercraft.core.computer.ComputerSide;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
|
||||
@@ -99,7 +98,6 @@ public class MethodTest {
|
||||
return 123;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getType() {
|
||||
return "main_thread";
|
||||
@@ -112,21 +110,18 @@ public class MethodTest {
|
||||
}
|
||||
|
||||
public static class Dynamic implements IDynamicLuaObject, ILuaAPI, IDynamicPeripheral {
|
||||
@Nonnull
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{ "foo" };
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MethodResult callMethod(@Nonnull ILuaContext context, int method, @Nonnull IArguments arguments) {
|
||||
public MethodResult callMethod(ILuaContext context, int method, IArguments arguments) {
|
||||
return MethodResult.of(123);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MethodResult callMethod(@Nonnull IComputerAccess computer, @Nonnull ILuaContext context, int method, @Nonnull IArguments arguments) {
|
||||
public MethodResult callMethod(IComputerAccess computer, ILuaContext context, int method, IArguments arguments) {
|
||||
return callMethod(context, method, arguments);
|
||||
}
|
||||
|
||||
@@ -140,7 +135,6 @@ public class MethodTest {
|
||||
return new String[]{ "dynamic" };
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getType() {
|
||||
return "dynamic";
|
||||
@@ -179,7 +173,6 @@ public class MethodTest {
|
||||
throw new LuaException("!");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getType() {
|
||||
return "throw";
|
||||
@@ -192,7 +185,6 @@ public class MethodTest {
|
||||
}
|
||||
|
||||
public static class ManyMethods implements IDynamicLuaObject, ILuaAPI {
|
||||
@Nonnull
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
var methods = new String[40];
|
||||
@@ -200,9 +192,8 @@ public class MethodTest {
|
||||
return methods;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public MethodResult callMethod(@Nonnull ILuaContext context, int method, @Nonnull IArguments arguments) throws LuaException {
|
||||
public MethodResult callMethod(ILuaContext context, int method, IArguments arguments) throws LuaException {
|
||||
return MethodResult.of();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,20 +34,6 @@ class TerminalTest {
|
||||
assertEquals("fedcba9876543210", terminal.getBackgroundColourLine(1).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetLineOutOfBounds() {
|
||||
var terminal = new Terminal(16, 9, true);
|
||||
|
||||
assertNull(terminal.getLine(-5));
|
||||
assertNull(terminal.getLine(12));
|
||||
|
||||
assertNull(terminal.getTextColourLine(-5));
|
||||
assertNull(terminal.getTextColourLine(12));
|
||||
|
||||
assertNull(terminal.getBackgroundColourLine(-5));
|
||||
assertNull(terminal.getBackgroundColourLine(12));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDefaults() {
|
||||
var terminal = new Terminal(16, 9, true);
|
||||
|
||||
Reference in New Issue
Block a user