From ef2c786aaa8f9df0e6df6bf6c8455ab0c2a9aef5 Mon Sep 17 00:00:00 2001 From: Tomasz Pasternak Date: Fri, 19 Jan 2024 11:20:38 +0100 Subject: [PATCH] Prepare for 2024.1: convert kotlin's Sequence to java's Iterable ExtensionPointImpl is now writen in Kotlin and extends Sequence instead of Iterable --- .../sync/importer/KotlinSyncAugmenterTest.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/kotlin/tests/unittests/com/google/idea/blaze/kotlin/sync/importer/KotlinSyncAugmenterTest.java b/kotlin/tests/unittests/com/google/idea/blaze/kotlin/sync/importer/KotlinSyncAugmenterTest.java index ffe6f32a4eb..81478dce17a 100644 --- a/kotlin/tests/unittests/com/google/idea/blaze/kotlin/sync/importer/KotlinSyncAugmenterTest.java +++ b/kotlin/tests/unittests/com/google/idea/blaze/kotlin/sync/importer/KotlinSyncAugmenterTest.java @@ -49,6 +49,9 @@ import com.google.idea.common.experiments.MockExperimentService; import com.intellij.openapi.extensions.impl.ExtensionPointImpl; import java.util.ArrayList; + +import kotlin.sequences.Sequence; +import kotlin.sequences.SequencesKt; import org.jetbrains.annotations.NotNull; import org.junit.Test; import org.junit.runner.RunWith; @@ -123,7 +126,7 @@ public void testAddJarsForSourceTarget_attchClassJarForKotlinTarget() { .build(); ArrayList genJars = new ArrayList<>(); - for (BlazeJavaSyncAugmenter augmenter : augmenters) { + for (BlazeJavaSyncAugmenter augmenter : toIterable(augmenters)) { // #api233 - in 2024.1 ExtensionPointImpl implements Sequenec instead of Iterable augmenter.addJarsForSourceTarget( workspaceLanguageSettings, projectViewSet, target, new ArrayList<>(), genJars); } @@ -166,7 +169,8 @@ public void testAddJarsForSourceTarget_noExtraGenJarListForJavaTarget() { .build(); ArrayList genJars = new ArrayList<>(); - for (BlazeJavaSyncAugmenter augmenter : augmenters) { + for (BlazeJavaSyncAugmenter augmenter : toIterable(augmenters)) { // #api233 - in 2024.1 ExtensionPointImpl implements Sequence instead of Iterable + augmenter.addJarsForSourceTarget( workspaceLanguageSettings, projectViewSet, target, new ArrayList<>(), genJars); } @@ -184,4 +188,12 @@ private static ArtifactLocation gen(String relativePath) { private static ArtifactLocation source(String relativePath) { return ArtifactLocation.builder().setRelativePath(relativePath).setIsSource(true).build(); } + + private static Iterable toIterable(Iterable iterable) { + return iterable; + } + + private static Iterable toIterable(Sequence sequence) { + return SequencesKt.asIterable(sequence); + } }