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

review: fix: stackoverflow on AbstractTypingContext #1817

Merged

Conversation

surli
Copy link
Collaborator

@surli surli commented Jan 10, 2018

Fix #1783

@surli
Copy link
Collaborator Author

surli commented Jan 10, 2018

@pvojtechovsky could you review this one?

@surli surli changed the title WiP: fix: stackoverflow on AbstractTypingContext review: fix: stackoverflow on AbstractTypingContext Jan 10, 2018
l.buildModel();

CtType<?> propertyComparator = l.getModel().getElements(new NamedElementFilter<CtType>(CtType.class, "PropertyComparator")).get(0);
CtMethod method = propertyComparator.getMethodsByName("compare").get(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Which call failed on StackOverflowError?
A) getMethodsByName
B) getSignature

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

getMethodsByName

Copy link
Collaborator

Choose a reason for hiding this comment

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

So why did you removed this method call from the test??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

:D sorry I answer yesterday evening and actually I was wrong: it's getAllMethods which led to the bug. My test wasn't failing after all yesterday.

@@ -0,0 +1,156 @@
/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you delete as much as possible from this file, so there remains only the code needed to reproduce error?
I do not see there what code caused problem. Or is some combination of all TypeMembers??

// we are in a case where we compare Thing<?> with Thing<? super X>
// here we choose to not care about X to avoid recursive calls, for example in the case of:
// T extends Comparable<? super T>
if (scopeBoundWildcard.getBoundingType().equals(scopeMethod.getFactory().Type().getDefaultBoundingType())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

May this happen too?
T extends Comparable<? super List<? extends T>>
I guess it will end wit stackoverflow too.

Anyway your solution is good fast fix. My example is quite wild and it will need some time until somebody come to such problem again.

@pvojtechovsky
Copy link
Collaborator

It seems to be OK for me. I will merge it tomorrow after your feedback - whether you want to improve it or keep it as it is.

@surli
Copy link
Collaborator Author

surli commented Jan 12, 2018

@pvojtechovsky for me it's ready now.

@pvojtechovsky pvojtechovsky merged commit 8f39127 into INRIA:master Jan 12, 2018
@pvojtechovsky
Copy link
Collaborator

Thank You Simon ;-)

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.

2 participants