Grails 3.3.8 / JDK1.8.0_192 / Win OS / grails-melody-plugin 1.74.0
When adding new Service class:
package grails.melody.plugin
import grails.gorm.transactions.Transactional
@Transactional
class DomainFindService {
def findByName(Class domain, String name) {
log.debug 'findByName - name [{}]', name
Object instance = domain.findByName(name)
log.debug 'findByName - [{}]', instance
return instance
}
}
and extending test from app-integration-tests like this
package grails.melody.plugin
import grails.testing.mixin.integration.Integration
import grails.transaction.Rollback
import org.springframework.transaction.annotation.Transactional
import spock.lang.Specification
@Integration
class GrailsTransactionSpec extends Specification {
DomainFindService domainFindService
@Transactional
@Rollback
def 'saving an domain instance should not throw IllegalStateException'() {
when:
new SampleDomain(name: 'ABC').save(flush:true)
then:
notThrown IllegalStateException
SampleDomain.count() == 1
when:
Object instance = domainFindService.findByName(SampleDomain, 'ABC')
then:
notThrown IllegalStateException
instance != null
}
}
gives:
groovy.lang.MissingMethodException: No signature of method: grails.melody.plugin.DomainFindService.$tt__findByName() is applicable for argument types: (java.lang.Class, java.lang.String, org.springframework.transaction.support.DefaultTransactionStatus) values: [class grails.melody.plugin.SampleDomain, ABC, org.springframework.transaction.support.DefaultTransactionStatus@46cab43e]
at grails.melody.plugin.MelodyInterceptorEnhancer.enhance_closure1$_closure2(MelodyInterceptorEnhancer.groovy:71)
Looks like first argument's type Class makes all the troubles.
When switched to Object works OK and metaMethod is found in MelodyInterceptorEnhancer:
def metaMethod = delegate.metaClass.getMetaMethod(name, args)
Does it look like a bug to you or is it documented somewhere
(NOT to use certain method signatures to be properly enhanced by Melody)?
Chris
Grails 3.3.8 / JDK1.8.0_192 / Win OS / grails-melody-plugin 1.74.0
When adding new Service class:
and extending test from app-integration-tests like this
gives:
Looks like first argument's type Class makes all the troubles.
When switched to Object works OK and metaMethod is found in MelodyInterceptorEnhancer:
Does it look like a bug to you or is it documented somewhere
(NOT to use certain method signatures to be properly enhanced by Melody)?
Chris