matrei commented on code in PR #15683:
URL: https://github.com/apache/grails-core/pull/15683#discussion_r3334190039
##########
grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/base/GrailsDataTckManager.groovy:
##########
@@ -56,34 +31,36 @@ abstract class GrailsDataTckManager {
abstract Session createSession()
- List<Class> domainClasses = [
- Book,
- ChildEntity,
- City,
- ClassWithListArgBeforeValidate,
- ClassWithNoArgBeforeValidate,
- ClassWithOverloadedBeforeValidate,
- CommonTypes,
- Country,
- EnumThing,
- Face,
- Highway,
- Location,
- ModifyPerson,
- Nose,
- OptLockNotVersioned,
- OptLockVersioned,
- Person,
- PersonEvent,
- Pet,
- PetType,
- Plant,
- PlantCategory,
- Publication,
- Task,
- TestEntity
+ private List<Class> domainClasses = [
]
+/**
+ * Returns a defensive copy of the registered domain classes.
Review Comment:
Javadoc has wrong indentation.
##########
grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/base/GrailsDataTckManager.groovy:
##########
@@ -56,34 +31,36 @@ abstract class GrailsDataTckManager {
abstract Session createSession()
- List<Class> domainClasses = [
- Book,
- ChildEntity,
- City,
- ClassWithListArgBeforeValidate,
- ClassWithNoArgBeforeValidate,
- ClassWithOverloadedBeforeValidate,
- CommonTypes,
- Country,
- EnumThing,
- Face,
- Highway,
- Location,
- ModifyPerson,
- Nose,
- OptLockNotVersioned,
- OptLockVersioned,
- Person,
- PersonEvent,
- Pet,
- PetType,
- Plant,
- PlantCategory,
- Publication,
- Task,
- TestEntity
+ private List<Class> domainClasses = [
]
+/**
+ * Returns a defensive copy of the registered domain classes.
+ * Mutating this array will not affect the manager state.
+ */
+ Class[] getDomainClasses() {
+ return domainClasses as Class[]
+ }
+
+ @Deprecated
+ void addAllDomainClasses(Collection<Class> classes) {
Review Comment:
Do we need to deprecate a method that was never added?
##########
grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/base/GrailsDataTckManager.groovy:
##########
@@ -56,34 +31,36 @@ abstract class GrailsDataTckManager {
abstract Session createSession()
- List<Class> domainClasses = [
- Book,
- ChildEntity,
- City,
- ClassWithListArgBeforeValidate,
- ClassWithNoArgBeforeValidate,
- ClassWithOverloadedBeforeValidate,
- CommonTypes,
- Country,
- EnumThing,
- Face,
- Highway,
- Location,
- ModifyPerson,
- Nose,
- OptLockNotVersioned,
- OptLockVersioned,
- Person,
- PersonEvent,
- Pet,
- PetType,
- Plant,
- PlantCategory,
- Publication,
- Task,
- TestEntity
+ private List<Class> domainClasses = [
]
+/**
+ * Returns a defensive copy of the registered domain classes.
+ * Mutating this array will not affect the manager state.
+ */
+ Class[] getDomainClasses() {
+ return domainClasses as Class[]
Review Comment:
Remove `return` keyword?
##########
grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/base/GrailsDataTckManager.groovy:
##########
@@ -56,34 +31,36 @@ abstract class GrailsDataTckManager {
abstract Session createSession()
- List<Class> domainClasses = [
- Book,
- ChildEntity,
- City,
- ClassWithListArgBeforeValidate,
- ClassWithNoArgBeforeValidate,
- ClassWithOverloadedBeforeValidate,
- CommonTypes,
- Country,
- EnumThing,
- Face,
- Highway,
- Location,
- ModifyPerson,
- Nose,
- OptLockNotVersioned,
- OptLockVersioned,
- Person,
- PersonEvent,
- Pet,
- PetType,
- Plant,
- PlantCategory,
- Publication,
- Task,
- TestEntity
+ private List<Class> domainClasses = [
]
+/**
+ * Returns a defensive copy of the registered domain classes.
+ * Mutating this array will not affect the manager state.
+ */
+ Class[] getDomainClasses() {
+ return domainClasses as Class[]
+ }
+
+ @Deprecated
+ void addAllDomainClasses(Collection<Class> classes) {
+ if (classes) {
+ domainClasses.addAll(classes)
+ }
+ }
+
+ /**
+ * Adds all the specified classes to the domain classes list.
+ * Supports clean vararg syntax: manager.registerDomainClasses(Foo, Bar)
+ *
+ * @param classes The classes to register
+ */
+ void registerDomainClasses(Class... classes) {
Review Comment:
This method is currently unused. Why are we not using it?
##########
grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/base/GrailsDataTckManager.groovy:
##########
@@ -56,34 +31,36 @@ abstract class GrailsDataTckManager {
abstract Session createSession()
- List<Class> domainClasses = [
- Book,
- ChildEntity,
- City,
- ClassWithListArgBeforeValidate,
- ClassWithNoArgBeforeValidate,
- ClassWithOverloadedBeforeValidate,
- CommonTypes,
- Country,
- EnumThing,
- Face,
- Highway,
- Location,
- ModifyPerson,
- Nose,
- OptLockNotVersioned,
- OptLockVersioned,
- Person,
- PersonEvent,
- Pet,
- PetType,
- Plant,
- PlantCategory,
- Publication,
- Task,
- TestEntity
+ private List<Class> domainClasses = [
]
+/**
+ * Returns a defensive copy of the registered domain classes.
+ * Mutating this array will not affect the manager state.
+ */
+ Class[] getDomainClasses() {
+ return domainClasses as Class[]
+ }
+
+ @Deprecated
+ void addAllDomainClasses(Collection<Class> classes) {
+ if (classes) {
+ domainClasses.addAll(classes)
+ }
+ }
+
+ /**
+ * Adds all the specified classes to the domain classes list.
Review Comment:
Suggestion: `Registers the domain classes that will be available when
testing.` We can drop the "Supports clean vararg..." line.
##########
grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/base/GrailsDataTckManager.groovy:
##########
@@ -56,34 +31,36 @@ abstract class GrailsDataTckManager {
abstract Session createSession()
- List<Class> domainClasses = [
- Book,
- ChildEntity,
- City,
- ClassWithListArgBeforeValidate,
- ClassWithNoArgBeforeValidate,
- ClassWithOverloadedBeforeValidate,
- CommonTypes,
- Country,
- EnumThing,
- Face,
- Highway,
- Location,
- ModifyPerson,
- Nose,
- OptLockNotVersioned,
- OptLockVersioned,
- Person,
- PersonEvent,
- Pet,
- PetType,
- Plant,
- PlantCategory,
- Publication,
- Task,
- TestEntity
+ private List<Class> domainClasses = [
Review Comment:
Should this be a `Set` to prevent duplicates?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]