Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for 2024.1: convert kotlin's Sequence to java's Iterable #5967

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -123,7 +126,7 @@ public void testAddJarsForSourceTarget_attchClassJarForKotlinTarget() {
.build();
ArrayList<BlazeJarLibrary> genJars = new ArrayList<>();

for (BlazeJavaSyncAugmenter augmenter : augmenters) {
for (BlazeJavaSyncAugmenter augmenter : toIterable(augmenters)) { // #api233 - in 2024.1 ExtensionPointImpl implements Sequenec instead of Iterable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: Sequenec

augmenter.addJarsForSourceTarget(
workspaceLanguageSettings, projectViewSet, target, new ArrayList<>(), genJars);
}
Expand Down Expand Up @@ -166,7 +169,8 @@ public void testAddJarsForSourceTarget_noExtraGenJarListForJavaTarget() {
.build();
ArrayList<BlazeJarLibrary> 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);
}
Expand All @@ -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 <T> Iterable<T> toIterable(Iterable<T> iterable) {
return iterable;
}

private static <T> Iterable<T> toIterable(Sequence<T> sequence) {
return SequencesKt.asIterable(sequence);
}
}
Loading