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(equal): regenerate EqualVisitor based on new Scanner, which fixes a number of bugs incl. #978 #993

Merged
merged 1 commit into from
Nov 22, 2016

Conversation

monperrus
Copy link
Collaborator

@monperrus monperrus commented Nov 19, 2016

closes #978

biScan(annotationFieldAccess.getTypeCasts(), other.getTypeCasts());
biScan(annotationFieldAccess.getTarget(), other.getTarget());
Copy link
Collaborator

Choose a reason for hiding this comment

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

We dont need the target?

@@ -18,243 +18,275 @@

package spoon.support.visitor.clone;

import java.lang.annotation.Annotation;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you disable the autoImport in order to see the important change?

try {
assertThat(actual)
.isEqualTo(expected);
} catch (AssertionError e) {
throw new ComparisonFailure("ReplacementVisitor different", expected.toString(), actual.toString());
//throw new ComparisonFailure("ReplacementVisitor different", expected.toString(), actual.toString());
Copy link
Collaborator

Choose a reason for hiding this comment

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

please had at least a logger

@monperrus
Copy link
Collaborator Author

done. mergeable from my point of view, so as to proceed with the next ones.

public class EqualsVisitor extends spoon.reflect.visitor.CtAbstractBiScanner {
public static boolean equals(spoon.reflect.declaration.CtElement element, spoon.reflect.declaration.CtElement other) {
return !(new spoon.support.visitor.equals.EqualsVisitor().biScan(element, other));
public class EqualsVisitor extends CtBiScannerDefault {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This class is now manually maintained?

@monperrus
Copy link
Collaborator Author

monperrus commented Nov 21, 2016

Yes. However, it will eventually only contain one enter method.

CtTry var = factory.Code().createCodeSnippetStatement("try{}catch(RuntimeException | AssertionError e){}").compile();
CtTry var2 = var.clone();
var2.getCatchers().get(0).getParameter().getMultiTypes().remove(0);
assertNotEquals(1, var.getComments().size());
Copy link
Collaborator

Choose a reason for hiding this comment

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

this test is not related to comments

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you're right, fixed

@tdurieux tdurieux merged commit 276d23b into INRIA:master Nov 22, 2016
@msteinbeck
Copy link
Contributor

Thank you!

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.

EqualsVisitor Does Not Consider Comments
3 participants