[*] Remove lombok.var for better compatibility

This commit is contained in:
2025-07-28 21:37:15 +02:00
parent 7c253a73b3
commit 20e08349e7
8 changed files with 27 additions and 31 deletions

View File

@@ -4,7 +4,6 @@ import de.siphalor.tweed5.annotationinheritance.impl.AnnotationInheritanceResolv
import de.siphalor.tweed5.typeutils.api.annotations.AnnotationRepeatType; import de.siphalor.tweed5.typeutils.api.annotations.AnnotationRepeatType;
import de.siphalor.tweed5.utils.api.collection.ClassToInstanceMap; import de.siphalor.tweed5.utils.api.collection.ClassToInstanceMap;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.var;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jspecify.annotations.NonNull; import org.jspecify.annotations.NonNull;
@@ -62,7 +61,8 @@ public class AnnotationInheritanceAwareAnnotatedElement implements AnnotatedElem
AnnotationRepeatType repeatType = AnnotationRepeatType.getType(annotationClass); AnnotationRepeatType repeatType = AnnotationRepeatType.getType(annotationClass);
if (repeatType instanceof AnnotationRepeatType.Repeatable) { if (repeatType instanceof AnnotationRepeatType.Repeatable) {
var containerRepeatType = ((AnnotationRepeatType.Repeatable) repeatType).containerRepeatType(); AnnotationRepeatType.RepeatableContainer containerRepeatType =
((AnnotationRepeatType.Repeatable) repeatType).containerRepeatType();
Annotation containerAnnotation = getOrResolveAnnotations().get(containerRepeatType.annotationClass()); Annotation containerAnnotation = getOrResolveAnnotations().get(containerRepeatType.annotationClass());
if (containerAnnotation != null) { if (containerAnnotation != null) {
return containerRepeatType.elements(containerAnnotation); return containerRepeatType.elements(containerAnnotation);

View File

@@ -3,7 +3,6 @@ package de.siphalor.tweed5.attributesextension.impl;
import de.siphalor.tweed5.attributesextension.api.AttributesExtension; import de.siphalor.tweed5.attributesextension.api.AttributesExtension;
import de.siphalor.tweed5.attributesextension.api.AttributesRelatedExtension; import de.siphalor.tweed5.attributesextension.api.AttributesRelatedExtension;
import de.siphalor.tweed5.core.api.container.ConfigContainer; import de.siphalor.tweed5.core.api.container.ConfigContainer;
import de.siphalor.tweed5.core.api.container.ConfigContainerSetupPhase;
import de.siphalor.tweed5.core.api.entry.ConfigEntry; import de.siphalor.tweed5.core.api.entry.ConfigEntry;
import de.siphalor.tweed5.core.api.entry.ConfigEntryVisitor; import de.siphalor.tweed5.core.api.entry.ConfigEntryVisitor;
import de.siphalor.tweed5.core.api.extension.TweedExtension; import de.siphalor.tweed5.core.api.extension.TweedExtension;
@@ -11,7 +10,6 @@ import de.siphalor.tweed5.core.api.extension.TweedExtensionSetupContext;
import de.siphalor.tweed5.patchwork.api.PatchworkPartAccess; import de.siphalor.tweed5.patchwork.api.PatchworkPartAccess;
import de.siphalor.tweed5.utils.api.collection.ImmutableArrayBackedMap; import de.siphalor.tweed5.utils.api.collection.ImmutableArrayBackedMap;
import lombok.Data; import lombok.Data;
import lombok.var;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import java.util.*; import java.util.*;
@@ -30,7 +28,7 @@ public class AttributesExtensionImpl implements AttributesExtension {
public void setAttribute(ConfigEntry<?> entry, String key, List<String> values) { public void setAttribute(ConfigEntry<?> entry, String key, List<String> values) {
requireEditable(); requireEditable();
var attributes = getOrCreateEditableAttributes(entry); Map<String, List<String>> attributes = getOrCreateEditableAttributes(entry);
attributes.compute(key, (k, existingValues) -> { attributes.compute(key, (k, existingValues) -> {
if (existingValues == null) { if (existingValues == null) {
@@ -46,7 +44,7 @@ public class AttributesExtensionImpl implements AttributesExtension {
public void setAttributeDefault(ConfigEntry<?> entry, String key, List<String> values) { public void setAttributeDefault(ConfigEntry<?> entry, String key, List<String> values) {
requireEditable(); requireEditable();
var attributeDefaults = getOrCreateEditableAttributeDefaults(entry); Map<String, List<String>> attributeDefaults = getOrCreateEditableAttributeDefaults(entry);
attributeDefaults.compute(key, (k, existingValues) -> { attributeDefaults.compute(key, (k, existingValues) -> {
if (existingValues == null) { if (existingValues == null) {
@@ -66,7 +64,7 @@ public class AttributesExtensionImpl implements AttributesExtension {
private Map<String, List<String>> getOrCreateEditableAttributes(ConfigEntry<?> entry) { private Map<String, List<String>> getOrCreateEditableAttributes(ConfigEntry<?> entry) {
CustomEntryData data = getOrCreateCustomEntryData(entry); CustomEntryData data = getOrCreateCustomEntryData(entry);
var attributes = data.attributes(); Map<String, List<String>> attributes = data.attributes();
if (attributes == null) { if (attributes == null) {
attributes = new HashMap<>(); attributes = new HashMap<>();
data.attributes(attributes); data.attributes(attributes);
@@ -76,7 +74,7 @@ public class AttributesExtensionImpl implements AttributesExtension {
private Map<String, List<String>> getOrCreateEditableAttributeDefaults(ConfigEntry<?> entry) { private Map<String, List<String>> getOrCreateEditableAttributeDefaults(ConfigEntry<?> entry) {
CustomEntryData data = getOrCreateCustomEntryData(entry); CustomEntryData data = getOrCreateCustomEntryData(entry);
var attributeDefaults = data.attributeDefaults(); Map<String, List<String>> attributeDefaults = data.attributeDefaults();
if (attributeDefaults == null) { if (attributeDefaults == null) {
attributeDefaults = new HashMap<>(); attributeDefaults = new HashMap<>();
data.attributeDefaults(attributeDefaults); data.attributeDefaults(attributeDefaults);
@@ -113,13 +111,13 @@ public class AttributesExtensionImpl implements AttributesExtension {
} }
private void enterEntry(ConfigEntry<?> entry) { private void enterEntry(ConfigEntry<?> entry) {
var data = entry.extensionsData().get(dataAccess); CustomEntryData data = entry.extensionsData().get(dataAccess);
var currentDefaults = defaults.getFirst(); Map<String, List<String>> currentDefaults = defaults.getFirst();
if (data == null) { if (data == null) {
defaults.push(currentDefaults); defaults.push(currentDefaults);
return; return;
} }
var entryDefaults = data.attributeDefaults(); Map<String, List<String>> entryDefaults = data.attributeDefaults();
data.attributeDefaults(null); data.attributeDefaults(null);
if (entryDefaults == null || entryDefaults.isEmpty()) { if (entryDefaults == null || entryDefaults.isEmpty()) {
defaults.push(currentDefaults); defaults.push(currentDefaults);
@@ -143,8 +141,8 @@ public class AttributesExtensionImpl implements AttributesExtension {
@Override @Override
public void visitEntry(ConfigEntry<?> entry) { public void visitEntry(ConfigEntry<?> entry) {
var data = getOrCreateCustomEntryData(entry); CustomEntryData data = getOrCreateCustomEntryData(entry);
var currentDefaults = defaults.getFirst(); Map<String, List<String>> currentDefaults = defaults.getFirst();
if (data.attributes() == null || data.attributes().isEmpty()) { if (data.attributes() == null || data.attributes().isEmpty()) {
data.attributes(currentDefaults); data.attributes(currentDefaults);
} else { } else {

View File

@@ -27,7 +27,6 @@ import de.siphalor.tweed5.utils.api.UniqueSymbol;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.var;
import org.jspecify.annotations.NonNull; import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
@@ -133,7 +132,7 @@ public class AttributesReadWriteFilterExtensionImpl
public void addFilter(Patchwork contextExtensionsData, String key, String value) { public void addFilter(Patchwork contextExtensionsData, String key, String value) {
requireInitialized(); requireInitialized();
var contextCustomData = getOrCreateReadWriteContextCustomData(contextExtensionsData); ReadWriteContextCustomData contextCustomData = getOrCreateReadWriteContextCustomData(contextExtensionsData);
addFilterToRWContextData(key, value, contextCustomData); addFilterToRWContextData(key, value, contextCustomData);
} }

View File

@@ -14,7 +14,6 @@ import de.siphalor.tweed5.defaultextensions.pather.api.PathTrackingDataVisitor;
import de.siphalor.tweed5.defaultextensions.pather.api.PatherExtension; import de.siphalor.tweed5.defaultextensions.pather.api.PatherExtension;
import de.siphalor.tweed5.patchwork.api.PatchworkPartAccess; import de.siphalor.tweed5.patchwork.api.PatchworkPartAccess;
import lombok.val; import lombok.val;
import lombok.var;
import org.jspecify.annotations.NonNull; import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
@@ -76,7 +75,7 @@ public class PatherExtensionImpl implements PatherExtension, ReadWriteRelatedExt
try { try {
return castedInner.read(new PathTrackingDataReader(reader, pathTracking), entry, context); return castedInner.read(new PathTrackingDataReader(reader, pathTracking), entry, context);
} catch (TweedEntryReadException e) { } catch (TweedEntryReadException e) {
var exceptionPathTracking = e.context().extensionsData().get(rwContextPathTrackingAccess); val exceptionPathTracking = e.context().extensionsData().get(rwContextPathTrackingAccess);
if (exceptionPathTracking != null) { if (exceptionPathTracking != null) {
throw new TweedEntryReadException( throw new TweedEntryReadException(
"Exception while reading entry at " "Exception while reading entry at "
@@ -119,7 +118,7 @@ public class PatherExtensionImpl implements PatherExtension, ReadWriteRelatedExt
try { try {
castedInner.write(new PathTrackingDataVisitor(writer, pathTracking), value, entry, context); castedInner.write(new PathTrackingDataVisitor(writer, pathTracking), value, entry, context);
} catch (TweedEntryWriteException e) { } catch (TweedEntryWriteException e) {
var exceptionPathTracking = e.context().extensionsData().get(rwContextPathTrackingAccess); val exceptionPathTracking = e.context().extensionsData().get(rwContextPathTrackingAccess);
if (exceptionPathTracking != null) { if (exceptionPathTracking != null) {
throw new TweedEntryWriteException( throw new TweedEntryWriteException(
"Exception while writing entry at " "Exception while writing entry at "

View File

@@ -9,7 +9,7 @@ import de.siphalor.tweed5.dataapi.api.*;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.var; import lombok.val;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
@@ -181,7 +181,7 @@ public class TweedEntryReaderWriterImpls {
NOOP_READER_WRITER.read(reader, null, context); NOOP_READER_WRITER.read(reader, null, context);
continue; continue;
} }
var subEntryReaderChain = context.readWriteExtension().getReaderChain(subEntry); val subEntryReaderChain = context.readWriteExtension().getReaderChain(subEntry);
Object subEntryValue = subEntryReaderChain.read(reader, subEntry, context); Object subEntryValue = subEntryReaderChain.read(reader, subEntry, context);
entry.set(compoundValue, key, subEntryValue); entry.set(compoundValue, key, subEntryValue);
} else { } else {

View File

@@ -6,7 +6,7 @@ import de.siphalor.tweed5.core.api.entry.ConfigEntry;
import de.siphalor.tweed5.typeutils.api.type.ActualType; import de.siphalor.tweed5.typeutils.api.type.ActualType;
import de.siphalor.tweed5.weaver.pojo.api.weaving.TweedPojoWeavingExtension; import de.siphalor.tweed5.weaver.pojo.api.weaving.TweedPojoWeavingExtension;
import de.siphalor.tweed5.weaver.pojo.api.weaving.WeavingContext; import de.siphalor.tweed5.weaver.pojo.api.weaving.WeavingContext;
import lombok.var; import lombok.val;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import java.util.*; import java.util.*;
@@ -31,12 +31,12 @@ public class AttributesPojoWeavingProcessor implements TweedPojoWeavingExtension
@Override @Override
public <T> void afterWeaveEntry(ActualType<T> valueType, ConfigEntry<T> configEntry, WeavingContext context) { public <T> void afterWeaveEntry(ActualType<T> valueType, ConfigEntry<T> configEntry, WeavingContext context) {
var attributeAnnotations = context.annotations().getAnnotationsByType(Attribute.class); val attributeAnnotations = context.annotations().getAnnotationsByType(Attribute.class);
var attributes = collectAttributesFromAnnotations(attributeAnnotations, Attribute::key, Attribute::values); val attributes = collectAttributesFromAnnotations(attributeAnnotations, Attribute::key, Attribute::values);
attributes.forEach((key, values) -> attributesExtension.setAttribute(configEntry, key, values)); attributes.forEach((key, values) -> attributesExtension.setAttribute(configEntry, key, values));
var attributeDefaultAnnotations = context.annotations().getAnnotationsByType(AttributeDefault.class); val attributeDefaultAnnotations = context.annotations().getAnnotationsByType(AttributeDefault.class);
var attributeDefaults = collectAttributesFromAnnotations( val attributeDefaults = collectAttributesFromAnnotations(
attributeDefaultAnnotations, attributeDefaultAnnotations,
AttributeDefault::key, AttributeDefault::key,
AttributeDefault::defaultValue AttributeDefault::defaultValue

View File

@@ -11,7 +11,7 @@ import de.siphalor.tweed5.weaver.pojo.api.weaving.ProtoWeavingContext;
import de.siphalor.tweed5.weaver.pojo.api.weaving.TweedPojoWeavingExtension; import de.siphalor.tweed5.weaver.pojo.api.weaving.TweedPojoWeavingExtension;
import de.siphalor.tweed5.weaver.pojo.api.weaving.WeavingContext; import de.siphalor.tweed5.weaver.pojo.api.weaving.WeavingContext;
import lombok.Value; import lombok.Value;
import lombok.var; import lombok.val;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
@@ -41,7 +41,7 @@ public class AutoNullableReadWritePojoWeavingProcessor implements TweedPojoWeavi
AutoReadWriteNullability innerNullability = null; AutoReadWriteNullability innerNullability = null;
var behavior = context.annotations().getAnnotation(AutoNullableReadWriteBehavior.class); val behavior = context.annotations().getAnnotation(AutoNullableReadWriteBehavior.class);
if (behavior != null) { if (behavior != null) {
innerNullability = behavior.defaultNullability(); innerNullability = behavior.defaultNullability();
} }
@@ -67,14 +67,14 @@ public class AutoNullableReadWritePojoWeavingProcessor implements TweedPojoWeavi
@Override @Override
public <T> void afterWeaveEntry(ActualType<T> valueType, ConfigEntry<T> configEntry, WeavingContext context) { public <T> void afterWeaveEntry(ActualType<T> valueType, ConfigEntry<T> configEntry, WeavingContext context) {
if (getNullability(valueType, context) == AutoReadWriteNullability.NULLABLE) { if (getNullability(valueType, context) == AutoReadWriteNullability.NULLABLE) {
var definedEntryReader = readWriteExtension.getDefinedEntryReader(configEntry); val definedEntryReader = readWriteExtension.getDefinedEntryReader(configEntry);
if (definedEntryReader != null) { if (definedEntryReader != null) {
readWriteExtension.setEntryReader( readWriteExtension.setEntryReader(
configEntry, configEntry,
new TweedEntryReaderWriterImpls.NullableReader<>(definedEntryReader) new TweedEntryReaderWriterImpls.NullableReader<>(definedEntryReader)
); );
} }
var definedEntryWriter = readWriteExtension.getDefinedEntryWriter(configEntry); val definedEntryWriter = readWriteExtension.getDefinedEntryWriter(configEntry);
if (definedEntryWriter != null) { if (definedEntryWriter != null) {
readWriteExtension.setEntryWriter( readWriteExtension.setEntryWriter(
configEntry, configEntry,

View File

@@ -8,7 +8,7 @@ import de.siphalor.tweed5.defaultextensions.validation.api.validators.NumberRang
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Value; import lombok.Value;
import lombok.var; import lombok.val;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@@ -43,7 +43,7 @@ public class WeavableNumberRangeValidator implements WeavableConfigEntryValidato
//noinspection unchecked //noinspection unchecked
Class<? extends Number> numberClass = boxClass((Class<? extends Number>) configEntry.valueClass()); Class<? extends Number> numberClass = boxClass((Class<? extends Number>) configEntry.valueClass());
//noinspection unchecked //noinspection unchecked
var builder = NumberRangeValidator.builder((Class<Number>) numberClass); val builder = NumberRangeValidator.builder((Class<Number>) numberClass);
String minGroup = matcher.group(1); String minGroup = matcher.group(1);
if (minGroup != null) { if (minGroup != null) {