hi,
I want to skip instrument a class named BlockBuilderStatus.class ,but it
didn't work , here is my configuration ,is there anything wrong?
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>
*.jar
</exclude>
<exclude>
**/BlockBuilderStatus.class
</exclude>
</excludes>
</configuration>
</plugin>
Method deepInstanceSize in BlockBuilderStatus.java will be invoked when the
class is loaded , and it throws an Exception when use jacoco , it will go into
'if (clazz.isArray())' this branch. so I want to skip instrument the class .
private static int deepInstanceSize(Class<?> clazz)
{
if (clazz.isArray()) {
throw new IllegalArgumentException(String.format("Cannot determine
size of %s because it contains an array", clazz.getSimpleName()));
}
if (clazz.isInterface()) {
throw new IllegalArgumentException(String.format("%s is an
interface", clazz.getSimpleName()));
}
if (Modifier.isAbstract(clazz.getModifiers())) {
throw new IllegalArgumentException(String.format("%s is abstract",
clazz.getSimpleName()));
}
if (!clazz.getSuperclass().equals(Object.class)) {
throw new IllegalArgumentException(String.format("Cannot determine
size of a subclass. %s extends from %s", clazz.getSimpleName(),
clazz.getSuperclass().getSimpleName()));
}
int size = ClassLayout.parseClass(clazz).instanceSize();
for (Field field : clazz.getDeclaredFields()) {
if (!field.getType().isPrimitive()) {
size += deepInstanceSize(field.getType());
}
}
return size;
}
--
You received this message because you are subscribed to the Google Groups
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/4017a54e-f18b-4ab1-9b45-4f112a0ff242%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.