File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
src/test/groovy/groovy/util Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,39 @@ final class GroovyScriptEngineReloadingTest {
182182
183183 }
184184
185+ @Test
186+ void testRecompilingWithGenericsAndConstants () {
187+ MapFileSystem . instance. modFile(' BaseClass.groovy' , ' class BaseClass<T> {}' , gse. @time)
188+
189+ def tertiaryClassText = '''
190+ class NotGeneric {
191+ /**
192+ * Not typed on purpose - if typed as String then NotGeneric is no longer a dependency of
193+ * ParameterisedClass for some reason...
194+ */
195+ public static final Object CONSTANT = "not generic"
196+ }
197+ '''
198+ MapFileSystem . instance. modFile(' NotGeneric.groovy' , tertiaryClassText, gse. @time)
199+
200+ def subClassText = '''
201+ class SubClass extends BaseClass<String> {
202+ public static final String CONSTANT = NotGeneric.CONSTANT
203+ }
204+ '''
205+ MapFileSystem . instance. modFile(' SubClass.groovy' , subClassText, gse. @time)
206+
207+ MapFileSystem . instance. modFile(' scriptUsingGeneric.groovy' , ' SubClass.CONSTANT' , gse. @time)
208+
209+
210+ gse. loadScriptByName(' scriptUsingGeneric.groovy' )
211+ sleep 1000
212+
213+ // make a change to the sub-class so that it gets recompiled
214+ MapFileSystem . instance. modFile(' SubClass.groovy' , subClassText + ' \n ' , gse. @time)
215+ gse. loadScriptByName(' scriptUsingGeneric.groovy' )
216+ }
217+
185218 @Test
186219 void testDeleteDependent () {
187220 sleep 10000
You can’t perform that action at this time.
0 commit comments