Hi,
I thought upgrading from 2.2.1 to 2.4.4 would be a breeze. So I simply deleted groovy-all-2.2.1.jar and added groovy-all-2.4.4.jar locally before
committing. But I was surprised to get this error, which exists in all our scripts.
[java] Caused by:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[java] component://commonext/webapp/ofbizsetup/organization/changeOrgPartyId.groovy: 23: A transform used a generics containing ClassNode
org.ofbiz.service.engine.GroovyBaseScript for the super class cha
ngeOrgPartyId directly. You are not supposed to do this. Please create a new ClassNode referring to the old ClassNode and use the new ClassNode
instead of the old one. Otherwise the compiler will create wrong
descriptors and a potential NullPointerException in TypeResolver in the OpenJDK. If this is not your own doing, please report this bug to the writer
of the transform.
[java] @ line 23, column 1.
[java] partyAcctgPrefAndGroupList = [];
[java] ^
[java]
[java] 1 error
[java]
[java] at
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1075)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:212)
~[groovy-all-2.4.4.jar:2.4.4]
[java] at
org.ofbiz.base.util.GroovyUtil.parseClass(GroovyUtil.java:162)
~[ofbiz-base.jar:?]
[java] at
org.ofbiz.base.util.GroovyUtil.getScriptClassFromLocation(GroovyUtil.java:134)
~[ofbiz-base.jar:?]
[java] at
org.ofbiz.base.util.GroovyUtil.runScriptAtLocation(GroovyUtil.java:170)
~[ofbiz-base.jar:?]
[java] at
org.ofbiz.base.util.ScriptUtil.executeScript(ScriptUtil.java:342)
~[ofbiz-base.jar:?]
[java] at
org.ofbiz.base.util.ScriptUtil.executeScript(ScriptUtil.java:324)
~[ofbiz-base.jar:?]
[java] at
org.ofbiz.widget.model.AbstractModelAction$Script.runAction(AbstractModelAction.java:632)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.AbstractModelAction.runSubActions(AbstractModelAction.java:141)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:273)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreen.renderScreenString(ModelScreen.java:164)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ScreenFactory.renderReferencedScreen(ScreenFactory.java:211)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:780)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:98)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:280)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreen.renderScreenString(ModelScreen.java:164)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ScreenFactory.renderReferencedScreen(ScreenFactory.java:211)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:860)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:98)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:280)
~[ofbiz-widget.jar:?]
[java] at
org.ofbiz.widget.model.ModelScreen.renderScreenString(ModelScreen.java:164)
~[ofbiz-widget.jar:?]
[java] ... 28 more
Here changeOrgPartyId super class refers to the changeOrgPartyId.groovy script.
I looked for similar cases on the Internet and found
https://issues.apache.org/jira/browse/GROOVY-5112
https://issues.apache.org/jira/browse/GROOVY-6691
I asked on the Groovy ML if they thought it could be a bug in Groovy, they
asked if we are using our own AST transformations.
I don't think we do so, but before dive in in code and answering them I
preferred to ask.
Thanks
Jacques