Replace the trove4j collections usages with the fastutil ones
The trove4j library is licensed under LGPL, and that causes some troubles while working with it. The fastutil library provides the same functionality in the context of our needs, and is licensed under the Apache license. ^KTI-1135 In Progress
This commit is contained in:
committed by
Space Team
parent
dd5fffebf2
commit
21b438f55d
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.test.testFramework
|
||||
|
||||
fun interface Equality<T> {
|
||||
fun equals(o1: T, o2: T): Boolean
|
||||
}
|
||||
+9
-5
@@ -27,8 +27,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.PeekableIterator;
|
||||
import com.intellij.util.containers.PeekableIteratorWrapper;
|
||||
import com.intellij.util.lang.CompoundRuntimeException;
|
||||
import gnu.trove.Equality;
|
||||
import gnu.trove.THashSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@@ -385,8 +384,8 @@ public abstract class KtUsefulTestCase extends TestCase {
|
||||
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (final Object o : collection) {
|
||||
if (o instanceof THashSet) {
|
||||
builder.append(new TreeSet<>((THashSet<?>)o));
|
||||
if (o instanceof ObjectOpenHashSet) {
|
||||
builder.append(new TreeSet<>((ObjectOpenHashSet<?>)o));
|
||||
}
|
||||
else {
|
||||
builder.append(o);
|
||||
@@ -439,7 +438,12 @@ public abstract class KtUsefulTestCase extends TestCase {
|
||||
public static <T> void assertOrderedEquals(@NotNull String errorMsg,
|
||||
@NotNull Iterable<? extends T> actual,
|
||||
@NotNull Iterable<? extends T> expected) {
|
||||
assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL);
|
||||
assertOrderedEquals(errorMsg, actual, expected, new Equality<T>() {
|
||||
@Override
|
||||
public boolean equals(T o1, T o2) {
|
||||
return Objects.equals(o1, o2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static <T> void assertOrderedEquals(@NotNull String errorMsg,
|
||||
|
||||
Reference in New Issue
Block a user