Re: Class file version problem on Java 17

Daniel Sun <[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <pony-a30afb1a-52e3-4ec2-b9d1-7b9262c4e7c4-users@groovy.apache.org>
Please submit a JIRA ticket to track the issue[1], and it's better to provide us a standalone runnable script to reproduce the issue.

Cheers,
Daniel Sun

[1] https://issues.apache.org/jira/projects/GROOVY/summary

On 2021/11/28 19:07:47 Jochen Wiedmann wrote:
> Hi,
> 
> I've got a Groovy script (4.0.0-beta-2), which is embedded into a Java
> program. When unit testing the program on Java 8, everything is
> working fine. However, if I do run the same unit test on Java 17, I
> get the stack trace below.
> 
> Is there anything, I need to adjust when using Java 17? I am thinking
> along the line of setting a target version in the GroovyShell, or the
> like.
> 
> Thanks,
> 
> Jochen
> 
> BUG! exception in phase 'semantic analysis' in source unit
> 'file:/C:/Windows/System32/config/systemprofile/AppData/Local/Jenkins/.jenkins/workspace/afw-17/afw-core/target/test-classes/com/github/jochenw/afw/core/scripts/simple-script.groovy'
> Unsupported class file major version 61
> at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:905)
> at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
> at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:367)
> at groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:310)
> at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
> at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
> at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:308)
> at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526)
> at groovy.lang.GroovyShell.parse(GroovyShell.java:538)
> at groovy.lang.GroovyShell.parse(GroovyShell.java:518)
> 
> 
> 
> -- 
> Philosophy is useless, theology is worse. (Industrial Desease, Dire Straits)
>
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.