summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-03-02 10:43:58 +0100
committer zaaarf <zaaarf@proton.me>2023-03-02 10:45:46 +0100
commit8127c30fc791826c3d3f95d9e3ac21ebb3a0a6bf (patch)
tree3a492b392af0c4ff98d5987da514dc6a2e40f5cc
parenteb5ee8e45313c6856b52e5f53b8aa73d7506246b (diff)
chore: checkerframework
-rw-r--r--build.gradle1
-rw-r--r--gradle/libs.versions.toml4
-rw-r--r--src/main/java/ftbsc/bscv/Boscovicino.java2
-rw-r--r--src/main/java/ftbsc/bscv/system/ModManager.java30
4 files changed, 21 insertions, 16 deletions
diff --git a/build.gradle b/build.gradle
index 0a783d8..170d5d8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,6 +3,7 @@ plugins {
id 'eclipse'
alias libs.plugins.forgeGradle;
alias libs.plugins.gitVersion;
+ alias libs.plugins.checkerFramework
}
version = gitVersion()
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 7b6b12a..60d9958 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -7,10 +7,12 @@ autoService = "1.0.1"
javaPoet = "1.13.0"
lillero = "0.3.0"
lilleroProcessor = "0.2.1"
+checkerFramework = "0.6.24"
[plugins]
forgeGradle = { id = "net.minecraftforge.gradle", version.ref = "forgeGradle" }
gitVersion = { id = "com.palantir.git-version", version.ref = "gitVersion" }
+checkerFramework = { id = "org.checkerframework", version.ref = "checkerFramework"}
[libraries]
minecraftForge = { group = "net.minecraftforge", name = "forge", version.ref = "forge" }
@@ -18,4 +20,4 @@ autoService = { group = "com.google.auto.service", name = "auto-service", versio
autoServiceAnnotations = { group = "com.google.auto.service", name = "auto-service-annotations", version.ref = "autoService" }
javaPoet = { group = "com.squareup", name = "javapoet", version.ref = "javaPoet" }
lillero = { group = "ftbsc", name = "lll", version.ref = "lillero" }
-lilleroProcessor = { group = "ftbsc.lll", name = "processor", version.ref = "lilleroProcessor" }
+lilleroProcessor = { group = "ftbsc.lll", name = "processor", version.ref = "lilleroProcessor" } \ No newline at end of file
diff --git a/src/main/java/ftbsc/bscv/Boscovicino.java b/src/main/java/ftbsc/bscv/Boscovicino.java
index 4754182..d54a3d4 100644
--- a/src/main/java/ftbsc/bscv/Boscovicino.java
+++ b/src/main/java/ftbsc/bscv/Boscovicino.java
@@ -52,6 +52,8 @@ public class Boscovicino implements ICommons {
Boscovicino.modManager = new ModManager(cfg, dp);
Boscovicino.modManager.load();
+ Boscovicino.modManager.finish();
+
Boscovicino.spec = cfg.build();
ForgeConfigSpec.Builder friendSpec = new ForgeConfigSpec.Builder();
diff --git a/src/main/java/ftbsc/bscv/system/ModManager.java b/src/main/java/ftbsc/bscv/system/ModManager.java
index e5f1c3c..2668a79 100644
--- a/src/main/java/ftbsc/bscv/system/ModManager.java
+++ b/src/main/java/ftbsc/bscv/system/ModManager.java
@@ -4,23 +4,23 @@ import com.mojang.brigadier.CommandDispatcher;
import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.api.IModule;
import net.minecraft.command.CommandSource;
-import net.minecraftforge.common.ForgeConfigSpec;
+import net.minecraftforge.common.ForgeConfigSpec.Builder;
+import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.HashSet;
-import java.util.Optional;
import java.util.ServiceLoader;
import java.util.Set;
public class ModManager {
- private Optional<ForgeConfigSpec.Builder> cfgBuilder;
- private Optional<CommandDispatcher<CommandSource>> dispatcher;
+ private Builder cfgBuilder;
+ private CommandDispatcher<CommandSource> dispatcher;
public final Set<IModule> mods;
public final Set<String> categories;
- public ModManager(ForgeConfigSpec.Builder cfgBuilder, CommandDispatcher<CommandSource> dispatcher) {
- this.cfgBuilder = Optional.of(cfgBuilder);
- this.dispatcher = Optional.of(dispatcher);
+ public ModManager(Builder cfgBuilder, CommandDispatcher<CommandSource> dispatcher) {
+ this.cfgBuilder = cfgBuilder;
+ this.dispatcher = dispatcher;
this.mods = new HashSet<>();
this.categories = new HashSet<>();
}
@@ -31,21 +31,21 @@ public class ModManager {
IModule mod = (IModule) module;
this.mods.add(mod);
this.categories.add(mod.getGroup());
- this.cfgBuilder.get().pop(); // TODO solved by AutoService, soon TM
+ this.cfgBuilder.pop(); // TODO
}
}
}
- public void finalize() {
- this.cfgBuilder = Optional.empty();
- this.dispatcher = Optional.empty();
+ public void finish() {
+ this.cfgBuilder = null;
+ this.dispatcher = null;
}
- public ForgeConfigSpec.Builder getCfgBuilder() {
- return cfgBuilder.get();
+ public @Nullable Builder getCfgBuilder() {
+ return cfgBuilder;
}
- public CommandDispatcher<CommandSource> getDispatcher() {
- return dispatcher.get();
+ public @Nullable CommandDispatcher<CommandSource> getDispatcher() {
+ return dispatcher;
}
}