Problem with tests under 2020.3
Answered
Hi,
I've noticed a problem during debugging or running tests. I randomly get an error as below.
If I put public on groovy trait everything goes well.
It's quite frustrating. I use AdoptOpenJdk 15.0.2 in each step.
Can you have any idea what can I do?
Using Gradle tests running from the command line doesn't show this bug.
Groovyc: While compiling [cbs-api.integration]: BUG! exception in phase 'canonicalization' in source unit '/Users/dawid.kubicki/bitbucket/cbs-api/src/integration/groovy/pl/allegro/cbs/api/cbsapi/graphql/rtg/RtgQueryIntegrationSpec.groovy' JVM class can't be loaded for pl.allegro.cbs.api.cbsapi.base.stubs.WilhelmServiceStubbing
at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveJvmClass(AsmReferenceResolver.java:86)
at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getTypeClass(DecompiledClassNode.java:177)
at org.codehaus.groovy.ast.ClassNode.getTypeClass(ClassNode.java:1385)
at org.codehaus.groovy.transform.trait.Traits.findHelpers(Traits.java:149)
at org.codehaus.groovy.transform.trait.TraitComposer.doExtendTraits(TraitComposer.java:108)
at org.codehaus.groovy.control.CompilationUnit.lambda$addPhaseOperations$6(CompilationUnit.java:225)
at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:942)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:671)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:635)
at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:48)
at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:118)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:81)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:167)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda$runGroovyc$0(InProcessGroovyc.java:77)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.ClassNotFoundException: pl.allegro.cbs.api.cbsapi.base.stubs.WilhelmServiceStubbing$WilhelmServiceStubBuilder
at org.jetbrains.groovy.compiler.rt.ClassDependencyLoader.loadClassDependencies(ClassDependencyLoader.java:92)
at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner$6.loadClassDependencies(DependentGroovycRunner.java:530)
at org.jetbrains.groovy.compiler.rt.ClassDependencyLoader.loadTypeDependencies(ClassDependencyLoader.java:26)
at org.jetbrains.groovy.compiler.rt.ClassDependencyLoader.loadClassDependencies(ClassDependencyLoader.java:52)
at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner$6.loadClassDependencies(DependentGroovycRunner.java:530)
at org.jetbrains.groovy.compiler.rt.ClassDependencyLoader.loadDependencies(ClassDependencyLoader.java:20)
at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner$7$1.loadClass(DependentGroovycRunner.java:550)
at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveJvmClass(AsmReferenceResolver.java:84)
... 25 more
Caused by: java.lang.UnsupportedClassVersionError: Preview features are not enabled for pl/allegro/cbs/api/cbsapi/api/offer/model/OfferId (class file version 59.65535). Try running with '--enable-preview'
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:877)
at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:400)
at org.jetbrains.jps.incremental.groovy.JointCompilationClassLoader._defineClass(JointCompilationClassLoader.java:38)
at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:392)
at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:350)
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:336)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3325)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2466)
at org.jetbrains.groovy.compiler.rt.ClassDependencyLoader.loadClassDependencies(ClassDependencyLoader.java:51)
... 32 more
Please sign in to leave a comment.
Hello,
Does it help if add
-Dgroovyc.asm.resolving.only=falseto VM options in Settings/Preferences | Build, Execution and Deployment | Compiler?Egor,
Thank you for replay. Unfortunately, it doesn't help.
Now main class AppRunner is included in error.
Please try adding -Dgroovy.preview.features=true to build process VM options (shared or user) in Preferences | Build, Execution, Deployment | Compiler.
If the problem remains could you provide the IDE logs and a small reproducible project sample? (https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files)
The files can be uploaded at https://uploads.jetbrains.com. (do not forget to specify the UploadID)
Any update to this issue?
I've also started getting this error:
Mtgleeson It's a misconfiguration. Please perform the steps shared by Egor.
Thanks Konstantin. I tried using the compiler options mentioned by Egor but it didn't fix my issue. From looking closer at the stack trace it looks a little bit different to the original problem in this thread so I've logged a new bug to track it https://intellij-support.jetbrains.com/hc/en-us/requests/3381525