From 859d00da161ecc074419dcc1f9da9c43e2602ee5 Mon Sep 17 00:00:00 2001 From: Speiger Date: Thu, 15 Dec 2022 17:13:34 +0100 Subject: [PATCH] Fixed Java9 or newer issues. --- .../templates/collections/Collection.template | 2 +- .../templates/collections/Iterable.template | 4 +- .../templates/lists/LinkedList.template | 2 +- .../templates/queues/PriorityQueue.template | 2 +- .../templates/utils/Arrays.template | 4 +- src/main/java/module-info.java | 165 ++++++++++++++++++ 6 files changed, 172 insertions(+), 7 deletions(-) create mode 100644 src/main/java/module-info.java diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template index d248ec0c..e0a40ecf 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template @@ -182,7 +182,7 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection, ITE * @return an array containing all of the elements in this collection * @see Collection#toArray(Object[]) */ - default KEY_TYPE[] TO_ARRAY(IntFunction action) { + default E[] TO_ARRAY(IntFunction action) { return TO_ARRAY(action.apply(size())); } diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template index 4ecd8201..0a610852 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -288,12 +288,12 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable * @param action is the creator function of said Array to ensure type is kept. * @return a new Array of all elements */ - default KEY_TYPE[] TO_ARRAY(IntFunction action) { + default E[] TO_ARRAY(IntFunction action) { ISizeProvider prov = ISizeProvider.of(this); if(prov != null) { int size = prov.size(); if(size >= 0) { - KEY_TYPE[] array = action.apply(size); + E[] array = action.apply(size); ITERATORS.unwrap(array, iterator()); return array; } diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template b/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template index 30d9c7a4..273c27dc 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template @@ -992,7 +992,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE #else @Override - public T[] toArray(IntFunction action) { + public E[] toArray(IntFunction action) { return super.toArray(action); } diff --git a/src/builder/resources/speiger/assets/collections/templates/queues/PriorityQueue.template b/src/builder/resources/speiger/assets/collections/templates/queues/PriorityQueue.template index d2e92ae6..5fd7638b 100644 --- a/src/builder/resources/speiger/assets/collections/templates/queues/PriorityQueue.template +++ b/src/builder/resources/speiger/assets/collections/templates/queues/PriorityQueue.template @@ -188,7 +188,7 @@ public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends ITERABLE KEY_GENERIC_TY * @return an array containing all of the elements in this collection * @see Collection#toArray(Object[]) */ - default KEY_TYPE[] TO_ARRAY(IntFunction action) { + default E[] TO_ARRAY(IntFunction action) { return TO_ARRAY(action.apply(size())); } #endif diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template b/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template index 5104c76e..791a751f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template @@ -146,7 +146,7 @@ public class ARRAYS * @param action that is creating the Array to be poured into * @return array with all elements of the iterator */ - public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, IntFunction action) { + public static E[] pour(ITERATOR KEY_GENERIC_TYPE iter, IntFunction action) { return pour(iter, Integer.MAX_VALUE, action); } @@ -158,7 +158,7 @@ public class ARRAYS * @ArrayType(T) * @return array with all requested elements of the iterator */ - public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, int max, IntFunction action) { + public static E[] pour(ITERATOR KEY_GENERIC_TYPE iter, int max, IntFunction action) { COLLECTIONS.CollectionWrapper KEY_GENERIC_TYPE list = COLLECTIONS.wrapper(); ITERATORS.pour(iter, list, max); return list.TO_ARRAY(action.apply(list.size())); diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 00000000..f4e4aacc --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,165 @@ +/** @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