Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error for @Cacheable annotation when class is marked as @Transactional #49

Closed
davidbairdala opened this issue Mar 15, 2018 · 4 comments
Assignees
Milestone

Comments

@davidbairdala
Copy link

davidbairdala commented Mar 15, 2018

import grails.gorm.transactions.Transactional
import grails.plugin.cache.*

@Transactional
class TestService {

    @Cacheable(value = 'testservice', key = { foobar.toLowerCase() } )
    String serviceMethod(String foobar) {
        return foobar
    }
}

yeilds the following compiler error

[Static type checking] - The variable [foobar] is undeclared.
 @ line 9, column 47.
   alue = 'testservice', key = { foobar.toL

If I remove the @transactional annotation, it compiles and works as expected

@mkobel
Copy link
Contributor

mkobel commented Apr 26, 2018

With @Transactional a static type check is enforced somehow.
If you add the @groovy.transform.CompileDynamic annotation to your service, you no longer have the compiler error.

But this seems to be only a workaround.

Is there probably a type checking extension required?

@timic
Copy link

timic commented Nov 7, 2018

Grails 3.3.x depends on 4.x version of this plugin. Since @Transcational annotation is widely used, this makes this plugin unusable and the migration to Grails 3.3.x is impossible.

Please release this fix ASAP.

@puneetbehl
Copy link
Contributor

@timic I am not sure if I follow, do you mean releasing v4.0.2?

@timic
Copy link

timic commented Nov 9, 2018

Yes, maybe. I'm not familiar with your release plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants