Open palashborhanuddin opened 3 years ago
Missing Edge rules (updated in previous comment): SRC: 1: StringBuffer -> DST: 2: BufferedReader (which Rule?) SRC: 4:WHILE -> DST: 7:IF (Rule 2) SRC: 5:BufferedReader.readLine -> DST: 6:StringBuffer.append, (Rule 1, Rule 5) SRC: 5:BufferedReader.readLine -> DST: 11:BufferedReader.close, (Rule 1) SRC: 6:StringBuffer.append -> DST: 10:StringBuffer.toString, (Rule 1, Rule 4) SRC: 8:StringBuffer.length -> DST: 10:StringBuffer.toString (Rule 1, Rule 4)
Missing cases as:
SRC: 1:
TODO: Above three requires storing the control structure scope information and resolve implicit data dependency information.
Following data dependencies are addressed: SRC: 5:BufferedReader.readLine -> DST: 11:BufferedReader.close SRC: 6:StringBuffer.append -> DST: 10:StringBuffer.toString SRC: 8:StringBuffer.length -> DST: 10:StringBuffer.toString
Current GROUM state:
nodes=
1:StringBuffer.
edges=
SRC: 1:StringBuffer.
What if there is an involved variable shared between X and Y where X(parallelmerge)Y? should there be an Edge between X and Y?
Nodes:
1 StringBuffer.
3 FileReader.
2 BufferedReader.
5 BufferedReader.readLine-->4 WHILE 5 BufferedReader.readLine-->11 BufferedReader.close 5 BufferedReader.readLine-->6 StringBuffer.append
4 WHILE-->6 StringBuffer.append 4 WHILE-->7 IF
6 StringBuffer.append-->8 StringBuffer.length 6 StringBuffer.append-->10 StringBuffer.toString
8 StringBuffer.length-->7 IF 8 StringBuffer.length-->10 StringBuffer.toString
7 IF-->10 StringBuffer.toString
10 StringBuffer.toString-->11 BufferedReader.close
Final state of the Edges for the Example source excerpted from the paper:
1 StringBuffer.<-init>-->3 FileReader.<-init > 1 StringBuffer.<-init >-->6 StringBuffer.append 1 StringBuffer.<-init >-->8 StringBuffer.length 1 StringBuffer.<-init >-->10 StringBuffer.toString 1 StringBuffer.<-init >-->2 BufferedReader.<-init>
3 FileReader.<-init >-->2 BufferedReader.<-init>
2 BufferedReader.<-init >-->5 BufferedReader.readLine 2 BufferedReader.<-init >-->11 BufferedReader.close
5 BufferedReader.readLine-->4 WHILE 5 BufferedReader.readLine-->11 BufferedReader.close 5 BufferedReader.readLine-->6 StringBuffer.append
4 WHILE-->6 StringBuffer.append 4 WHILE-->7 IF
6 StringBuffer.append-->8 StringBuffer.length 6 StringBuffer.append-->10 StringBuffer.toString
8 StringBuffer.length-->7 IF 8 StringBuffer.length-->10 StringBuffer.toString
7 IF-->10 StringBuffer.toString
10 StringBuffer.toString-->11 BufferedReader.close
The above edge list is complete according to the GROUM representation demonstrated in the paper.
Here is the output of the GROUM generation so far. Paper method example has been used for testing. There is a screenshot added showing the RefactoringMatcher output with the Graph from the paper.
Format: nodeID:nodeValue
Groum
nodes=[ 1: StringBuffer,
3: FileReader,
2: BufferedReader,
5:BufferedReader.readLine,
4:WHILE,
6:StringBuffer.append,
8:StringBuffer.length,
7:IF,
10:StringBuffer.toString,
9:outputMessage,
11:BufferedReader.close]
]
edges=[ SRC: 1: StringBuffer -> DST: 3: FileReader,
SRC: 1: StringBuffer -> DST: 6:StringBuffer.append,
SRC: 1: StringBuffer -> DST: 8:StringBuffer.length,
SRC: 1: StringBuffer -> DST: 10:StringBuffer.toString,
SRC: 3: FileReader -> DST: 2: BufferedReader,
SRC: 2: BufferedReader -> DST: 5:BufferedReader.readLine,
SRC: 2: BufferedReader -> DST: 11:BufferedReader.close,
SRC: 5:BufferedReader.readLine -> DST: 4:WHILE,
SRC: 4:WHILE -> DST: 6:StringBuffer.append,
SRC: 6:StringBuffer.append -> DST: 8:StringBuffer.length,
SRC: 8:StringBuffer.length -> DST: 7:IF,
SRC: 7:IF -> DST: 10:StringBuffer.toString, SRC: 7:IF -> DST: 9:outputMessage
SRC: 10:StringBuffer.toString -> DST: 9:outputMessage,
SRC: 9:outputMessage -> DST: 11:BufferedReader.close, ]
Dissimilarities:
Comparing with the paper output, Missing a few edges such as:
SRC: 1: StringBuffer -> DST: 2: BufferedReader (which Rule?)
SRC: 4:WHILE -> DST: 7:IF (Rule 2)
SRC: 5:BufferedReader.readLine -> DST: 6:StringBuffer.append, (Rule 1, Rule 5)
SRC: 5:BufferedReader.readLine -> DST: 11:BufferedReader.close, (Rule 1)
SRC: 6:StringBuffer.append -> DST: 10:StringBuffer.toString, (Rule 1, Rule 4)
SRC: 8:StringBuffer.length -> DST: 10:StringBuffer.toString (Rule 1, Rule 4)
Questions in the paper output:
Question on current implementation to clarify:
in> private void processNode(CompilationUnit compilationUnit, PDGNode pdgNode) what if there are multiple inner nodes? there is no link to previous popped node as the current one is going to replace that. so it will just keep a record of only one inner expression. Do we need to consider this? If Yes, then need to change in a few other places as well where inner nodes are used to generate the graph. [UPDATE concern addressed]