This is an automated email from the ASF dual-hosted git repository. paulk-asert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit aa30a6906577f66a707a6522ca67d7a233117b80 Author: Paul King <[email protected]> AuthorDate: Thu Jul 9 13:36:46 2026 +1000 Close per-test GroovyClassLoader in contracts BaseTestClass BaseTestClass created a GroovyClassLoader in @BeforeEach but never closed it, so every contracts test that extended it leaked a loader. Add an @AfterEach that closes the loader, mirroring StubTestCase. --- .../org/apache/groovy/contracts/tests/basic/BaseTestClass.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subprojects/groovy-contracts/src/test/groovy/org/apache/groovy/contracts/tests/basic/BaseTestClass.groovy b/subprojects/groovy-contracts/src/test/groovy/org/apache/groovy/contracts/tests/basic/BaseTestClass.groovy index 95a7c251b6..e1ceccafd6 100644 --- a/subprojects/groovy-contracts/src/test/groovy/org/apache/groovy/contracts/tests/basic/BaseTestClass.groovy +++ b/subprojects/groovy-contracts/src/test/groovy/org/apache/groovy/contracts/tests/basic/BaseTestClass.groovy @@ -21,6 +21,7 @@ package org.apache.groovy.contracts.tests.basic import groovy.text.GStringTemplateEngine import groovy.text.TemplateEngine import org.codehaus.groovy.runtime.ScriptBytecodeAdapter +import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import static org.junit.jupiter.api.Assertions.assertTrue @@ -39,6 +40,12 @@ class BaseTestClass { loader = new GroovyClassLoader(getClass().getClassLoader()) } + @AfterEach + void tearDown() { + loader?.close() + loader = null + } + String createSourceCodeForTemplate(final String template, final Map binding) { templateEngine.createTemplate(template).make(binding).toString() }
