chore: checkerframework

This commit is contained in:
zaaarf 2023-03-02 10:43:58 +01:00
parent eb5ee8e453
commit 8127c30fc7
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C
4 changed files with 21 additions and 16 deletions

View file

@ -3,6 +3,7 @@ plugins {
id 'eclipse'
alias libs.plugins.forgeGradle;
alias libs.plugins.gitVersion;
alias libs.plugins.checkerFramework
}
version = gitVersion()

View file

@ -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" }

View file

@ -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();

View file

@ -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;
}
}