Skip to content

Commit 09c3cca

Browse files
committed
DATAMONGO-2138 - Remove default typedQuery parameters
Fix compile error "Overload resolution ambiguity"
1 parent fc5e59b commit 09c3cca

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/TypedQueryExtensions.kt

+7-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ inline fun <reified T : Any> MongoOperations.findAndRemove(typedQuery: TypedQuer
138138
*
139139
* @author Tjeu Kayim
140140
*/
141-
fun <T : Any> MongoOperations.count(typedQuery: TypedQuery<T> = TypedQuery(), entityClass: KClass<T>, collectionName: String? = null): Long =
141+
fun <T : Any> MongoOperations.count(typedQuery: TypedQuery<T>, entityClass: KClass<T>, collectionName: String? = null): Long =
142142
if (collectionName != null) count(typedQuery, entityClass.java, collectionName)
143143
else count(typedQuery, entityClass.java)
144144

@@ -147,7 +147,8 @@ fun <T : Any> MongoOperations.count(typedQuery: TypedQuery<T> = TypedQuery(), en
147147
*
148148
* @author Tjeu Kayim
149149
*/
150-
inline fun <reified T : Any> MongoOperations.count(typedQuery: TypedQuery<T> = TypedQuery(), collectionName: String? = null): Long =
150+
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
151+
inline fun <reified T : Any> MongoOperations.count(typedQuery: TypedQuery<T>, collectionName: String? = null): Long =
151152
if (collectionName != null) count(typedQuery, T::class.java, collectionName) else count(typedQuery, T::class.java)
152153

153154
/**
@@ -164,6 +165,7 @@ fun <T : Any> MongoOperations.upsert(typedQuery: TypedQuery<T>, update: Update,
164165
*
165166
* @author Tjeu Kayim
166167
*/
168+
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
167169
inline fun <reified T : Any> MongoOperations.upsert(typedQuery: TypedQuery<T>, update: Update, collectionName: String? = null): UpdateResult =
168170
if (collectionName != null) upsert(typedQuery, update, T::class.java, collectionName)
169171
else upsert(typedQuery, update, T::class.java)
@@ -182,6 +184,7 @@ fun <T : Any> MongoOperations.updateFirst(typedQuery: TypedQuery<T>, update: Upd
182184
*
183185
* @author Tjeu Kayim
184186
*/
187+
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
185188
inline fun <reified T : Any> MongoOperations.updateFirst(typedQuery: TypedQuery<T>, update: Update, collectionName: String? = null): UpdateResult =
186189
if (collectionName != null) updateFirst(typedQuery, update, T::class.java, collectionName)
187190
else updateFirst(typedQuery, update, T::class.java)
@@ -200,6 +203,7 @@ fun <T : Any> MongoOperations.updateMulti(typedQuery: TypedQuery<T>, update: Upd
200203
*
201204
* @author Tjeu Kayim
202205
*/
206+
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
203207
inline fun <reified T : Any> MongoOperations.updateMulti(typedQuery: TypedQuery<T>, update: Update, collectionName: String? = null): UpdateResult =
204208
if (collectionName != null) updateMulti(typedQuery, update, T::class.java, collectionName)
205209
else updateMulti(typedQuery, update, T::class.java)
@@ -218,6 +222,7 @@ fun <T : Any> MongoOperations.remove(typedQuery: TypedQuery<T>, entityClass: KCl
218222
*
219223
* @author Tjeu Kayim
220224
*/
225+
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
221226
inline fun <reified T : Any> MongoOperations.remove(typedQuery: TypedQuery<T>, collectionName: String? = null): DeleteResult =
222227
if (collectionName != null) remove(typedQuery, T::class.java, collectionName)
223228
else remove(typedQuery, T::class.java)

0 commit comments

Comments
 (0)