Skip to content

Commit 12fd7e6

Browse files
committed
Merge branch '7.0.x' into 7.0.x-buildSettingsFix-forked-solution-3
2 parents 54a422b + 8d8bc39 commit 12fd7e6

File tree

61 files changed

+969
-391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+969
-391
lines changed

build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/SbomPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class SbomPlugin implements Plugin<Project> {
6767
],
6868
'BSD-2-Clause': [
6969
id : 'BSD-2-Clause',
70-
url: 'https://opensource.org/license/bsd-3-clause/'
70+
url: 'https://opensource.org/license/bsd-2-clause/'
7171
],
7272
'BSD-3-Clause': [
7373
id : 'BSD-3-Clause',

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ gradleCycloneDxPluginVersion=2.4.1
5454
micronautPlatformVersion=4.9.2
5555

5656
# Libraries only specific to test apps, these should not be exposed
57-
grailsSpringSecurityVersion=7.0.0-SNAPSHOT
57+
grailsSpringSecurityVersion=7.0.1-SNAPSHOT
5858
jbossTransactionApiVersion=2.0.0.Final
5959
# Note: we do not import the micronaut bom in our tests to avoid spring version mismatches
6060
micronautHttpClientVersion=4.9.9

grails-datamapping-async/src/main/groovy/grails/gorm/async/AsyncEntity.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package grails.gorm.async
2121

2222
import groovy.transform.CompileStatic
23+
import groovy.transform.Generated
2324

2425
import org.grails.datastore.gorm.GormEnhancer
2526
import org.grails.datastore.gorm.GormEntity
@@ -37,6 +38,7 @@ trait AsyncEntity<D> extends GormEntity<D> {
3738
/**
3839
* @return The async version of the GORM static API
3940
*/
41+
@Generated
4042
static GormAsyncStaticApi<D> getAsync() {
4143
return new GormAsyncStaticApi(GormEnhancer.findStaticApi(this))
4244
}

grails-datamapping-core-test/src/test/groovy/org/grails/datastore/gorm/schemaless/ImplementsDynamicAttributes.groovy

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,44 @@
1818
*/
1919
package org.grails.datastore.gorm.schemaless
2020

21+
import java.lang.reflect.Method
22+
23+
import groovy.transform.Generated
24+
2125
import spock.lang.Issue
2226
import spock.lang.Specification
2327

24-
2528
class DynamicDomainSpec extends Specification {
2629

27-
@Issue("GDM-769")
28-
void "Test a domain with dynamic attributes doesn't try to set readonly properties"() {
30+
@Issue('GDM-769')
31+
void 'test a domain with dynamic attributes does not try to set readonly properties'() {
2932
given:
30-
DynamicEntity entity = new DynamicEntity()
33+
def entity = new DynamicEntity()
3134

3235
when:
33-
entity.putAt("foo", 123)
34-
entity.putAt("name", "Sally")
36+
entity.putAt('foo', 123)
37+
entity.putAt('name', 'Sally')
3538

3639
then:
37-
entity.foo == "foo"
38-
entity.name == "Sally"
39-
entity.getAt("foo") == "foo"
40-
!entity.attributes().containsKey("name")
40+
entity.foo == 'foo'
41+
entity.name == 'Sally'
42+
entity.getAt('foo') == 'foo'
43+
!entity.attributes().containsKey('name')
4144
entity.attributes().foo == 123
4245
}
4346

47+
void 'test that all DynamicAttributes trait methods are marked as Generated'() {
48+
49+
expect: 'all DynamicAttributes methods are marked as Generated on implementation class'
50+
DynamicAttributes.methods.each { Method traitMethod ->
51+
assert DynamicEntity.getMethod(traitMethod.name, traitMethod.parameterTypes).isAnnotationPresent(Generated)
52+
}
53+
}
4454
}
4555

4656
class DynamicEntity implements DynamicAttributes {
47-
4857
String name
49-
5058
String getFoo() {
51-
"foo"
59+
'foo'
5260
}
53-
54-
}
61+
}

grails-datamapping-core/src/main/groovy/grails/gorm/MultiTenant.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package grails.gorm
2121

2222
import groovy.transform.CompileStatic
23+
import groovy.transform.Generated
2324

2425
import grails.gorm.api.GormAllOperations
2526
import org.grails.datastore.gorm.GormEnhancer
@@ -41,6 +42,7 @@ trait MultiTenant<D> extends Entity {
4142
* @param callable The closure
4243
* @return The result of the closure
4344
*/
45+
@Generated
4446
static <T> T withTenant(Serializable tenantId, Closure<T> callable) {
4547
GormEnhancer.findStaticApi(this).withTenant(tenantId, callable)
4648
}
@@ -51,6 +53,7 @@ trait MultiTenant<D> extends Entity {
5153
* @param callable The closure
5254
* @return The result of the closure
5355
*/
56+
@Generated
5457
static <D> GormAllOperations eachTenant(Closure callable) {
5558
GormEnhancer.findStaticApi(this, ConnectionSource.DEFAULT).eachTenant(callable)
5659
}
@@ -61,6 +64,7 @@ trait MultiTenant<D> extends Entity {
6164
* @param tenantId The tenant id
6265
* @return The operations
6366
*/
67+
@Generated
6468
static <D> GormAllOperations<D> withTenant(Serializable tenantId) {
6569
(GormAllOperations<D>) GormEnhancer.findStaticApi(this).withTenant(tenantId)
6670
}

grails-datamapping-core/src/main/groovy/grails/gorm/time/InstantConverter.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package grails.gorm.time
2222
import java.time.Instant
2323

2424
import groovy.transform.CompileStatic
25+
import groovy.transform.Generated
2526

2627
/**
2728
* A trait to convert a {@link java.time.Instant} to and from a long
@@ -31,10 +32,12 @@ import groovy.transform.CompileStatic
3132
@CompileStatic
3233
trait InstantConverter {
3334

35+
@Generated
3436
Long convert(Instant value) {
3537
value.toEpochMilli()
3638
}
3739

40+
@Generated
3841
Instant convert(Long value) {
3942
Instant.ofEpochMilli(value)
4043
}

grails-datamapping-core/src/main/groovy/grails/gorm/time/LocalDateConverter.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import java.time.ZoneId
2727
import java.time.ZoneOffset
2828

2929
import groovy.transform.CompileStatic
30+
import groovy.transform.Generated
3031

3132
/**
3233
* A trait to convert a {@link LocalDate} to and from a long
@@ -37,12 +38,14 @@ import groovy.transform.CompileStatic
3738
trait LocalDateConverter extends TemporalConverter<LocalDate> {
3839

3940
@Override
41+
@Generated
4042
Long convert(LocalDate value) {
4143
LocalDateTime localDateTime = LocalDateTime.of(value, LocalTime.MIN)
4244
localDateTime.toInstant(ZoneOffset.UTC).toEpochMilli()
4345
}
4446

4547
@Override
48+
@Generated
4649
LocalDate convert(Long value) {
4750
Instant instant = Instant.ofEpochMilli(value)
4851
LocalDateTime.ofInstant(instant, ZoneId.of('UTC')).toLocalDate()

grails-datamapping-core/src/main/groovy/grails/gorm/time/LocalDateTimeConverter.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import java.time.ZoneId
2525
import java.time.ZoneOffset
2626

2727
import groovy.transform.CompileStatic
28+
import groovy.transform.Generated
2829

2930
/**
3031
* A trait to convert a {@link java.time.LocalDateTime} to and from a long
@@ -35,11 +36,13 @@ import groovy.transform.CompileStatic
3536
trait LocalDateTimeConverter implements TemporalConverter<LocalDateTime> {
3637

3738
@Override
39+
@Generated
3840
Long convert(LocalDateTime value) {
3941
value.toInstant(ZoneOffset.UTC).toEpochMilli()
4042
}
4143

4244
@Override
45+
@Generated
4346
LocalDateTime convert(Long value) {
4447
LocalDateTime.ofInstant(Instant.ofEpochMilli(value), ZoneId.of('UTC'))
4548
}

grails-datamapping-core/src/main/groovy/grails/gorm/time/LocalTimeConverter.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package grails.gorm.time
2222
import java.time.LocalTime
2323

2424
import groovy.transform.CompileStatic
25+
import groovy.transform.Generated
2526

2627
/**
2728
* A trait to convert a {@link LocalTime} to and from a long
@@ -32,11 +33,13 @@ import groovy.transform.CompileStatic
3233
trait LocalTimeConverter implements TemporalConverter<LocalTime> {
3334

3435
@Override
36+
@Generated
3537
Long convert(LocalTime value) {
3638
value.toNanoOfDay()
3739
}
3840

3941
@Override
42+
@Generated
4043
LocalTime convert(Long value) {
4144
LocalTime.ofNanoOfDay(value)
4245
}

grails-datamapping-core/src/main/groovy/grails/gorm/time/OffsetDateTimeConverter.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import java.time.Instant
2323
import java.time.OffsetDateTime
2424

2525
import groovy.transform.CompileStatic
26+
import groovy.transform.Generated
2627

2728
/**
2829
* A trait to convert a {@link java.time.OffsetDateTime} to and from a long
@@ -33,11 +34,13 @@ import groovy.transform.CompileStatic
3334
trait OffsetDateTimeConverter implements TemporalConverter<OffsetDateTime> {
3435

3536
@Override
37+
@Generated
3638
Long convert(OffsetDateTime value) {
3739
value.toInstant().toEpochMilli()
3840
}
3941

4042
@Override
43+
@Generated
4144
OffsetDateTime convert(Long value) {
4245
OffsetDateTime.ofInstant(Instant.ofEpochMilli(value), systemOffset)
4346
}

0 commit comments

Comments
 (0)