[
https://issues.apache.org/jira/browse/LABS-286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12668924#action_12668924
]
Simone Gianni commented on LABS-286:
------------------------------------
Anyway, since test are executed in an LTW environment, this should not be a
problem at all.
In fact it is not a problem, probably those lines were there since the time its
was not an LTW environment. Now it runs Cobertura generated classes.
Unfortunately this still does not work. Seems like Cobertura alters the class
in a way that makes it not parsable by BCEL (while javap gives no error at
all). The exact exception is :
File: 'org.apache.magma.website.Contextualizer': Invalid byte tag in constant
pool: 16
org.aspectj.apache.bcel.classfile.ClassFormatException: File:
'org.apache.magma.website.Contextualizer': Invalid byte tag in constant pool: 16
at
org.aspectj.apache.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:192)
at
org.aspectj.apache.bcel.classfile.ClassParser.parse(ClassParser.java:131)
at org.aspectj.weaver.bcel.Utility.makeJavaClass(Utility.java:504)
at
org.aspectj.weaver.bcel.BcelWeaver.addLibraryAspect(BcelWeaver.java:186)
In fact, 16 is not a valid constant type id, but javap seems not to give this
error, so probably BCEL is making some errors in parsing the class file.
This is what is added by Cobertura in the constant pool (according to javap
output, polished out a bit to obtain a meaningful diff) :
4d3
< Asciz ()Lnet/sourceforge/cobertura/coveragedata/ProjectData;;
10,11d8
< Asciz (I)V;
< Asciz (IIZ)V;
13d9
< Asciz
(Ljava/lang/String;)Lnet/sourceforge/cobertura/coveragedata/ClassData;;
24d19
< Asciz I;
39,40d33
< Asciz __cobertura__branch__number__;
< Asciz __cobertura__line__number__;
53d45
< Asciz getGlobalProjectData;
55d46
< Asciz getOrCreateClassData;
61,64d51
< Asciz net/sourceforge/cobertura/coveragedata/ClassData;
< Asciz net/sourceforge/cobertura/coveragedata/HasBeenInstrumented;
< Asciz net/sourceforge/cobertura/coveragedata/ProjectData;
< Asciz org.apache.magma.website.Contextualizer;
86,87d72
< Asciz touch;
< Asciz touchJump;
95,98d79
< Method #.#; //
net/sourceforge/cobertura/coveragedata/ClassData.touch:(I)V
< Method #.#; //
net/sourceforge/cobertura/coveragedata/ClassData.touchJump:(IIZ)V
< Method #.#; //
net/sourceforge/cobertura/coveragedata/ProjectData.getGlobalProjectData:()Lnet/sourceforge/cobertura/coveragedata/ProjectData;
< Method #.#; //
net/sourceforge/cobertura/coveragedata/ProjectData.getOrCreateClassData:(Ljava/lang/String;)Lnet/sourceforge/cobertura/coveraged
ata/ClassData;
114d94
< NameAndType #:#;//
getGlobalProjectData:()Lnet/sourceforge/cobertura/coveragedata/ProjectData;
116d95
< NameAndType #:#;//
getOrCreateClassData:(Ljava/lang/String;)Lnet/sourceforge/cobertura/coveragedata/ClassData;
122,124d100
< NameAndType #:#;// touch:(I)V
< NameAndType #:#;// touchJump:(IIZ)V
< String #; // org.apache.magma.website.Contextualizer
128,130d103
< class #; // net/sourceforge/cobertura/coveragedata/ClassData
< class #; //
net/sourceforge/cobertura/coveragedata/HasBeenInstrumented
< class #; // net/sourceforge/cobertura/coveragedata/ProjectData
> [maven] Compatibility with the Cobertura plugin
> -----------------------------------------------
>
> Key: LABS-286
> URL: https://issues.apache.org/jira/browse/LABS-286
> Project: Labs
> Issue Type: Improvement
> Components: Magma
> Affects Versions: Current
> Reporter: Simone Gianni
> Assignee: Simone Gianni
> Fix For: Current
>
>
> The Magma maven plugin needs to weave also main classes for tests, because
> there can be test aspects to be applied to main classes. Then the test goal
> places the test classes on top of the classpath so that weaved main classes
> takes precedence over the non weaved ones. This works fine as long as nothing
> else interferes.
> The Cobertura plugin however takes the test classes, instruments them for
> Cobertura, and place them in another folder. Then somehow the default
> surefire plugin uses that folder for running tests, while the Magma plugin
> holds on the standard test folder.
> As a result, Cobertura reports as if nothing has been executed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]