Skip to content

Commit c876194

Browse files
committed
Merge remote-tracking branch 'origin/4.0.x'
2 parents 9600e3c + 8d1f769 commit c876194

File tree

8 files changed

+80
-3
lines changed

8 files changed

+80
-3
lines changed

.github/release-drafter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name-template: $NEXT_PATCH_VERSION
2-
tag-template: v$NEXT_PATCH_VERSION
1+
name-template: $RESOLVED_VERSION
2+
tag-template: v$RESOLVED_VERSION
33
version-resolver:
44
major:
55
labels:

.github/workflows/gradle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- master
1111
- '[4-9]+.[0-9]+.x'
1212
- '[3-9]+.[3-9]+.x'
13+
workflow_dispatch:
1314
jobs:
1415
build:
1516
runs-on: ubuntu-latest

build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ buildscript {
1313
classpath "javax.xml.bind:jaxb-api:$jaxbVersion"
1414
classpath "com.sun.xml.bind:jaxb-impl:$jaxbVersion"
1515
classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.7.2"
16+
classpath "org.gradle:test-retry-gradle-plugin:1.3.1"
1617
}
1718
}
1819

@@ -340,6 +341,7 @@ subprojects { project ->
340341
apply plugin: 'idea'
341342
apply plugin: 'project-report'
342343
apply plugin: 'nebula.optional-base'
344+
apply plugin: "org.gradle.test-retry"
343345

344346
if (!isTestSuite) {
345347

@@ -502,6 +504,11 @@ subprojects { project ->
502504
}
503505

504506
test {
507+
retry {
508+
maxRetries = 2
509+
maxFailures = 20
510+
failOnPassedAfterRetry = true
511+
}
505512
testLogging {
506513
events "passed", "skipped", "failed"
507514

grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import org.grails.databinding.xml.GPathResultMap
3232
import java.lang.annotation.Annotation
3333
import java.lang.reflect.Array
3434
import java.lang.reflect.Field
35+
import java.lang.reflect.Modifier
3536
import java.lang.reflect.ParameterizedType
3637

3738
/**
@@ -622,6 +623,9 @@ class SimpleDataBinder implements DataBinder {
622623
if (metaProperty instanceof MetaBeanProperty) {
623624
def mbp = (MetaBeanProperty)metaProperty
624625
propertyType = mbp.getter?.returnType ?: mbp.field?.type
626+
if(propertyType && (propertyType.interface || Modifier.isAbstract(propertyType.modifiers))) {
627+
propertyType = mbp.field?.type
628+
}
625629
propertyGetter = mbp.getter
626630
}
627631
if (propertyType == null || propertyType == Object) {

grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,38 @@ class SimpleDataBinderSpec extends Specification {
612612
comment.attachments.find { it.filename == 'foo.txt' }
613613
comment.attachments.find { it.filename == 'bar.txt' }
614614
}
615+
616+
@Issue('https://github.com/grails/grails-core/issues/12150')
617+
void 'Test binding when class and embedded classes both implements an interface'() {
618+
given:
619+
SimpleDataBinder binder = new SimpleDataBinder()
620+
621+
and:
622+
SimpleMapDataBindingSource input = [a: [data: 'abc']] as SimpleMapDataBindingSource
623+
ClassB classWithInterface = new ClassB()
624+
625+
when:
626+
binder.bind(classWithInterface, input)
627+
628+
then:
629+
classWithInterface.a.data == 'abc'
630+
}
631+
632+
@Issue('https://github.com/grails/grails-core/issues/12150')
633+
void 'Test binding when class and embedded classes extends abstract class and implements an interface'() {
634+
given:
635+
SimpleDataBinder binder = new SimpleDataBinder()
636+
637+
and:
638+
SimpleMapDataBindingSource input = [a: [data: 'abc']] as SimpleMapDataBindingSource
639+
FromAbstractB fromAbstractB = new FromAbstractB()
640+
641+
when:
642+
binder.bind(fromAbstractB, input)
643+
644+
then:
645+
fromAbstractB.a.data == 'abc'
646+
}
615647
}
616648

617649
class Factory {
@@ -688,3 +720,26 @@ class Attachment {
688720
String filename
689721
}
690722

723+
interface InterfaceA {
724+
String getData()
725+
}
726+
727+
interface InterfaceB {
728+
InterfaceA getA()
729+
}
730+
731+
class ClassA implements InterfaceA {
732+
String data
733+
}
734+
735+
class ClassB implements InterfaceB {
736+
ClassA a
737+
}
738+
739+
class AbstractB {
740+
ClassA a
741+
}
742+
743+
class FromAbstractB extends AbstractB {
744+
745+
}

grails-shell/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies {
3737
}
3838

3939
testImplementation "net.sf.expectit:expectit-core:0.9.0"
40-
testImplementation "com.github.jnr:jnr-posix:3.1.10"
40+
testImplementation "com.github.jnr:jnr-posix:3.1.11"
4141

4242
runtimeOnly "org.slf4j:slf4j-simple:$slf4jVersion"
4343
runtimeOnly "org.codehaus.plexus:plexus-component-api:1.0-alpha-33"

grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/RestfulUrlMappingSpec.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ import org.grails.support.MockApplicationContext
99
import org.grails.web.mapping.DefaultLinkGenerator
1010
import org.grails.web.mapping.DefaultUrlMappingEvaluator
1111
import org.grails.web.mapping.DefaultUrlMappingsHolder
12+
import org.grails.web.util.WebUtils
1213
import spock.lang.Issue
1314
import spock.lang.Specification
1415

1516
class RestfulUrlMappingSpec extends Specification {
1617

18+
def setup() {
19+
WebUtils.clearGrailsWebRequest()
20+
}
21+
1722
def mappings = {
1823
delete "/$controller/$id(.$format)?"(action: "delete")
1924
get "/$controller(.$format)?"(action: "index")

grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/UrlMappingsWithHttpMethodSpec.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.grails.support.MockApplicationContext
1010
import org.grails.web.mapping.DefaultLinkGenerator
1111
import org.grails.web.mapping.DefaultUrlMappingEvaluator
1212
import org.grails.web.mapping.DefaultUrlMappingsHolder
13+
import org.grails.web.util.WebUtils
1314
import org.springframework.mock.web.MockServletContext
1415
import spock.lang.IgnoreIf
1516
import spock.lang.Specification
@@ -20,6 +21,10 @@ import spock.lang.Specification
2021
@IgnoreIf({ env['CI'] })
2122
class UrlMappingsWithHttpMethodSpec extends Specification{
2223

24+
def setup() {
25+
WebUtils.clearGrailsWebRequest()
26+
}
27+
2328
def mappings = {
2429
"/foo"( controller:"bar", action:"save", method:"POST" )
2530
"/foo2"( controller:"bar", action:"save", method:"PUT" )

0 commit comments

Comments
 (0)