From 9eb220194f36beb2ba4a8080675ca4d279558254 Mon Sep 17 00:00:00 2001 From: Speiger Date: Thu, 2 Jun 2022 00:47:05 +0200 Subject: [PATCH] Small fixes. -Fixed: SynchronizedList.addElements was calling itself. -Fixed: UnmodifiableSet was missing implementations that were causing fails. --- build.gradle | 2 +- .../templates/utils/Lists.template | 2 +- .../collections/templates/utils/Sets.template | 43 +++++++++++++------ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index df73e695..300362a6 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ repositories { } archivesBaseName = 'Primitive Collections' -version = '0.6.2.1-SNAPSHOT'; +version = '0.6.2.6-SNAPSHOT'; sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current(); diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template b/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template index 4023ae5d..7e08234b 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template @@ -356,7 +356,7 @@ public class LISTS #endif @Override - public void addElements(int from, KEY_TYPE[] a, int offset, int length) { synchronized(mutex) { addElements(from, a, offset, length); } } + public void addElements(int from, KEY_TYPE[] a, int offset, int length) { synchronized(mutex) { l.addElements(from, a, offset, length); } } @Override public KEY_TYPE[] getElements(int from, KEY_TYPE[] a, int offset, int length) { synchronized(mutex) { return l.getElements(from, a, offset, length); } } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template b/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template index 5af4654d..a420738a 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template @@ -259,25 +259,38 @@ public class SETS #if !TYPE_OBJECT @Override public boolean contains(KEY_TYPE o) { return n.contains(o); } - + @Override + @SuppressWarnings("deprecation") + public CLASS_TYPE lower(CLASS_TYPE e) { return n.lower(e); } + @Override + @SuppressWarnings("deprecation") + public CLASS_TYPE floor(CLASS_TYPE e) { return n.floor(e); } + @Override + @SuppressWarnings("deprecation") + public CLASS_TYPE ceiling(CLASS_TYPE e) { return n.ceiling(e); } + @Override + @SuppressWarnings("deprecation") + public CLASS_TYPE higher(CLASS_TYPE e) { return n.higher(e); } + #endif @Override @Deprecated public boolean contains(Object o) { return n.contains(o); } - @Override public KEY_TYPE lower(KEY_TYPE e) { return n.lower(e); } - @Override public KEY_TYPE floor(KEY_TYPE e) { return n.floor(e); } - @Override public KEY_TYPE ceiling(KEY_TYPE e) { return n.ceiling(e); } - @Override public KEY_TYPE higher(KEY_TYPE e) { return n.higher(e); } #if !TYPE_OBJECT + @Override + public CLASS_TYPE pollFirst() { throw new UnsupportedOperationException(); } + @Override + public CLASS_TYPE pollLast() { throw new UnsupportedOperationException(); } + @Override public void setDefaultMaxValue(KEY_TYPE e) { throw new UnsupportedOperationException(); } @@ -292,7 +305,7 @@ public class SETS #endif @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); } + public NAVIGABLE_SET KEY_GENERIC_TYPE copy() { return n.copy(); } @Override public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, boolean fromInclusive, KEY_TYPE toElement, boolean toInclusive) { return SETS.unmodifiable(n.subSet(fromElement, fromInclusive, toElement, toInclusive)); } @@ -455,27 +468,33 @@ public class SETS #if !TYPE_OBJECT @Override public boolean contains(KEY_TYPE o) { synchronized(mutex) { return n.contains(o); } } - + @Override + @SuppressWarnings("deprecation") + public CLASS_TYPE lower(CLASS_TYPE e) { synchronized(mutex) { return n.lower(e); } } + @Override + @SuppressWarnings("deprecation") + public CLASS_TYPE floor(CLASS_TYPE e) { synchronized(mutex) { return n.floor(e); } } + @Override + @SuppressWarnings("deprecation") + public CLASS_TYPE ceiling(CLASS_TYPE e) { synchronized(mutex) { return n.ceiling(e); } } + @Override + @SuppressWarnings("deprecation") + public CLASS_TYPE higher(CLASS_TYPE e) { synchronized(mutex) { return n.higher(e); } } #endif @Override public KEY_TYPE lower(KEY_TYPE e) { synchronized(mutex) { return n.lower(e); } } - @Override public KEY_TYPE floor(KEY_TYPE e) { synchronized(mutex) { return n.floor(e); } } - @Override public KEY_TYPE ceiling(KEY_TYPE e) { synchronized(mutex) { return n.ceiling(e); } } - @Override public KEY_TYPE higher(KEY_TYPE e) { synchronized(mutex) { return n.higher(e); } } #if !TYPE_OBJECT @Override public void setDefaultMaxValue(KEY_TYPE e) { synchronized(mutex) { n.setDefaultMaxValue(e); } } - @Override public KEY_TYPE getDefaultMaxValue() { synchronized(mutex) { return n.getDefaultMaxValue(); } } - @Override public void setDefaultMinValue(KEY_TYPE e) { synchronized(mutex) { n.setDefaultMinValue(e); } }