-
Notifications
You must be signed in to change notification settings - Fork 199
Closed
Description
Hi
When @CurrentTenant defined on service method, it will work as expected but will cause a compilation error when defined on class level.
This will work
@Transactional
class BookService {
@CurrentTenant
Book saveBook(String title) {
Book book = new Book()
book.title = title
book.save(flush: true)
return book
}And this
@CurrentTenant
@Transactional
class Book2Service {
Book saveBook(String title) {
Book book = new Book()
book.title = title
book.save(flush: true)
return book
}
}Will result in
Caused by: java.lang.VerifyError: (class: se/multitenantdemo/Book2Service, method: saveBook signature: (Ljava/lang/String;)Lse/multitenantdemo/tenantdb/Book;) Unable to pop operand off an empty stack
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:49)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:36)
at org.grails.core.util.ClassPropertyFetcher.init(ClassPropertyFetcher.java:180)
at org.grails.core.util.ClassPropertyFetcher.<init>(ClassPropertyFetcher.java:150)
at org.grails.core.util.ClassPropertyFetcher.forClass(ClassPropertyFetcher.java:91)
at org.grails.core.util.ClassPropertyFetcher.forClass(ClassPropertyFetcher.java:66)
at org.grails.core.AbstractGrailsClass.<init>(AbstractGrailsClass.java:87)
at org.grails.core.AbstractInjectableGrailsClass.<init>(AbstractInjectableGrailsClass.java:31)
at org.grails.core.DefaultGrailsServiceClass.<init>(DefaultGrailsServiceClass.java:32)
... 43 moreHere is a sample project with Grails 3.2.8 and Gorm 6.1.1
I noticed that when using default dependencies groovy-test will land on 2.4.9.
Changing it it to 2.4.10 will still lead to the same error.
Same error will happen for @WithoutTenant and wouldn't be to much of a surprise if it also happen for @tenant.