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

refactor: change ImportScanner interface to add getAllImports #1339

Merged
merged 3 commits into from
May 31, 2017

Conversation

surli
Copy link
Collaborator

@surli surli commented May 30, 2017

This PR fixes #1329 by adding a new method getAllImports and by deprecating computeImports and computeAllImports because their return type will change in the future to void.

@monperrus
Copy link
Collaborator

monperrus commented May 30, 2017 via email

@surli
Copy link
Collaborator Author

surli commented May 30, 2017

Do we have to return the generic type? Would a cast be enough?

Yes, because it can be a CtTypeReference, a CtFieldReference or a CtExecutableReference.

(a deprecation should not come with a signature change)

Yes, but how to deprecate the usage of the return type then?...
I cannot create new methods returning void in the interface.

*/
Collection<CtTypeReference<?>> computeImports(CtElement element);
Collection<CtReference> computeImports(CtElement element);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Undo that change

@@ -32,18 +31,27 @@
* Computes import of a {@link spoon.reflect.declaration.CtElement}
*
* @return class imports computed by Spoon, it does not contain static imports
* @deprecated This method signature will change to return void: Use getAllImports to get the imports after calling it.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add the reason: for improving encapsulation and design

@spoon-bot
Copy link
Collaborator

Revapi Analysis results

Old API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170530.131811-139

New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT

Detected changes: 1.

Change 1

Name Element
Old none
New method java.util.Collection<spoon.reflect.reference.CtReference> spoon.reflect.visitor.ImportScanner::getAllImports()
Code java.method.addedToInterface
Description Method was added to an interface.
Breaking source: breaking,

@@ -32,6 +32,7 @@
* Computes import of a {@link spoon.reflect.declaration.CtElement}
*
* @return class imports computed by Spoon, it does not contain static imports
* @deprecated This method signature will change to return void in order to improve encapsulation: Use getAllImports to get the imports after calling it.
Copy link
Collaborator

Choose a reason for hiding this comment

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

the @deprecated should also be outside the javadoc

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@spoon-bot
Copy link
Collaborator

Revapi Analysis results

Old API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170531.080348-145

New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT

Detected changes: 1.

Change 1

Name Element
Old none
New method java.util.Collection<spoon.reflect.reference.CtReference> spoon.reflect.visitor.ImportScanner::getAllImports()
Code java.method.addedToInterface
Description Method was added to an interface.
Breaking source: breaking,

@monperrus monperrus merged commit 3404e71 into INRIA:master May 31, 2017
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.

refactor: ImportScanner#computeImports should return void
3 participants