Introduce annotation InlineExposed to indicate internal members effectively public due to usage in inlined functions.
Currently, doesn't affect anything. Make collectionSizeOrDefault and collectionSizeOrNull internal, but expose them via inlining together with mapCapacity. Make Regex(Pattern) constructor exposed by inlined Pattern.toRegex
This commit is contained in:
@@ -485,6 +485,7 @@ fun generators(): List<GenericFunction> {
|
||||
"""
|
||||
val first = iterator()
|
||||
val second = other.iterator()
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(collectionSizeOrDefault(10), other.collectionSizeOrDefault(10)))
|
||||
while (first.hasNext() && second.hasNext()) {
|
||||
list.add(transform(first.next(), second.next()))
|
||||
@@ -495,6 +496,7 @@ fun generators(): List<GenericFunction> {
|
||||
body(ArraysOfObjects, ArraysOfPrimitives) {
|
||||
"""
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -520,6 +522,7 @@ fun generators(): List<GenericFunction> {
|
||||
body {
|
||||
"""
|
||||
val arraySize = other.size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in this) {
|
||||
|
||||
@@ -34,7 +34,8 @@ fun mapping(): List<GenericFunction> {
|
||||
}
|
||||
typeParam("R")
|
||||
returns("List<R>")
|
||||
body {
|
||||
annotations(Iterables) { """@Suppress("INVISIBLE_MEMBER_FROM_INLINE")""" }
|
||||
body(Iterables) {
|
||||
"return mapIndexedTo(ArrayList<R>(collectionSizeOrDefault(10)), transform)"
|
||||
}
|
||||
body(ArraysOfObjects, ArraysOfPrimitives) {
|
||||
@@ -61,7 +62,8 @@ fun mapping(): List<GenericFunction> {
|
||||
}
|
||||
typeParam("R")
|
||||
returns("List<R>")
|
||||
body {
|
||||
annotations(Iterables) { """@Suppress("INVISIBLE_MEMBER_FROM_INLINE")""" }
|
||||
body(Iterables) {
|
||||
"return mapTo(ArrayList<R>(collectionSizeOrDefault(10)), transform)"
|
||||
}
|
||||
body(ArraysOfObjects, ArraysOfPrimitives, Maps) {
|
||||
|
||||
@@ -153,7 +153,8 @@ fun snapshots(): List<GenericFunction> {
|
||||
}
|
||||
body {
|
||||
"""
|
||||
val capacity = ((collectionSizeOrDefault(10)/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
"""
|
||||
}
|
||||
@@ -164,13 +165,15 @@ fun snapshots(): List<GenericFunction> {
|
||||
}
|
||||
body(CharSequences) {
|
||||
"""
|
||||
val capacity = ((length/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(length).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
"""
|
||||
}
|
||||
body(ArraysOfObjects, ArraysOfPrimitives) {
|
||||
"""
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
"""
|
||||
}
|
||||
@@ -228,7 +231,8 @@ fun snapshots(): List<GenericFunction> {
|
||||
|
||||
body {
|
||||
"""
|
||||
val capacity = ((collectionSizeOrDefault(10)/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, T>(capacity), keySelector)
|
||||
"""
|
||||
}
|
||||
@@ -239,13 +243,15 @@ fun snapshots(): List<GenericFunction> {
|
||||
}
|
||||
body(CharSequences) {
|
||||
"""
|
||||
val capacity = ((length/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(length).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, T>(capacity), keySelector)
|
||||
"""
|
||||
}
|
||||
body(ArraysOfObjects, ArraysOfPrimitives) {
|
||||
"""
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, T>(capacity), keySelector)
|
||||
"""
|
||||
}
|
||||
@@ -319,7 +325,8 @@ fun snapshots(): List<GenericFunction> {
|
||||
|
||||
body {
|
||||
"""
|
||||
val capacity = ((collectionSizeOrDefault(10)/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
"""
|
||||
}
|
||||
@@ -330,13 +337,15 @@ fun snapshots(): List<GenericFunction> {
|
||||
}
|
||||
body(CharSequences) {
|
||||
"""
|
||||
val capacity = ((length/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(length).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
"""
|
||||
}
|
||||
body(ArraysOfObjects, ArraysOfPrimitives) {
|
||||
"""
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
"""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user