These are chat archives for JnRouvignac/AutoRefactor

28th
Sep 2016
Luis Cruz
@luiscruz
Sep 28 2016 12:51
Hi Jean-Noël, I was busy with an online course but I get back on this again today!
Jean-Noël Rouvignac
@JnRouvignac
Sep 28 2016 14:42
Hi Luis
No problem
Luis Cruz
@luiscruz
Sep 28 2016 15:25
So, I want to check whether there is any invocation of wakelock.acquire() but there is no invocation of wakelock.release(). Detecting the acquire is quite easy, but I want to make sure there is no release invocation.
Should I check the release() invocation in the whole class upon the detection of acquire() invocation?
OR
Can I create a flag in the Refactoring class that will store the finding of these invocations and after traversing the whole AST, I’ll decide if I have to apply a refactoring? Is this possible? What do you think?
Luis Cruz
@luiscruz
Sep 28 2016 15:32
Here’s what I am going to do: I’ll create a new subclass of AbstractRefactoringRule that will only check the release presence and store it in an instance field.
In fact this will be an ASTVisitorsubclass
Luis Cruz
@luiscruz
Sep 28 2016 16:04
perhaps using endVisitorwould get the job done without requiring an extra astvisitor
Jean-Noël Rouvignac
@JnRouvignac
Sep 28 2016 19:58
I think you are on the right track
Do not change the Refactorings class
I think extending the ASTVisitor is the right thing to do
The
I cannot see how the endVisitor() method can help you
Luis Cruz
@luiscruz
Sep 28 2016 20:04
Alright, im done for today but I managed to create a astvisitor to check release existence :)
Jean-Noël Rouvignac
@JnRouvignac
Sep 28 2016 20:06
Great!