Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug related to "insertBefore()" and "getSignature()" #450

Merged
merged 3 commits into from
Dec 9, 2015
Merged

Fix bug related to "insertBefore()" and "getSignature()" #450

merged 3 commits into from
Dec 9, 2015

Conversation

maxcleme
Copy link
Contributor

@maxcleme maxcleme commented Dec 8, 2015

There is the same bug on insertAfter, but i didn't succeed to fix it.

@@ -183,7 +183,13 @@ void insert(CtBlock<?> block, CtStatementList statementsToBeInserted) {

@Override
void insertFromFirstStatement(CtBlock<?> block, CtStatement target, CtStatementList statementsToBeInserted) {
int indexOfTargetElement = block.getStatements().indexOf(target);
int indexOfTargetElement = -1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops? indentation with tabs? (this is the cause of travis' failure)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

I just tried to use the formatter included with the spoon' repository ( SpoonFormatterPrefs.xml ), however when I apply it to the project, 458 files are modified. Do you really use this formatter ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope: #393

@tdurieux
Copy link
Collaborator

tdurieux commented Dec 8, 2015

Too clarify this fix:
The error was in this line int indexOfTargetElement = block.getStatements().indexOf(target); because indexOf uses the equality between two objects but in this case we are looking for the reference equality (that was the case before 6703c2e#diff-0e647d5fcf8e2eea99bd6087436a08baL190).
The bug is probably also present in other locations of this class.

@monperrus
Copy link
Collaborator

that was the case before
6703c2e#diff-0e647d5fcf8e2eea99bd6087436a08baL190
6703c2e#diff-0e647d5fcf8e2eea99bd6087436a08baL190
fun! a test was clearly missing :-)

@tdurieux
Copy link
Collaborator

tdurieux commented Dec 9, 2015

I fixed the insertEnd and insertAfter in this branch https://github.com/tdurieux/spoon/tree/fix-insert

@monperrus
Copy link
Collaborator

after discussion with @maxcleme , he lets us resolve the formatting (grrr #393) and add the missing case.
@GerardPaligot , do you handle this?

@GerardPaligot
Copy link
Contributor

@tdurieux already did it this morning: https://github.com/maxcleme/spoon/pull/1

@monperrus
Copy link
Collaborator

could you close this PR and check and accept the other one?

@GerardPaligot
Copy link
Contributor

The PR of @tdurieux isn't on the spoon project. It is a PR on this PR. @maxcleme must accept it and this PR will be automatically updated.

Fix insertAfter and insertEnd
monperrus added a commit that referenced this pull request Dec 9, 2015
@monperrus monperrus merged commit ca7168c into INRIA:master Dec 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants