Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spock-core-1.3-groovy-2.4 passes ASM4 opcode instead of ASM7 when using SpecClassFileSelector #1025

chris-schwartz opened this issue Sep 3, 2019 · 3 comments


Copy link

commented Sep 3, 2019

Issue description

When using the SpecClassFileSelector for selecting Spock tests for an Ant build using JDK 11, the following exception is thrown:

Caused by: java.lang.UnsupportedOperationException: This feature requires ASM7
	at org.objectweb.asm.ClassVisitor.visitNestHost(
	at org.objectweb.asm.ClassReader.accept(
	at org.objectweb.asm.ClassReader.accept(
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.base/java.lang.reflect.Method.invoke(
	at org.spockframework.util.ReflectionUtil.invokeMethod(
	at org.spockframework.buildsupport.AsmClassReader.accept(
	at org.spockframework.buildsupport.SpecClassFileFinder.isRunnableSpec(
	at org.spockframework.buildsupport.ant.SpecClassFileSelector.isSelected(

Issue appears to be that the SpecClassFileVisitor class is passing an Opcode of ASM4 instead of ASM7 when calling its super constructor. This also appears to be happening in the EmptyAnnotationVisitor class. After changing this to ASM7, the issue appears to be resolved.

How to reproduce

Building with OpenJDK 11 use the SpecClassFileSelector to include Spock tests within the JUnit ant task

   <junit fork="true"
                        <fileset dir="lib">
                            <patternset refid="pattern.test-run-jars"/>
                    <path refid="@{module}.classpath.compile"/>
                <formatter type="xml" usefile="true"/>
                <batchtest fork="true" todir="@{module}/build/unittestreports">
                    <fileset dir="@{module}/src/test">
                        <include name="**/*"/>
                        <include name="**/*"/>
                    <fileset dir="@{module}/build/test">
                        <custom classname="org.spockframework.buildsupport.ant.SpecClassFileSelector"


OpenJDK 11.0.3

Build tool version

Ant 1.10.6

Operating System

Windows 10


IntelliJ Ultimate 2018.2

Build-tool dependencies used



This comment has been minimized.

Copy link

commented Sep 3, 2019

Spock 1.3 should provide asm7 (build.gradle):

asm: "org.ow2.asm:asm:7.0",

Are you sure that nothing else causes asm4 on your classpath?


This comment has been minimized.

Copy link

commented Sep 4, 2019

Actually ASM4 is used on two places, EmptyAnnotationVisitor and SpecClassFileVisitor.
@szpak what version you have on the classpath is irrelevant, as you specify the version you want to use by code.
The sonar-findbugs plugin had the same problem, specifying ASM5 instead of the latest: spotbugs/sonar-findbugs#253


This comment has been minimized.

Copy link

commented Sep 4, 2019

I missed that it was about "passing Opcode of ASM4", not that asm:4 was used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.