Skip to content

Commit

Permalink
fix: Re-enable @CompileStatic on GormService
Browse files Browse the repository at this point in the history
  • Loading branch information
matrei committed Sep 13, 2024
1 parent 82db572 commit b6ee975
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/groovy/grails/plugin/scaffolding/GormService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.grails.datastore.gorm.GormEntity

@Artefact("Service")
@ReadOnly
//@CompileStatic
@CompileStatic
class GormService<T extends GormEntity<T>> {

GormAllOperations<T> resource
Expand Down Expand Up @@ -46,14 +46,14 @@ class GormService<T extends GormEntity<T>> {
if (readOnly) {
return
}
queryForResource(id).delete flush: true
resource.delete(queryForResource(id), [flush: true])
}

@Transactional
T save(T instance) {
if (readOnly) {
return instance
}
instance.save flush: true
resource.save(instance, [flush: true])

This comment has been minimized.

Copy link
@codeconsole

codeconsole Sep 14, 2024

Contributor

@matrei that doesn't work and broke the build

This comment has been minimized.

Copy link
@codeconsole

codeconsole Sep 14, 2024

Contributor

I get an error that there is only save(Map[]) when running it

This comment has been minimized.

Copy link
@matrei

matrei Sep 14, 2024

Author Contributor

@codeconsole That's strange, the build ran successfully for me locally and in CI: https://ge.grails.org/s/3oy3nvoj57eve

This comment has been minimized.

Copy link
@codeconsole

codeconsole Sep 14, 2024

Contributor

@matrei I used bad wording... it built fine, didn't run correctly when I tried to save in the app.

This comment has been minimized.

Copy link
@matrei

matrei Sep 14, 2024

Author Contributor

Aha, that's why we need tests 😄

Ok, so the methods from GormInstanceOperations<D> are not actually available.
It seems I don't have a clear picture how all these interfaces and traits come together.

Good that you found another solution, that works 👍

}
}

0 comments on commit b6ee975

Please sign in to comment.