-
-
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
fix(scanner): add missing scan properties based on a new powerful specification #966
Conversation
0449873
to
752f0d0
Compare
// and then we can have smaller clean tested pull requests to see the impact of the change | ||
// cp ./target/generated/spoon/reflect/visitor/CtBiScannerDefault.java ./src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java | ||
//assertThat(build(new File("./src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java")).Class().get(CtBiScannerDefault.class)) | ||
// .isEqualTo(build(new File("./target/generated/spoon/reflect/visitor/CtBiScannerDefault.java")).Class().get(CtBiScannerDefault.class)); |
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 test is useless without assert.
we don't necessarily want to hard-wired the relation bewteen CtScanner and CtBiScannerDefault.java
Yes we went because CtBiScanner is used for the equality of two elements. Without this assertion we may have bug in equals
@@ -122,6 +137,7 @@ public void testGenerateCloneVisitor() throws Exception { | |||
launcher.run(); | |||
|
|||
// cp ./target/generated/spoon/support/visitor/clone/CloneBuilder.java ./src/main/java/spoon/support/visitor/clone/CloneBuilder.java | |||
// cp ./target/generated/spoon/support/visitor/clone/CloneVisitor.java ./src/main/java/spoon/support/visitor/clone/CloneVisitor.java |
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.
why did you copy the line?
t2.add(computeSimpleSignature((CtMethod<?>) invoc.getExecutable().getExecutableDeclaration())); | ||
} | ||
assertEquals("CtScanner contract violated for "+t.getSimpleName(), t1, t2); | ||
} |
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.
indentation
final ActualCounterScanner actual = new ActualCounterScanner(); | ||
actual.biScan(pack, pack.clone()); | ||
assertEquals(expected.expectedCounter, actual.counter); |
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.
removes ActualCounterScanner.counter if not used
752f0d0
to
3935a80
Compare
The idea is no annotate the metamodel methods with Spoon-specific annotations:
@DerivedProperty
for getters that are derived from other properties@UnsettableProperty
for setters that are not usable in certains casesThen, the core contract is that
CtScanner
must visit all settable, non-derived properties.By doing this, I found a couple of bugs in CScanner (property not visited)