[*] Migrate to jspecify annotations
This commit is contained in:
@@ -5,7 +5,7 @@ import de.siphalor.tweed5.core.api.extension.EntryExtensionsData;
|
||||
import de.siphalor.tweed5.core.api.entry.ConfigEntry;
|
||||
import de.siphalor.tweed5.core.api.extension.RegisteredExtensionData;
|
||||
import de.siphalor.tweed5.core.api.extension.TweedExtension;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -4,13 +4,11 @@ import de.siphalor.tweed5.core.api.container.ConfigContainer;
|
||||
import de.siphalor.tweed5.core.api.extension.EntryExtensionsData;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public abstract class BaseConfigEntry<T> implements ConfigEntry<T> {
|
||||
|
||||
@NotNull
|
||||
private final Class<T> valueClass;
|
||||
private ConfigContainer<?> container;
|
||||
private EntryExtensionsData extensionsData;
|
||||
|
||||
@@ -2,7 +2,6 @@ package de.siphalor.tweed5.core.api.entry;
|
||||
|
||||
import de.siphalor.tweed5.core.api.extension.EntryExtensionsData;
|
||||
import de.siphalor.tweed5.core.api.container.ConfigContainer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ConfigEntry<T> {
|
||||
Class<T> valueClass();
|
||||
@@ -15,6 +14,5 @@ public interface ConfigEntry<T> {
|
||||
void visitInOrder(ConfigEntryVisitor visitor);
|
||||
void visitInOrder(ConfigEntryValueVisitor visitor, T value);
|
||||
|
||||
@NotNull
|
||||
T deepCopy(@NotNull T value);
|
||||
T deepCopy(T value);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
@NullMarked
|
||||
package de.siphalor.tweed5.core.api;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -12,11 +12,13 @@ import de.siphalor.tweed5.patchwork.impl.PatchworkClassPart;
|
||||
import de.siphalor.tweed5.utils.api.collection.InheritanceMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullUnmarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.util.*;
|
||||
|
||||
@NullUnmarked
|
||||
public class DefaultConfigContainer<T> implements ConfigContainer<T> {
|
||||
@Getter
|
||||
private ConfigContainerSetupPhase setupPhase = ConfigContainerSetupPhase.EXTENSIONS_SETUP;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package de.siphalor.tweed5.core.impl.entry;
|
||||
|
||||
import de.siphalor.tweed5.core.api.entry.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.IntFunction;
|
||||
@@ -52,7 +51,7 @@ public class CollectionConfigEntryImpl<E, T extends Collection<E>> extends BaseC
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull T deepCopy(@NotNull T value) {
|
||||
public T deepCopy(T value) {
|
||||
T copy = collectionConstructor.apply(value.size());
|
||||
for (E element : value) {
|
||||
copy.add(elementEntry().deepCopy(element));
|
||||
|
||||
@@ -4,7 +4,6 @@ import de.siphalor.tweed5.core.api.entry.BaseConfigEntry;
|
||||
import de.siphalor.tweed5.core.api.entry.ConfigEntryValueVisitor;
|
||||
import de.siphalor.tweed5.core.api.entry.ConfigEntryVisitor;
|
||||
import de.siphalor.tweed5.core.api.entry.SimpleConfigEntry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SimpleConfigEntryImpl<T> extends BaseConfigEntry<T> implements SimpleConfigEntry<T> {
|
||||
public SimpleConfigEntryImpl(Class<T> valueClass) {
|
||||
@@ -22,8 +21,7 @@ public class SimpleConfigEntryImpl<T> extends BaseConfigEntry<T> implements Simp
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public T deepCopy(@NotNull T value) {
|
||||
public T deepCopy(T value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package de.siphalor.tweed5.core.impl.entry;
|
||||
|
||||
import de.siphalor.tweed5.core.api.entry.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -11,7 +10,7 @@ public class StaticMapCompoundConfigEntryImpl<T extends Map<String, Object>> ext
|
||||
private final IntFunction<T> mapConstructor;
|
||||
private final Map<String, ConfigEntry<?>> compoundEntries = new LinkedHashMap<>();
|
||||
|
||||
public StaticMapCompoundConfigEntryImpl(@NotNull Class<T> valueClass, IntFunction<T> mapConstructor) {
|
||||
public StaticMapCompoundConfigEntryImpl(Class<T> valueClass, IntFunction<T> mapConstructor) {
|
||||
super(valueClass);
|
||||
this.mapConstructor = mapConstructor;
|
||||
}
|
||||
@@ -80,7 +79,7 @@ public class StaticMapCompoundConfigEntryImpl<T extends Map<String, Object>> ext
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull T deepCopy(@NotNull T value) {
|
||||
public T deepCopy(T value) {
|
||||
T copy = instantiateCompoundValue();
|
||||
value.forEach((String key, Object element) -> {
|
||||
//noinspection unchecked
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
package de.siphalor.tweed5.core.impl;
|
||||
@NullMarked
|
||||
package de.siphalor.tweed5.core.impl;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
Reference in New Issue
Block a user