Closed MaximoOliveira closed 3 years ago
Hi @MaximoOliveira
Thanks for the detailed report of the issue.
One question: If you don't apply the change you mention in the if (i.e., reducing the expression from the condition). Do you have the same issue? i.e., the ingredients are not transformed.
Regards Matias
Hi @martinezmatias
If I dont apply the changes the ingredient _Node_0 does not appear:
Instead of 5 ingredients we have 3.
The transformations for these 3 ingredients are applied
I see, so that means that the bug (ingredients are not transformed) only appears when we include the CtVariables in the list of ingredients, right?
Correct!
okey, thanks. I would say that CtVariable should not include as ingredients because they are not expressions thus, they cannot be evaluated (and Cardumen needs to evaluate the ingredient in order to replace one piece of code per another with compatible type). An ingredient could be a CtVariableAccess (in particular CtVariableRead) which in that case the ingredient could be evaluated.
Thank you!
Hello @martinezmatias !
I'm testing something on Cardumen and am getting a different result than the expected. I've tried a couple of things and had no success. Maybe you could know what is causing this problem
Sorry for the long post :p I appreciate any help you can give!
I've made the following single change on Cardumen: Removed part of code ''|| element instanceof CtVariableAccess", so that variables are also considered in the search space. https://github.com/SpoonLabs/astor/blob/28b285b4ff41ce65affc537a54e4ea4300a6d1ef/src/main/java/fr/inria/astor/core/manipulation/filters/ExpressionIngredientSpaceProcessor.java#L30
And tested this change with the program DETECT_CYCLE from QuixBugs: https://github.com/KTH/quixbugs-experiment/blob/master/src/main/java/java_programs/DETECT_CYCLE.java
With these changes we should see that when the modification point at line 21 is the expression
tortoise.getSuccessor()
:We should have an ingredient in the form: _Node_0 , which we currently get:
However when the transformation is done:
the variables present do not replace the template _Node_0:
The
ingredientsAfterTransformation
list has 3 DynamicIngredient all with the shown expection, and when evaluating them the Ingredients are in the form:_Node_0
and nothare
, (as expected)I leave the test case here in case it helps: `public void test_detect_cycle_cardumen() throws Exception { AstorMain main1 = new AstorMain();