mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[utils] Smart/F/SortedList: annotate classes with Kotlin @PurelyImplements to ensure nullability is correctly handled by Kotlin compiler.
(cherry picked from commit b144211ca6d9e8a47b883dd2e799c766d950f033) IJ-CR-155942 GitOrigin-RevId: b6393e6d5552d618962dca8f738bf3beb7593c97
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e53a94bb95
commit
3e0c644f9b
@@ -157,7 +157,7 @@ private fun parseMap(reader: JsonReaderEx): SourceMapDataImpl? {
|
||||
}
|
||||
reader.beginArray()
|
||||
if (reader.peek() != JsonToken.END_ARRAY) {
|
||||
sourcesContent = SmartList<String>()
|
||||
sourcesContent = SmartList<String?>()
|
||||
do {
|
||||
if (reader.peek() == JsonToken.STRING) {
|
||||
sourcesContent.add(StringUtilRt.convertLineSeparators(reader.nextString()))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.ReviseWhenPortedToJDK;
|
||||
import kotlin.jvm.PurelyImplements;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
@@ -14,6 +15,7 @@ import java.util.function.Consumer;
|
||||
* The tradeoff is the following: This list is slower than {@link ArrayList} but occupies less memory in case of exactly 1 element.
|
||||
* Please use it only if your code contains many 1-element lists outside very hot loops.
|
||||
*/
|
||||
@PurelyImplements("kotlin.collections.MutableList")
|
||||
public class SmartList<E> extends AbstractList<E> implements RandomAccess {
|
||||
private int mySize;
|
||||
private Object myElem; // null if mySize==0, (E)elem if mySize==1, Object[] if mySize>=2
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import kotlin.jvm.PurelyImplements;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.AbstractList;
|
||||
@@ -11,6 +12,7 @@ import java.util.NoSuchElementException;
|
||||
/**
|
||||
* Immutable list in functional style
|
||||
*/
|
||||
@PurelyImplements("kotlin.collections.MutableList")
|
||||
public final class FList<E> extends AbstractList<E> {
|
||||
private static final FList<?> EMPTY_LIST = new FList<>(null, null, 0);
|
||||
private final E myHead;
|
||||
@@ -140,7 +142,7 @@ public final class FList<E> extends AbstractList<E> {
|
||||
public static <E> FList<E> singleton(@NotNull E elem) {
|
||||
return FList.<E>emptyList().prepend(elem);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an FList object with the elements of the given sequence in the reversed order, i.e. the last element of {@code from} will be the result's {@link #getHead()}
|
||||
*/
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import com.intellij.util.SmartList;
|
||||
import kotlin.jvm.PurelyImplements;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@PurelyImplements("kotlin.collections.MutableList")
|
||||
public final class SortedList<T> extends AbstractList<T>{
|
||||
private final SortedMap<T, List<T>> myMap;
|
||||
private final Comparator<? super T> myComparator;
|
||||
|
||||
Reference in New Issue
Block a user