Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix FQN regression in FQN mode #1052

Merged
merged 16 commits into from
Dec 19, 2016
Merged

Fix FQN regression in FQN mode #1052

merged 16 commits into from
Dec 19, 2016

Conversation

surli
Copy link
Collaborator

@surli surli commented Dec 19, 2016

The previously implemented MinimalImportScanner was only comparing FQN against list of previously explored variables, which means all variables were considered even those which were not on the scope of the current variable. It fixes issue #1045.
The proposed implementation now only check the current scope to search name collisions.
Moreover, now the ImportScanner is recreated in DefaultJavaPrettyPrinter when calculate method is called: it avoids the scanner to test collision names against another class variable names, but it should also fix #1041 (to be tested).

monperrus and others added 15 commits November 16, 2016 22:28
…ith an or instead of an and. Now the test is failing, proof that the assertion is checked :)
… a local variable in the same block or by a field (or a variable in another block). First detection implemented but patch not satisfying.
…er to only consider name collision in the scope to do imports. WiP.
/**
* Determine if the ImportScanner should work in a FQN mode or in auto import mode.
*/
private boolean fqnMode;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

handle with polymorphism

@@ -10,11 +10,16 @@
import spoon.reflect.declaration.CtElement;
import spoon.reflect.declaration.CtType;
import spoon.reflect.visitor.Filter;
import spoon.reflect.visitor.PrettyPrinter;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

don't touch this test

@surli surli changed the title Fix FQN regression and optimize imports in FQN mode Fix FQN regression in FQN mode Dec 19, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improvement: setAutoimport and DefaultJavaPrettyPrinter
2 participants