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

Possible fix for issue #4798 with @OnlyInputTypes annotation #4800

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -32,7 +32,7 @@ fun Criteria.isEqualTo(o: Any?): Criteria = `is`(o)
* @author Sebastien Deleuze
* @since 2.0
*/
fun <T : Any?> Criteria.inValues(c: Collection<T>): Criteria = `in`(c)
fun <@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @kotlin.internal.OnlyInputTypes T : Any?> Criteria.inValues(c: Collection<T>): Criteria = `in`(c)

/**
* Extension for [Criteria.in] providing an `inValues` alias since `in` is a reserved keyword in Kotlin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package org.springframework.data.mongodb.core.query

import org.bson.BsonRegularExpression
Expand All @@ -31,7 +32,7 @@ import kotlin.reflect.KProperty
* @since 2.2
* @see Criteria.isEqualTo
*/
infix fun <T> KProperty<T>.isEqualTo(value: T) =
infix fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.isEqualTo(value: T) =
Criteria(this.toDotPath()).isEqualTo(value)

/**
Expand All @@ -42,7 +43,7 @@ infix fun <T> KProperty<T>.isEqualTo(value: T) =
* @since 2.2
* @see Criteria.ne
*/
infix fun <T> KProperty<T>.ne(value: T): Criteria =
infix fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.ne(value: T): Criteria =
Criteria(this.toDotPath()).ne(value)

/**
Expand All @@ -53,7 +54,7 @@ infix fun <T> KProperty<T>.ne(value: T): Criteria =
* @since 2.2
* @see Criteria.lt
*/
infix fun <T> KProperty<T>.lt(value: Any): Criteria =
infix fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.lt(value: Any): Criteria =
Criteria(this.toDotPath()).lt(value)

/**
Expand All @@ -64,7 +65,7 @@ infix fun <T> KProperty<T>.lt(value: Any): Criteria =
* @since 2.2
* @see Criteria.lte
*/
infix fun <T> KProperty<T>.lte(value: Any): Criteria =
infix fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.lte(value: Any): Criteria =
Criteria(this.toDotPath()).lte(value)

/**
Expand All @@ -75,7 +76,7 @@ infix fun <T> KProperty<T>.lte(value: Any): Criteria =
* @since 2.2
* @see Criteria.gt
*/
infix fun <T> KProperty<T>.gt(value: Any): Criteria =
infix fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.gt(value: Any): Criteria =
Criteria(this.toDotPath()).gt(value)

/**
Expand All @@ -86,7 +87,7 @@ infix fun <T> KProperty<T>.gt(value: Any): Criteria =
* @since 2.2
* @see Criteria.gte
*/
infix fun <T> KProperty<T>.gte(value: Any): Criteria =
infix fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.gte(value: Any): Criteria =
Criteria(this.toDotPath()).gte(value)

/**
Expand All @@ -97,7 +98,7 @@ infix fun <T> KProperty<T>.gte(value: Any): Criteria =
* @since 2.2
* @see Criteria.inValues
*/
fun <T> KProperty<T>.inValues(vararg o: Any): Criteria =
fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.inValues(vararg o: Any): Criteria =
Criteria(this.toDotPath()).`in`(*o)

/**
Expand All @@ -108,7 +109,7 @@ fun <T> KProperty<T>.inValues(vararg o: Any): Criteria =
* @since 2.2
* @see Criteria.inValues
*/
infix fun <T> KProperty<T>.inValues(value: Collection<T>): Criteria =
infix fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.inValues(value: Collection<T>): Criteria =
Criteria(this.toDotPath()).`in`(value)

/**
Expand All @@ -119,7 +120,7 @@ infix fun <T> KProperty<T>.inValues(value: Collection<T>): Criteria =
* @since 2.2
* @see Criteria.nin
*/
fun <T> KProperty<T>.nin(vararg o: Any): Criteria =
fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.nin(vararg o: Any): Criteria =
Criteria(this.toDotPath()).nin(*o)

/**
Expand All @@ -130,7 +131,7 @@ fun <T> KProperty<T>.nin(vararg o: Any): Criteria =
* @since 2.2
* @see Criteria.nin
*/
infix fun <T> KProperty<T>.nin(value: Collection<T>): Criteria =
infix fun <@kotlin.internal.OnlyInputTypes T> KProperty<T>.nin(value: Collection<T>): Criteria =
Criteria(this.toDotPath()).nin(value)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package org.springframework.data.mongodb.core.query

import org.springframework.data.mapping.toDotPath
Expand All @@ -26,7 +27,7 @@ import kotlin.reflect.KProperty
* @since 4.4
* @see Update.update
*/
fun <T> update(key: KProperty<T>, value: T?) =
fun <@kotlin.internal.OnlyInputTypes T> update(key: KProperty<T>, value: T?) =
Update.update(key.toDotPath(), value)

/**
Expand All @@ -36,7 +37,7 @@ fun <T> update(key: KProperty<T>, value: T?) =
* @since 4.4
* @see Update.set
*/
fun <T> Update.set(key: KProperty<T>, value: T?) =
fun <@kotlin.internal.OnlyInputTypes T> Update.set(key: KProperty<T>, value: T?) =
set(key.toDotPath(), value)

/**
Expand All @@ -46,7 +47,7 @@ fun <T> Update.set(key: KProperty<T>, value: T?) =
* @since 4.4
* @see Update.setOnInsert
*/
fun <T> Update.setOnInsert(key: KProperty<T>, value: T?) =
fun <@kotlin.internal.OnlyInputTypes T> Update.setOnInsert(key: KProperty<T>, value: T?) =
setOnInsert(key.toDotPath(), value)

/**
Expand All @@ -56,7 +57,7 @@ fun <T> Update.setOnInsert(key: KProperty<T>, value: T?) =
* @since 4.4
* @see Update.unset
*/
fun <T> Update.unset(key: KProperty<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.unset(key: KProperty<T>) =
unset(key.toDotPath())

/**
Expand All @@ -66,10 +67,10 @@ fun <T> Update.unset(key: KProperty<T>) =
* @since 4.4
* @see Update.inc
*/
fun <T> Update.inc(key: KProperty<T>, inc: Number) =
fun <@kotlin.internal.OnlyInputTypes T> Update.inc(key: KProperty<T>, inc: Number) =
inc(key.toDotPath(), inc)

fun <T> Update.inc(key: KProperty<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.inc(key: KProperty<T>) =
inc(key.toDotPath())

/**
Expand All @@ -79,7 +80,7 @@ fun <T> Update.inc(key: KProperty<T>) =
* @since 4.4
* @see Update.push
*/
fun <T> Update.push(key: KProperty<Collection<T>>, value: T?) =
fun <@kotlin.internal.OnlyInputTypes T> Update.push(key: KProperty<Collection<T>>, value: T?) =
push(key.toDotPath(), value)

/**
Expand All @@ -91,7 +92,7 @@ fun <T> Update.push(key: KProperty<Collection<T>>, value: T?) =
* @since 4.4
* @see Update.push
*/
fun <T> Update.push(key: KProperty<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.push(key: KProperty<T>) =
push(key.toDotPath())

/**
Expand All @@ -102,7 +103,7 @@ fun <T> Update.push(key: KProperty<T>) =
* @since 4.4
* @see Update.addToSet
*/
fun <T> Update.addToSet(key: KProperty<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.addToSet(key: KProperty<T>) =
addToSet(key.toDotPath())

/**
Expand All @@ -112,7 +113,7 @@ fun <T> Update.addToSet(key: KProperty<T>) =
* @since 4.4
* @see Update.addToSet
*/
fun <T> Update.addToSet(key: KProperty<Collection<T>>, value: T?) =
fun <@kotlin.internal.OnlyInputTypes T> Update.addToSet(key: KProperty<Collection<T>>, value: T?) =
addToSet(key.toDotPath(), value)

/**
Expand All @@ -122,7 +123,7 @@ fun <T> Update.addToSet(key: KProperty<Collection<T>>, value: T?) =
* @since 4.4
* @see Update.pop
*/
fun <T> Update.pop(key: KProperty<T>, pos: Position) =
fun <@kotlin.internal.OnlyInputTypes T> Update.pop(key: KProperty<T>, pos: Position) =
pop(key.toDotPath(), pos)

/**
Expand All @@ -132,7 +133,7 @@ fun <T> Update.pop(key: KProperty<T>, pos: Position) =
* @since 4.4
* @see Update.pull
*/
fun <T> Update.pull(key: KProperty<T>, value: Any) =
fun <@kotlin.internal.OnlyInputTypes T> Update.pull(key: KProperty<T>, value: Any) =
pull(key.toDotPath(), value)

/**
Expand All @@ -142,7 +143,7 @@ fun <T> Update.pull(key: KProperty<T>, value: Any) =
* @since 4.4
* @see Update.pullAll
*/
fun <T> Update.pullAll(key: KProperty<Collection<T>>, values: Array<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.pullAll(key: KProperty<Collection<T>>, values: Array<T>) =
pullAll(key.toDotPath(), values)

/**
Expand All @@ -152,7 +153,7 @@ fun <T> Update.pullAll(key: KProperty<Collection<T>>, values: Array<T>) =
* @since 4.4
* @see Update.currentDate
*/
fun <T> Update.currentDate(key: KProperty<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.currentDate(key: KProperty<T>) =
currentDate(key.toDotPath())

/**
Expand All @@ -162,7 +163,7 @@ fun <T> Update.currentDate(key: KProperty<T>) =
* @since 4.4
* @see Update.currentTimestamp
*/
fun <T> Update.currentTimestamp(key: KProperty<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.currentTimestamp(key: KProperty<T>) =
currentTimestamp(key.toDotPath())

/**
Expand All @@ -172,7 +173,7 @@ fun <T> Update.currentTimestamp(key: KProperty<T>) =
* @since 4.4
* @see Update.multiply
*/
fun <T> Update.multiply(key: KProperty<T>, multiplier: Number) =
fun <@kotlin.internal.OnlyInputTypes T> Update.multiply(key: KProperty<T>, multiplier: Number) =
multiply(key.toDotPath(), multiplier)

/**
Expand Down Expand Up @@ -202,7 +203,7 @@ fun <T : Any> Update.min(key: KProperty<T>, value: T) =
* @since 4.4
* @see Update.bitwise
*/
fun <T> Update.bitwise(key: KProperty<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.bitwise(key: KProperty<T>) =
bitwise(key.toDotPath())

/**
Expand All @@ -213,7 +214,7 @@ fun <T> Update.bitwise(key: KProperty<T>) =
* @since 4.4
* @see Update.filterArray
*/
fun <T> Update.filterArray(identifier: KProperty<T>, expression: Any) =
fun <@kotlin.internal.OnlyInputTypes T> Update.filterArray(identifier: KProperty<T>, expression: Any) =
filterArray(identifier.toDotPath(), expression)

/**
Expand All @@ -223,6 +224,6 @@ fun <T> Update.filterArray(identifier: KProperty<T>, expression: Any) =
* @since 4.4
* @see Update.modifies
*/
fun <T> Update.modifies(key: KProperty<T>) =
fun <@kotlin.internal.OnlyInputTypes T> Update.modifies(key: KProperty<T>) =
modifies(key.toDotPath())