Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.6, 2.5.0-beta-1
-
None
Description
The fix in commit fae29119a for master and commit 197472cb for 2.4 branch corrected behavior that as a result can create a stackoverflow:
To reproduce compile the following:
@groovy.transform.CompileStatic class Foo { public <T> Class<T> firstClass(List<Class<T>> classes) { return classes.first() } }
If you change the placeholder from T to E (the placeholder used by List) it compiles successfully. The StaticTypeCheckingSupport#applyGenericConnections method receives both E and T in the resolvePlaceholders map and because there is no connection and with the fix to equalIncludingGenerics a stackoverflow results.
Stacktrace produced:
java.lang.StackOverflowError at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext(StaticTypeCheckingSupport.java:1722) at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext(StaticTypeCheckingSupport.java:1750) at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext(StaticTypeCheckingSupport.java:1722) at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext(StaticTypeCheckingSupport.java:1750)
Found as a result of testing master against a Grails build and noticing a stackoverflow when compiling a method within GparsPromiseFactory