-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
Interface to Exclude Compilation Units From CtModel. #1037
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks quite interesting, but there is an encapsulation issue.
* @return {@code true} if and only if {@code cud} should be excluded, | ||
* {@code false} otherwise. | ||
*/ | ||
boolean exclude(final CompilationUnitDeclaration cud, final String path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a JDT interface. Ideally, all Spoon interfaces only depend on other Spoon interfaces (good encapsulation). What about changing to CompilationUnit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I stored this file in support/compiler/jdt
rather than support/compiler/
. Changing the parameter cud
from CompilationUnitDeclaration
to CompilationUnit
should be feasible, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, doesn't JDTBasedSpoonCompiler.java
have to traverse a compilation unit in order to produce a CompilationUnit
. That's exactly what I want to avoid here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think removing the first parameter might be the best solution here.
@@ -413,7 +414,15 @@ protected boolean buildUnitsAndModel(JDTBuilder jdtBuilder, SpoonFolder sourcesF | |||
|
|||
protected void buildModel(CompilationUnitDeclaration[] units) { | |||
JDTTreeBuilder builder = new JDTTreeBuilder(factory); | |||
units: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change the name of the label because it is the same as the parameter. It is confusing.
Ex: unitLoop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Is this PR ready to merge or do I miss something? |
Thank you for merging. |
Thanks for your contribution.
|
fixes #985