Closed sepe81 closed 3 years ago
i have the same problem
java.lang.instrument.IllegalClassFormatException: Error while instrumenting com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes$Definition.
at org.jacoco.agent.rt.internal_43f5073.CoverageTransformer.transform(CoverageTransformer.java:94)
at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:246)
at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:563)
...
Caused by: java.io.IOException: Error while instrumenting com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes$Definition.
at org.jacoco.agent.rt.internal_43f5073.core.instr.Instrumenter.instrumentError(Instrumenter.java:159)
at org.jacoco.agent.rt.internal_43f5073.core.instr.Instrumenter.instrument(Instrumenter.java:109)
at org.jacoco.agent.rt.internal_43f5073.CoverageTransformer.transform(CoverageTransformer.java:92)
...
Caused by: org.jacoco.agent.rt.internal_43f5073.asm.MethodTooLargeException: Method too large: com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes$Definition.<clinit> ()V
at org.jacoco.agent.rt.internal_43f5073.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2087)
at org.jacoco.agent.rt.internal_43f5073.asm.ClassWriter.toByteArray(ClassWriter.java:447)
at org.jacoco.agent.rt.internal_43f5073.core.instr.Instrumenter.instrument(Instrumenter.java:90)
at org.jacoco.agent.rt.internal_43f5073.core.instr.Instrumenter.instrument(Instrumenter.java:107)
The code is generated by javacc and i see no real chance to make the code smaller. But on the other hand i also see no real need for a project to instrument the code - why not excluding the cssparser?
Ok, thank you. I try to exclude it.
@sepe81 did an exclusion work? if so, can you please show how you excluded?
@alan-czajkowski The following exclusion worked:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>com/gargoylesoftware/**</exclude>
</excludes>
</configuration>
</plugin>
This problem has been resolved in JavaCC 21. See: https://javacc.com/2021/03/30/code-too-large-problem-fixed/
@sepe81 how would you achieve the same using gradle?
@jonathansp this might help: https://www.baeldung.com/jacoco-report-exclude
but I strongly recommend moving away from Gradle to Maven
If you are using https://www.eclemma.org/jacoco/ for code analysis and the project under test uses
htmlunit-cssparser
then you get the following output during analysis.If I get it right,
CSS3ParserTokenManager
is part of generated code (https://github.com/HtmlUnit/htmlunit-cssparser/blob/master/pom.xml#L65).Would it be possible to restructure some part of the code generation to decrease the method size under 64K?
You can find a similar issue at https://stackoverflow.com/questions/37666076/jacoco-method-code-too-large-when-using-ver-0-7-6-and-0-7-5