You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/04/27 23:40:43 UTC
[groovy] branch GROOVY_3_0_X updated (dccaea3 -> dfcdfaa)
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a change to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git.
from dccaea3 Eliminate redundant checks and trying to cache spread calls
new c8be509 demonstration of problem when a reloaded class has generic parameters
new dfcdfaa GROOVY-9526: Failed to reload classes with generic parameters
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/main/java/groovy/util/GroovyScriptEngine.java | 3 ++-
.../util/GroovyScriptEngineReloadingTest.groovy | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
[groovy] 01/02: demonstration of problem when a reloaded class has
generic parameters
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit c8be50917b87cd683d736961d0b4641e7831938a
Author: Jamie Echlin <je...@adaptavist.com>
AuthorDate: Fri Feb 14 15:47:56 2020 +0000
demonstration of problem when a reloaded class has generic parameters
(cherry picked from commit 3dffa18f707294a73dc5117dc4bbdb4a9ff5e042)
---
.../util/GroovyScriptEngineReloadingTest.groovy | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/test/groovy/util/GroovyScriptEngineReloadingTest.groovy b/src/test/groovy/util/GroovyScriptEngineReloadingTest.groovy
index 8cfd198..3e655fa 100644
--- a/src/test/groovy/util/GroovyScriptEngineReloadingTest.groovy
+++ b/src/test/groovy/util/GroovyScriptEngineReloadingTest.groovy
@@ -89,6 +89,28 @@ class GroovyScriptEngineReloadingTest extends GroovyTestCase {
execute(100000, 200000, 2)
}
+ void testRecompilingWithGenerics() {
+ MapFileSystem.instance.modFile('BaseClass.groovy', 'abstract class BaseClass<T> extends Script {}', gse.@time)
+
+ def subClassText = '''
+ class SubClass extends BaseClass<String> {
+ @Override
+ Object run() {
+ null
+ }
+ }
+ '''
+ MapFileSystem.instance.modFile('SubClass.groovy', subClassText, gse.@time)
+
+ gse.loadScriptByName('SubClass.groovy')
+ sleep 1000
+
+ // make a change to the sub-class so that it gets recompiled
+ MapFileSystem.instance.modFile('SubClass.groovy', subClassText + "\n", gse.@time)
+ gse.loadScriptByName('SubClass.groovy')
+
+ }
+
void testDeleteDependent() {
sleep 10000
MapFileSystem.instance.modFile('ClassA.groovy', 'DependentClass ic = new DependentClass()', gse.@time as long)
[groovy] 02/02: GROOVY-9526: Failed to reload classes with generic
parameters
Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit dfcdfaadfa20d1f0ee9d44964452e3fd6c01a2d6
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Apr 25 21:18:49 2020 +0800
GROOVY-9526: Failed to reload classes with generic parameters
(cherry picked from commit 67471d1d52e6d1f9105a0aa806c7800b4375c8d7)
---
src/main/java/groovy/util/GroovyScriptEngine.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/groovy/util/GroovyScriptEngine.java b/src/main/java/groovy/util/GroovyScriptEngine.java
index 7afd183..829dbaa 100644
--- a/src/main/java/groovy/util/GroovyScriptEngine.java
+++ b/src/main/java/groovy/util/GroovyScriptEngine.java
@@ -24,6 +24,7 @@ import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.lang.Script;
import org.codehaus.groovy.GroovyBugError;
+import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.classgen.GeneratorContext;
import org.codehaus.groovy.control.ClassNodeResolver;
@@ -198,7 +199,7 @@ public class GroovyScriptEngine implements ResourceConnector {
precompiledEntries.put(origName, path);
}
if (clazz != null) {
- ClassNode cn = new ClassNode(clazz);
+ ClassNode cn = ClassHelper.make(clazz);
return new LookupResult(null, cn);
}
} catch (ResourceException re) {