Re: AST Transformation in Groovy 4.0.x VS 3.0.x

MG <mgbiz-yvYIh6MZAuFWk0Htik3J/[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <[email protected]>
Just a long shot, but have you checked if this error might be due to a 
broken build or similar, i.e. class files being modified in parallel or 
source files having been modified while the build process was running ?
We see "ArrayIndexOutOfBoundsException: size==0" exceptions from time to 
time during IntelliJ Groovy builds, and the cause is typically as stated 
above. Building anew (sometimes rebuilding a module or the whole project 
is required) typically fixes these... (we had some which were actual 
bugs in the Groovy compiler, but these are very rare).

Cheers,
mg


On 14/04/2024 15:54, Adrien Guichard wrote:
> Le dim. 14 avr. 2024 à 12:18, Paul King <[email protected]> a écrit :
>> Can you give us more of the stack trace where Groovy is failing for
>> the "size==0" error?
> java.lang.ArrayIndexOutOfBoundsException: size==0
> at org.codehaus.groovy.classgen.asm.OperandStack.ensureStackNotEmpty(OperandStack.java:279)
> at org.codehaus.groovy.classgen.asm.OperandStack.replace(OperandStack.java:271)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitCastExpression(AsmClassGenerator.java:815)
> at org.codehaus.groovy.ast.expr.CastExpression.visit(CastExpression.java:90)
> at org.codehaus.groovy.classgen.asm.StatementWriter.writeReturn(StatementWriter.java:615)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:682)
> at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:73)
> at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138)
> at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:111)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:462)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:409)
> at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:106)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:557)
> at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1100)
> at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1093)
> at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:273)
> at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:798)
> at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:943)
> at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:672)
> at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:636)
> at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:611)
> at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:285)
> at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:67)
> at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:97)
> at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:76)
> at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
> at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
> at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
> at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
> at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
> at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
> at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
> at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
> at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:87)
> at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:56)
> at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
> at org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
> at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:568)
> at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
> at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
> at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
> at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
> at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
> at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
> at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
> at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
> at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
> at java.base/java.lang.Thread.run(Thread.java:840)
>
>
>> I would in general expect very few changes needed between 3 and 4.
> I was wrong, Grails 6.2.0 is Groovy 3.0.21 (from 3.0.11)
>
>> Groovy's built-in AST transforms had almost no changes.
>>
>> Cheers, Paul.
> Thanks !
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.