|
|
@@ -21,7 +21,6 @@ import net.ranides.assira.generic.ValueUtils;
|
|
|
import net.ranides.assira.math.HashHelper;
|
|
|
import net.ranides.assira.reflection.ClassInspector;
|
|
|
import net.ranides.assira.reflection.UnsafeArrayAccess;
|
|
|
-import net.ranides.assira.trace.LoggerUtils;
|
|
|
|
|
|
/**
|
|
|
* Operacje na tablicach.
|
|
|
@@ -190,14 +189,14 @@ public final class ArrayUtils {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
+ @SuppressWarnings({"unchecked", "SuspiciousSystemArraycopy"})
|
|
|
public static <ArrayT> ArrayT clip(ArrayT array, int size) {
|
|
|
if( size(array) <= size ) {
|
|
|
return array;
|
|
|
}
|
|
|
- ArrayT result= make(array.getClass(), size);
|
|
|
+ Object result= make(array.getClass(), size);
|
|
|
System.arraycopy(array, 0, result, 0, size);
|
|
|
- return result;
|
|
|
+ return (ArrayT)result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -314,6 +313,7 @@ public final class ArrayUtils {
|
|
|
* @param values
|
|
|
* @param keys
|
|
|
*/
|
|
|
+ @SuppressWarnings("MismatchedReadAndWriteOfArray")
|
|
|
public static <K extends Comparable<K>, V> void sort(V[] values, K[] keys) {
|
|
|
final Pair[] table = new Pair[keys.length];
|
|
|
for(int i=0; i<table.length; i++) {
|
|
|
@@ -342,6 +342,7 @@ public final class ArrayUtils {
|
|
|
for(int i=0; i<table.length; i++) { table[i] = new IntPair(keys[i], values[i]); }
|
|
|
java.util.Arrays.sort(table);
|
|
|
|
|
|
+ @SuppressWarnings("MismatchedReadAndWriteOfArray")
|
|
|
final Object[] ovalues = values;
|
|
|
for(int i=0; i<table.length; i++) {
|
|
|
ovalues[i] = table[i].value;
|
|
|
@@ -508,6 +509,7 @@ public final class ArrayUtils {
|
|
|
* @param values
|
|
|
* @return
|
|
|
*/
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
public static <Auto> Auto unshift(Object values) {
|
|
|
if(values == null) { // @test
|
|
|
throw new EmptyCollectionException();
|
|
|
@@ -544,7 +546,7 @@ public final class ArrayUtils {
|
|
|
* @param second
|
|
|
* @return
|
|
|
*/
|
|
|
- @SuppressWarnings("SuspiciousSystemArraycopy")
|
|
|
+ @SuppressWarnings({"SuspiciousSystemArraycopy", "unchecked"})
|
|
|
public static <ArrayT> ArrayT concat(ArrayT first, ArrayT second) {
|
|
|
int length1 = size(first);
|
|
|
int length2 = size(second);
|
|
|
@@ -661,6 +663,7 @@ public final class ArrayUtils {
|
|
|
* @param source
|
|
|
* @return
|
|
|
*/
|
|
|
+ @SuppressWarnings({"unchecked", "SuspiciousSystemArraycopy"})
|
|
|
public static <ArrayT> ArrayT arraycopy(ArrayT source) { // @test
|
|
|
int size = size(source);
|
|
|
Object target = make(source.getClass(), size);
|