From 61df32b7b2bfbad2cdbe58657491a7c6c61bbec2 Mon Sep 17 00:00:00 2001 From: Speiger Date: Thu, 15 Dec 2022 18:10:59 +0100 Subject: [PATCH] Fixed unit tests and java 8 incompat. --- .../builder/PrimitiveCollectionsBuilder.java | 2 +- .../src/builder/modules/FunctionModule.java | 10 +- .../templates/tests/misc/PairTester.template | 6 +- src/main/java/module-info.java | 165 ------------------ 4 files changed, 12 insertions(+), 171 deletions(-) delete mode 100644 src/main/java/module-info.java diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index 8ab7a343..ee744bba 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -251,7 +251,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor Set flags = new HashSet<>(Arrays.asList(args)); boolean silent = flags.contains("silent"); boolean force = flags.contains("force"); - boolean tests = flags.contains("tests"); + boolean tests = !flags.contains("tests"); boolean forceTests = flags.contains("force-tests"); boolean load = flags.contains("load"); boolean save = flags.contains("save"); diff --git a/src/builder/java/speiger/src/builder/modules/FunctionModule.java b/src/builder/java/speiger/src/builder/modules/FunctionModule.java index 8926b6c5..a20a8df5 100644 --- a/src/builder/java/speiger/src/builder/modules/FunctionModule.java +++ b/src/builder/java/speiger/src/builder/modules/FunctionModule.java @@ -65,8 +65,14 @@ public class FunctionModule extends BaseModule addBiClassMapper("BI_CONSUMER", "Consumer", ""); addClassMapper("BI_TO_OBJECT_CONSUMER", "ObjectConsumer"); addAbstractMapper("BI_FROM_OBJECT_CONSUMER", "Object%sConsumer"); - if(keyType.isObject()) addFunctionMappers("TO_OBJECT_FUNCTION", "UnaryOperator"); - else addClassMapper("TO_OBJECT_FUNCTION", "Function"); + if(keyType.isObject()) { + addSimpleMapper("TO_OBJECT_FUNCTION", keyType.getNonFileType()+"UnaryOperator"); + addSimpleMapper("VALUE_TO_OBJECT_FUNCTION", valueType.isObject() ? "UnaryOperator" : valueType.getFileType()+"Function"); + } + else { + addSimpleMapper("TO_OBJECT_FUNCTION", keyType.getNonFileType()+"Function"); + addSimpleMapper("VALUE_TO_OBJECT_FUNCTION", valueType.isObject() ? "UnaryOperator" : valueType.getFileType()+"Function"); + } if(valueType == ClassType.BOOLEAN) addFunctionMappers("FUNCTION", "%sPredicate"); else if(keyType.isObject() && !valueType.isObject()) addFunctionValueMappers("FUNCTION", "To%sFunction"); else if(keyType == valueType) addFunctionMappers("FUNCTION", "%sUnaryOperator"); diff --git a/src/builder/resources/speiger/assets/testers/templates/tests/misc/PairTester.template b/src/builder/resources/speiger/assets/testers/templates/tests/misc/PairTester.template index ce052a1f..1aa1b208 100644 --- a/src/builder/resources/speiger/assets/testers/templates/tests/misc/PairTester.template +++ b/src/builder/resources/speiger/assets/testers/templates/tests/misc/PairTester.template @@ -11,7 +11,7 @@ import java.util.function.Supplier; import org.junit.Test; import junit.framework.TestCase; -import speiger.src.collections.VALUE_PACKAGE.functions.function.FILE_VALUE_TYPE2ObjectFunction; +import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_TO_OBJECT_FUNCTION; #if !SAME_TYPE import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; #endif @@ -24,7 +24,7 @@ public class PAIRTester KEY_VALUE_GENERIC_TYPE extends TestCase Function copier; BiFunction constructor; TO_OBJECT_FUNCTION KKS_GENERIC_TYPE keyConstructor; - FILE_VALUE_TYPE2ObjectFunction VVS_GENERIC_TYPE valueConstructor; + VALUE_TO_OBJECT_FUNCTION VVS_GENERIC_TYPE valueConstructor; boolean mutable; protected PAIRTester(boolean mutable) { @@ -47,7 +47,7 @@ public class PAIRTester KEY_VALUE_GENERIC_TYPE extends TestCase this.keyConstructor = keyConstructor; } - protected void setValueConstructor(FILE_VALUE_TYPE2ObjectFunction VVS_GENERIC_TYPE valueConstructor) { + protected void setValueConstructor(VALUE_TO_OBJECT_FUNCTION VVS_GENERIC_TYPE valueConstructor) { this.valueConstructor = valueConstructor; } diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java deleted file mode 100644 index f4e4aacc..00000000 --- a/src/main/java/module-info.java +++ /dev/null @@ -1,165 +0,0 @@ -/** @author Speiger */ -module speiger.src.collections { - exports speiger.src.collections.booleans.collections; - exports speiger.src.collections.booleans.functions; - exports speiger.src.collections.booleans.functions.consumer; - exports speiger.src.collections.booleans.functions.function; - exports speiger.src.collections.booleans.lists; - exports speiger.src.collections.booleans.misc.pairs; - exports speiger.src.collections.booleans.misc.pairs.impl; - exports speiger.src.collections.booleans.queues; - exports speiger.src.collections.booleans.utils; - exports speiger.src.collections.bytes.collections; - exports speiger.src.collections.bytes.functions; - exports speiger.src.collections.bytes.functions.consumer; - exports speiger.src.collections.bytes.functions.function; - exports speiger.src.collections.bytes.lists; - exports speiger.src.collections.bytes.maps.abstracts; - exports speiger.src.collections.bytes.maps.impl.concurrent; - exports speiger.src.collections.bytes.maps.impl.customHash; - exports speiger.src.collections.bytes.maps.impl.hash; - exports speiger.src.collections.bytes.maps.impl.immutable; - exports speiger.src.collections.bytes.maps.impl.misc; - exports speiger.src.collections.bytes.maps.impl.tree; - exports speiger.src.collections.bytes.maps.interfaces; - exports speiger.src.collections.bytes.misc.pairs; - exports speiger.src.collections.bytes.misc.pairs.impl; - exports speiger.src.collections.bytes.queues; - exports speiger.src.collections.bytes.sets; - exports speiger.src.collections.bytes.utils; - exports speiger.src.collections.bytes.utils.maps; - exports speiger.src.collections.chars.collections; - exports speiger.src.collections.chars.functions; - exports speiger.src.collections.chars.functions.consumer; - exports speiger.src.collections.chars.functions.function; - exports speiger.src.collections.chars.lists; - exports speiger.src.collections.chars.maps.abstracts; - exports speiger.src.collections.chars.maps.impl.concurrent; - exports speiger.src.collections.chars.maps.impl.customHash; - exports speiger.src.collections.chars.maps.impl.hash; - exports speiger.src.collections.chars.maps.impl.immutable; - exports speiger.src.collections.chars.maps.impl.misc; - exports speiger.src.collections.chars.maps.impl.tree; - exports speiger.src.collections.chars.maps.interfaces; - exports speiger.src.collections.chars.misc.pairs; - exports speiger.src.collections.chars.misc.pairs.impl; - exports speiger.src.collections.chars.queues; - exports speiger.src.collections.chars.sets; - exports speiger.src.collections.chars.utils; - exports speiger.src.collections.chars.utils.maps; - exports speiger.src.collections.doubles.collections; - exports speiger.src.collections.doubles.functions; - exports speiger.src.collections.doubles.functions.consumer; - exports speiger.src.collections.doubles.functions.function; - exports speiger.src.collections.doubles.lists; - exports speiger.src.collections.doubles.maps.abstracts; - exports speiger.src.collections.doubles.maps.impl.concurrent; - exports speiger.src.collections.doubles.maps.impl.customHash; - exports speiger.src.collections.doubles.maps.impl.hash; - exports speiger.src.collections.doubles.maps.impl.immutable; - exports speiger.src.collections.doubles.maps.impl.misc; - exports speiger.src.collections.doubles.maps.impl.tree; - exports speiger.src.collections.doubles.maps.interfaces; - exports speiger.src.collections.doubles.misc.pairs; - exports speiger.src.collections.doubles.misc.pairs.impl; - exports speiger.src.collections.doubles.queues; - exports speiger.src.collections.doubles.sets; - exports speiger.src.collections.doubles.utils; - exports speiger.src.collections.doubles.utils.maps; - exports speiger.src.collections.floats.collections; - exports speiger.src.collections.floats.functions; - exports speiger.src.collections.floats.functions.consumer; - exports speiger.src.collections.floats.functions.function; - exports speiger.src.collections.floats.lists; - exports speiger.src.collections.floats.maps.abstracts; - exports speiger.src.collections.floats.maps.impl.concurrent; - exports speiger.src.collections.floats.maps.impl.customHash; - exports speiger.src.collections.floats.maps.impl.hash; - exports speiger.src.collections.floats.maps.impl.immutable; - exports speiger.src.collections.floats.maps.impl.misc; - exports speiger.src.collections.floats.maps.impl.tree; - exports speiger.src.collections.floats.maps.interfaces; - exports speiger.src.collections.floats.misc.pairs; - exports speiger.src.collections.floats.misc.pairs.impl; - exports speiger.src.collections.floats.queues; - exports speiger.src.collections.floats.sets; - exports speiger.src.collections.floats.utils; - exports speiger.src.collections.floats.utils.maps; - exports speiger.src.collections.ints.collections; - exports speiger.src.collections.ints.functions; - exports speiger.src.collections.ints.functions.consumer; - exports speiger.src.collections.ints.functions.function; - exports speiger.src.collections.ints.lists; - exports speiger.src.collections.ints.maps.abstracts; - exports speiger.src.collections.ints.maps.impl.concurrent; - exports speiger.src.collections.ints.maps.impl.customHash; - exports speiger.src.collections.ints.maps.impl.hash; - exports speiger.src.collections.ints.maps.impl.immutable; - exports speiger.src.collections.ints.maps.impl.misc; - exports speiger.src.collections.ints.maps.impl.tree; - exports speiger.src.collections.ints.maps.interfaces; - exports speiger.src.collections.ints.misc.pairs; - exports speiger.src.collections.ints.misc.pairs.impl; - exports speiger.src.collections.ints.queues; - exports speiger.src.collections.ints.sets; - exports speiger.src.collections.ints.utils; - exports speiger.src.collections.ints.utils.maps; - exports speiger.src.collections.longs.collections; - exports speiger.src.collections.longs.functions; - exports speiger.src.collections.longs.functions.consumer; - exports speiger.src.collections.longs.functions.function; - exports speiger.src.collections.longs.lists; - exports speiger.src.collections.longs.maps.abstracts; - exports speiger.src.collections.longs.maps.impl.concurrent; - exports speiger.src.collections.longs.maps.impl.customHash; - exports speiger.src.collections.longs.maps.impl.hash; - exports speiger.src.collections.longs.maps.impl.immutable; - exports speiger.src.collections.longs.maps.impl.misc; - exports speiger.src.collections.longs.maps.impl.tree; - exports speiger.src.collections.longs.maps.interfaces; - exports speiger.src.collections.longs.misc.pairs; - exports speiger.src.collections.longs.misc.pairs.impl; - exports speiger.src.collections.longs.queues; - exports speiger.src.collections.longs.sets; - exports speiger.src.collections.longs.utils; - exports speiger.src.collections.longs.utils.maps; - exports speiger.src.collections.objects.collections; - exports speiger.src.collections.objects.functions; - exports speiger.src.collections.objects.functions.consumer; - exports speiger.src.collections.objects.functions.function; - exports speiger.src.collections.objects.lists; - exports speiger.src.collections.objects.maps.abstracts; - exports speiger.src.collections.objects.maps.impl.concurrent; - exports speiger.src.collections.objects.maps.impl.customHash; - exports speiger.src.collections.objects.maps.impl.hash; - exports speiger.src.collections.objects.maps.impl.immutable; - exports speiger.src.collections.objects.maps.impl.misc; - exports speiger.src.collections.objects.maps.impl.tree; - exports speiger.src.collections.objects.maps.interfaces; - exports speiger.src.collections.objects.misc.pairs; - exports speiger.src.collections.objects.misc.pairs.impl; - exports speiger.src.collections.objects.queues; - exports speiger.src.collections.objects.sets; - exports speiger.src.collections.objects.utils; - exports speiger.src.collections.objects.utils.maps; - exports speiger.src.collections.shorts.collections; - exports speiger.src.collections.shorts.functions; - exports speiger.src.collections.shorts.functions.consumer; - exports speiger.src.collections.shorts.functions.function; - exports speiger.src.collections.shorts.lists; - exports speiger.src.collections.shorts.maps.abstracts; - exports speiger.src.collections.shorts.maps.impl.concurrent; - exports speiger.src.collections.shorts.maps.impl.customHash; - exports speiger.src.collections.shorts.maps.impl.hash; - exports speiger.src.collections.shorts.maps.impl.immutable; - exports speiger.src.collections.shorts.maps.impl.misc; - exports speiger.src.collections.shorts.maps.impl.tree; - exports speiger.src.collections.shorts.maps.interfaces; - exports speiger.src.collections.shorts.misc.pairs; - exports speiger.src.collections.shorts.misc.pairs.impl; - exports speiger.src.collections.shorts.queues; - exports speiger.src.collections.shorts.sets; - exports speiger.src.collections.shorts.utils; - exports speiger.src.collections.shorts.utils.maps; - exports speiger.src.collections.utils; -} \ No newline at end of file