1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-01 14:12:59 +00:00

Replace Collections methods with {List,Map,Set}.of

The two implementations aren't entirely compatible - the implementation
returned by .of will throw an NPE on .contains(null), whereas the
Collections implementations just return false. However, we try to avoid
passing null to collections methods, so this should be safe.

There's no strong reason to do this, but it helps make the code a little
more consistent
This commit is contained in:
Jonathan Coates
2023-10-21 10:37:43 +01:00
parent 8eabd4f303
commit cab66a2d6e
37 changed files with 79 additions and 95 deletions

View File

@@ -74,7 +74,7 @@ public class MethodReflection {
.build(CacheLoader.from(Internal::getMethodsImpl));
private static final StaticGenerator<LuaMethod> GENERATOR = new StaticGenerator<>(
LuaMethod.class, Collections.singletonList(ILuaContext.class), Internal::createClass
LuaMethod.class, List.of(ILuaContext.class), Internal::createClass
);
static List<NamedMethod<ReflectClass<LuaMethod>>> getMethods(Class<?> klass) {