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

Make project compatible with Groovy 3.0.19 #1754

Merged
merged 2 commits into from
Nov 5, 2023
Merged
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 @@ -266,7 +266,7 @@ public boolean isInitialized() {
return initialized;
}

private void setInitializing(Boolean initializing) {
protected void setInitializing(Boolean initializing) {
this.initializing = initializing;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class DetachedCriteria<T> extends AbstractDetachedCriteria<Observable<T>> implem
Observable<Number> getCount(Map args = Collections.emptyMap(), @DelegatesTo(DetachedCriteria) Closure additionalCriteria = null) {
Query query = prepareQuery(args, additionalCriteria)
query.projections().count()
return ((RxQuery)query).singleResult(args)
return ((RxQuery)query).singleResult(args) as Observable<Number>
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ abstract class AbstractRxDatastoreClient<T> implements RxDatastoreClient<T>, RxD
}
}
return identifiers
})
}) as Observable<List<Serializable>>
} else {
return Observable.just(identifiers)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class RxPersistentSet extends PersistentSet implements RxPersistentCollection, R
@Override
void initialize() {
if(initializing != null) return
initializing = true
initializing = Boolean.TRUE

try {
def observable = toListObservable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class RxQueryUtils {
return Arrays.asList(args)
}
})
}.map { List<Object> result ->
}.map { r ->
List<Object> result = (List<Object>) r
// first result is the entity
def entityInstance = result.get(0)
if(result.size() > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import java.util.concurrent.ConcurrentHashMap
class RxGormEnhancer {

private static final Map<String, Map<String,RxGormStaticApi>> STATIC_APIS = new ConcurrentHashMap<String, Map<String,RxGormStaticApi>>().withDefault { String key ->
return new ConcurrentHashMap<String, RxGormStaticApi>()
return new ConcurrentHashMap() as Map<String, RxGormStaticApi>
}
private static final Map<String, Map<String, RxGormInstanceApi>> INSTANCE_APIS = new ConcurrentHashMap<String, Map<String, RxGormInstanceApi>>().withDefault { String key ->
return new ConcurrentHashMap<String, RxGormInstanceApi>()
return new ConcurrentHashMap() as Map<String, RxGormInstanceApi>
}
private static final Map<String, Map<String, RxGormValidationApi>> VALIDATION_APIS = new ConcurrentHashMap<String, Map<String, RxGormValidationApi>>().withDefault { String key ->
return new ConcurrentHashMap<String, RxGormValidationApi>()
return new ConcurrentHashMap() as Map<String, RxGormValidationApi>
}
private static final Map<Class<? extends RxDatastoreClient>, RxDatastoreClient> DATASTORE_CLIENTS = new ConcurrentHashMap<Class<? extends RxDatastoreClient>, RxDatastoreClient>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class RxGormStaticApi<D> implements RxGormAllOperations<D> {
Observable<Number> count() {
def query = datastoreClient.createQuery(entity.javaClass)
query.projections().count()
return ((RxQuery)query).singleResult()
return ((RxQuery)query).singleResult() as Observable<Number>
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import java.util.concurrent.ConcurrentHashMap
class DefaultConstraintRegistry implements ConstraintRegistry {

protected Map<String, List<ConstraintFactory>> factoriesByName = new ConcurrentHashMap<String, List<ConstraintFactory>>().withDefault { String name ->
return []
return [] as List<ConstraintFactory>
}
protected Map<Class<? extends Constraint>, List<ConstraintFactory>> factoriesByType = new ConcurrentHashMap<Class<? extends Constraint>, List<ConstraintFactory>>().withDefault { Class<? extends Constraint> type ->
return []
return [] as List<ConstraintFactory>
}

protected final MessageSource messageSource
Expand Down Expand Up @@ -84,7 +84,7 @@ class DefaultConstraintRegistry implements ConstraintRegistry {
}

@Override
void addConstraint(Class<? extends Constraint> constraintClass, List<Class> targetPropertyTypes = [Object]) {
void addConstraint(Class<? extends Constraint> constraintClass, List<Class> targetPropertyTypes = [Object] as List<Class>) {
addConstraintFactory(new DefaultConstraintFactory(constraintClass, messageSource, targetPropertyTypes))
}

Expand All @@ -94,7 +94,7 @@ class DefaultConstraintRegistry implements ConstraintRegistry {
}

@Override
def <T extends Constraint> List<ConstraintFactory<T>> findConstraintFactories(Class<T> constraintType) {
return factoriesByType.get(constraintType)
<T extends Constraint> List<ConstraintFactory<T>> findConstraintFactories(Class<T> constraintType) {
return factoriesByType.get(constraintType) as List<ConstraintFactory<T>>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ class GormEnhancer implements Closeable {

private static final Map<String, Map<String, Closure>> NAMED_QUERIES = new ConcurrentHashMap<>()

private static final Map<String, Map<String,GormStaticApi>> STATIC_APIS = new ConcurrentHashMap<String, Map<String,GormStaticApi>>().withDefault { String key ->
return new ConcurrentHashMap<String, GormStaticApi>()
private static final Map<String, Map<String, GormStaticApi>> STATIC_APIS = new ConcurrentHashMap<String, Map<String, GormStaticApi>>().withDefault { String key ->
return new ConcurrentHashMap() as Map<String, GormStaticApi>
}
private static final Map<String, Map<String, GormInstanceApi>> INSTANCE_APIS = new ConcurrentHashMap<String, Map<String, GormInstanceApi>>().withDefault { String key ->
return new ConcurrentHashMap<String, GormInstanceApi>()
return new ConcurrentHashMap() as Map<String, GormInstanceApi>
}
private static final Map<String, Map<String, GormValidationApi>> VALIDATION_APIS = new ConcurrentHashMap<String, Map<String, GormValidationApi>>().withDefault { String key ->
return new ConcurrentHashMap<String, GormValidationApi>()
return new ConcurrentHashMap() as Map<String, GormValidationApi>
}
private static final Map<String, Map<String, Datastore>> DATASTORES = new ConcurrentHashMap<String, Map<String, Datastore>>().withDefault { String key ->
return new ConcurrentHashMap<String, Datastore>()
return new ConcurrentHashMap() as Map<String, Datastore>
}

private static final Map<Class, Datastore> DATASTORES_BY_TYPE = new ConcurrentHashMap<Class, Datastore>()
Expand Down Expand Up @@ -580,7 +580,7 @@ class GormEnhancer implements Closeable {
Class[] parameterTypes = method.parameterTypes

if (parameterTypes) {
parameterTypes = parameterTypes.length == 1 ? []: parameterTypes[1..-1]
parameterTypes = (parameterTypes.length == 1 ? [] : parameterTypes[1..-1]) as Class[]

boolean realMethodExists = doesRealMethodExist(mc, methodName, parameterTypes, false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public boolean beforeUpdate(PersistentEntity entity, EntityAccess ea) {
*
* @deprecated Use {@link #hasLastUpdated(String)} instead
*/
@Deprecated
protected boolean hasLastUpdated(PersistentEntity entity) {
return hasLastUpdated(entity.getName());
}
Expand All @@ -145,6 +146,7 @@ protected boolean hasLastUpdated(String n) {
*
* @deprecated Use {@link #hasDateCreated(String)} instead
*/
@Deprecated
protected boolean hasDateCreated(PersistentEntity entity) {
return hasDateCreated(entity.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ protected void onPersistenceEvent(final AbstractPersistenceEvent event) {
/**
* @deprecated Use {@link #beforeInsert(org.grails.datastore.mapping.model.PersistentEntity, org.grails.datastore.mapping.engine.EntityAccess, org.grails.datastore.mapping.engine.event.PreInsertEvent)} instead
*/
@Deprecated
public boolean beforeInsert(final PersistentEntity entity, final EntityAccess ea) {
return beforeInsert(entity, ea, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ trait ValidatedService<T> extends Service<T> {
*/
private ValidatorFactory validatorFactory

private Map<Method, ExecutableValidator> executableValidatorMap = new LinkedHashMap<Method,ExecutableValidator>().withDefault {
getValidatorFactory().getValidator().forExecutables()
private Map<Method, ExecutableValidator> executableValidatorMap = new LinkedHashMap<Method, ExecutableValidator>().withDefault {
validatorFactory.getValidator().forExecutables()
}

/**
Expand Down