Here is the stacktrace
Method <clinit> is not static in class file $Subclass_ClassUnderTest
java.lang.ClassFormatError: Method <clinit> is not static in class file $Subclass_ClassUnderTest
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 ClassUnderTestTestcase$3.<init>(ClassUnderTestTestcase.java:xx)
at ClassUnderTestTestcase.testSettersAndGetters(ClassUnderTestTestcase.java:xx)
I tried to investigate the bytecode and found something unusual(i guess)
**With Java 11**
// access flags 0x100A
private static synthetic $jacocoInit()[Z
GETSTATIC ClassUnderTest.$jacocoData : [Z
DUP
IFNONNULL L0
POP
LDC -1475355800743669619
LDC "ClassUnderTest"
BIPUSH 64
INVOKESTATIC org/jacoco/agent/rt/internal_1f1cc91/Offline.getProbes (JLjava/lang/String;I)[Z
DUP
PUTSTATIC ClassUnderTest.$jacocoData : [Z
L0
**With Java8**
// access flags 0x100A
private static synthetic $jacocoInit()[Z
GETSTATIC ClassUnderTest.$jacocoData : [Z
DUP
IFNONNULL L0
POP
LDC 4330111099009117958
LDC "ClassUnderTest"
BIPUSH 64
INVOKESTATIC org/jacoco/agent/rt/internal_1f1cc91/Offline.getProbes (JLjava/lang/String;I)[Z
DUP
PUTSTATIC ClassUnderTest.$jacocoData : [Z
L0
Any Idea?
Any Idea?
I'm pretty sure that if you'll try the same without JaCoCo, then you'll observe exactly the same problem, which means that it is not caused by JaCoCo.Here do you mean i should try without instrumentation or with some other instrumentation tools?