[Codenarc-developer] #3436461 - StackOverflowErrors with CodeNarc 0.16 - workaround?
Brought to you by:
chrismair
From: Chris M. <chr...@ea...> - 2011-11-13 01:59:31
|
Hamlet, I guess the major performance reorganization/rewrite of the code that we did for 0.16 exposed the same or similar Groovy 1.8 issue (http://jira.codehaus.org/browse/GROOVY-4922) that you fixed (with a workaround) for https://sourceforge.net/tracker/?func=detail <https://sourceforge.net/tracker/?func=detail&aid=3314839&group_id=250145&atid=1126573> &aid=3314839&group_id=250145&atid=1126573 in CodeNarc 0.15. The good news is that I could reproduce pretty easily by running with Groovy 1.8. And perhaps more good news, after some experimentation, and researching your previous workaround, it looks like we can fix/workaround by changing AbstractAstVisitor to use your ClassCodeVisitorSupportHack, so: public class AbstractAstVisitor extends ClassCodeVisitorSupport implements AstVisitor { becomes: public class AbstractAstVisitor extends ClassCodeVisitorSupportHack implements AstVisitor { That seems to have little or no performance impact (at least in my unscientific tests). Are you ok with that workaround? Or did you want to research more? Chris -----Original Message----- From: SourceForge.net [mailto:no...@so...] Sent: Friday, November 11, 2011 9:51 PM To: SourceForge.net Subject: [ codenarc-Bugs-3436461 ] StackOverflowErrors with CodeNarc 0.16 Bugs item #3436461, was opened at 2011-11-11 00:27 Message generated for change (Comment added) made by chrismair You can respond by visiting: <https://sourceforge.net/tracker/?func=detail&atid=1126573&aid=3436461&group_id=250145> https://sourceforge.net/tracker/?func=detail&atid=1126573&aid=3436461&group_id=250145 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: <https://www.google.com/accounts> https://www.google.com/accounts () Assigned to: Nobody/Anonymous (nobody) Summary: StackOverflowErrors with CodeNarc 0.16 Initial Comment: After upgrading to 0.16, nearly all files we throw at CodeNarc cause it to run into an endless recursion like this one. About 4/5 times the causing Rule is ImplementationAsTypeRule, but they also happen in UnusedPrivateMethodRule and UnnecessaryPackageReferenceRule. One Stacktrace of the hundreds follows, let me know if you need more information. [codenarc] Error from [org.codenarc.rule.design.ImplementationAsTypeRule] processing source file [/Users/cnr/Documents/dev/lusini/ofbiz/hot-deploy/api/src/main/com/lusini/api/authorization/Action.groovy] [codenarc] java.lang.StackOverflowError [codenarc] at groovy.lang.MetaClassImpl.getNormalMethodWithCaching(MetaClassImpl.java:1216) [codenarc] at groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:1132) [codenarc] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:903) [codenarc] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:885) [codenarc] at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:781) [codenarc] at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:772) [codenarc] at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToBoolean(DefaultTypeTransformation.java:156) [codenarc] at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.booleanUnbox(DefaultTypeTransformation.java:65) [codenarc] at org.codenarc.rule.design.ImplementationAsTypeAstVisitor.visitDeclarationExpression(ImplementationAsTypeRule.groovy:109) [codenarc] at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) [codenarc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [codenarc] at java.lang.reflect.Method.invoke(Method.java:597) [codenarc] at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) [codenarc] at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) [codenarc] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1055) [codenarc] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128) [codenarc] at org.codenarc.rule.design.ImplementationAsTypeAstVisitor.visitDeclarationExpression(ImplementationAsTypeRule.groovy:116) [codenarc] at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) [codenarc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [codenarc] at java.lang.reflect.Method.invoke(Method.java:597) [codenarc] at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) [codenarc] at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) [codenarc] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1055) [codenarc] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128) [codenarc] at org.codenarc.rule.design.ImplementationAsTypeAstVisitor.visitDeclarationExpression(ImplementationAsTypeRule.groovy:116) [codenarc] at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) [codenarc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [codenarc] at java.lang.reflect.Method.invoke(Method.java:597) [codenarc] at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) [codenarc] at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) [codenarc] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1055) [codenarc] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128) [... removed ...] ---------------------------------------------------------------------- >Comment By: Chris Mair (chrismair) Date: 2011-11-11 18:51 Message: I was able to reproduce a similar StackOverflowError running with Groovy1.8.2, processing the UnusedPrivateMethodRule, which is one of rules mentioned above. As a workaround, running with Groovy 1.7.x should avoid the StackOverflowError, until we can figure out a fix. ---------------------------------------------------------------------- Comment By: Chris Mair (chrismair) Date: 2011-11-11 06:09 Message: Can you please provide the version of the Java JDK are you running this with, and what version of Groovy (jar) is on the classpath. Thanks. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126573&aid=3436461&group_id=250145 |